Skip to content

A shared ESLint configuration with Chinese comments. 一份带有完整中文注释的 ESLint 规则。

License

Notifications You must be signed in to change notification settings

mingelz/eslint-config-mingelz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-config-mingelz

Version

A shared ESLint configuration with Chinese comments by mingelz.

一份带有完整中文注释的 ESLint 规则。请打开 rules 目录下的文件,阅读每个规则的详细说明。


Quick start | 快速开始

Installation | 安装

npm install eslint-config-mingelz --save-dev

Configure | 配置

Add a .eslintrc.js file with following content to your project root directory:
在项目根目录下新建 .eslingrc.js 文件,并写入下列内容:

module.exports = {
  env: {
    browser: true,
    node: true,
  },
  extends: [
    'mingelz',
  ],
}

Documentation | 文档

Basic configuration | 基本配置

NOTICE: This configuration is dependent on eslint@^7.24, please install it manually: npm install -D eslint.
注意: 此配置依赖 eslint@^7.24,请先手动安装此依赖: npm install -D eslint

module.exports = {
  env: {
    browser: true,
    node: true,
  },
  extends: [
    'mingelz',
  ],
  rules: {
    // your special rules
    // 你的需要补充的规则
  },
}

Vue configuration | Vue 配置

NOTICE: This configuration is dependent on eslint-plugin-vue@^7.9, please install it manually: npm install -D eslint-plugin-vue.
注意: 此配置依赖 eslint-plugin-vue@^7.9,请先手动安装此依赖: npm install -D eslint-plugin-vue

module.exports = {
  // ...
  extends: [
    'mingelz',
    // The configuration will detect Vue.js version of your project automatic.
    // 此配置会自动检查你使用的 Vue.js 版本,并开启相应规则
    'mingelz/rules/vue',
  ],
  // ...
}

React configuration | React 配置

NOTICE: This configuration is dependent on eslint-plugin-react@^7.23, please install it manually: npm install -D eslint-plugin-react
注意: 此配置依赖 eslint-plugin-react@^7.23,请先手动安装此依赖: npm install -D eslint-plugin-react

module.exports = {
  // ...
  extends: [
    'mingelz',
    'mingelz/rules/react',
  ],
  // ...
}

Node.js configuration | Node.js 配置

The ESLint built-in Node.js/CommonJS-specific rules are deprecating, use eslint-plugin-node instead.
ESLint 自带的 Node.js/CommonJS 规则已废弃,请使用 eslint-plugin-node 替代。

NOTICE: This configuration is dependent on eslint-plugin-node@^11.1, please install it manually: npm install -D eslint-plugin-node
注意: 此配置依赖 eslint-plugin-node@^11.1,请先手动安装此依赖: npm install -D eslint-plugin-node

module.exports = {
  // ...
  extends: [
    'mingelz',
    'mingelz/rules/node',
  ],
  // ...
}

ES Module configuration | ES Module 配置

NOTICE: This configuration is dependent on eslint-plugin-import@^2.23, please install it manually: npm install -D eslint-plugin-import
注意: 此配置依赖 eslint-plugin-import@^2.23,请先手动安装此依赖: npm install -D eslint-plugin-import

If you are using Webpack resolve.alias, it is recommended to install eslint-import-resolver-webpack via npm install -D eslint-import-resolver-webpack, and configure it according to the webpack configuration file.
如果你正在使用 Webpack 的 resolve.alias 能力,建议通过命令 npm install -D eslint-import-resolver-webpack 安装 eslint-import-resolver-webpack 插件,并参照下述代码正确配置你的 Webpack 配置文件路径。

module.exports = {
  // ...
  extends: [
    'mingelz',
    'mingelz/rules/es-module',
  ],
  settings: {
    'import/resolver': {
      // webpack config example
      // webpack 配置示例
      webpack: {
        config: './webpack.config.js',
      },
    },
  },
  // ...
}

JSDoc configuration | JSDoc 配置

The ESLint built-in JSDoc rules was deprecated, use eslint-plugin-jsdoc instead.
ESLint 自带的 JSDoc 规则已废弃,请使用 eslint-plugin-jsdoc 替代。

NOTICE: This configuration is dependent on eslint-plugin-jsdoc@32.2, please install it manually: npm install -D eslint-plugin-jsdoc
注意: 此配置依赖 eslint-plugin-jsdoc@^32.2,请先手动安装此依赖: npm install -D eslint-plugin-jsdoc

module.exports = {
  // ...
  extends: [
    'mingelz',
    'mingelz/rules/jsdoc',
  ],
  // ...
}

[WIP] JSX accessibility configuration | [未完成] JSX 无障碍配置

NOTICE: This configuration is dependent on eslint-plugin-jsx-a11y, please install it manually: npm install -D eslint-plugin-jsx-a11y
注意: 此配置依赖 eslint-plugin-jsx-a11y,请先手动安装此依赖: npm install -D eslint-plugin-jsx-a11y

module.exports = {
  // ...
  extends: [
    'mingelz',
    'mingelz/rules/jsx-a11y',
  ],
  // ...
}

Releases

No releases published

Packages

No packages published