npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fe2345/eslint

v1.0.1

Published

前端代码校验

Downloads

56

Readme

eslint-config

前端eslint统一配置包,在Airbnb的规则上有所删减,支持对原生js,React和Vue的检查。

依赖说明

eslint // eslint 
eslint-loader // webpack 加载器
eslint-config-airbnb-base // 由Airbnb公司出品的格式化规则
eslint-friendly-formatter // eslint 错误报告器, 格式化报告信息, 解决终端输出格式不友好的问题
eslint-plugin-html // 检查Html内联脚本
eslint-plugin-import // 对ES6的 import/export 相关检查的支持
eslint-plugin-vue // 对 vue 的支持

eslint

eslint cn

eslint-loader

eslint-config-airbnb-base

eslint-friendly-formatter

eslint-plugin-import rules

eslint-plugin-vue rules

使用指南

1. 安装最新版npm包及其他配置依赖

npm install --save-dev @baba/eslint-config
npm install --save-dev eslint
npm install --save-dev gulp-eslint
npm install --save-dev run-sequence

2. 本地新建 .eslintrc.json.eslintignore 文件

.eslintrc.js文件配置示例:

module.exports = {
    parserOptions: {
        ecmaVersion: 2016,
        sourceType: 'module',
        ecmaFeatures: {
            jsx: true,
            impliedStrict: true
        }
    },
    env: {
        browser: true,
        node: true,
        es6: true,
        amd: false
    },
    globals: {
    },
    extends: ['@baba/eslint-config'],
    rules: {
    }
};

配置gulp

新建gulp task:

const gulpLoadPlugins = require('gulp-load-plugins');
const eslint = require('gulp-eslint');
/**
 * eslint source code
 */
gulp.task('eslint', () => (
    gulp.src([
        'src/**/*.js',
        'src/**/**.jsx',    // react项目
        'src/**/**.vue',    // vue项目
    ])
    .pipe(plugins.eslint())
    .pipe(eslint({ configFle: './.eslintrc', quiet: true }))
    .pipe(eslint.format(undefined, process.stderr))
    .pipe(plugins.eslint.failAfterError())
));

gulp default task中添加eslint:

gulp.task('default', ['clean'], (next) => {
    runSequence('eslint', 'stylelint', 'webpack', next);
});

React 建议关闭的 rules

"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/href-no-hash": "off",
"react/sort-comp": "off",
"react/jsx-boolean-value": "off",
"react/require-default-props": "off",
"react/no-array-index-key": "off",
"react/no-string-refs": "off",
"react/jsx-indent": "off",
"react/jsx-tag-spacing": "off",
"react/prop-types": "off",
"react/jsx-first-prop-new-line": "off",
"react/jsx-indent-props": "off",
"react/prefer-stateless-function": "off",
"react/jsx-max-props-per-line": "off",
"react/jsx-closing-bracket-location": "off",
"react/jsx-wrap-multilines": "off",
"react/no-multi-comp": "off",
"react/no-find-dom-node": "off"