123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- const path = require('path');
- module.exports = {
- parser: 'babel-eslint',
- // JavaScript 语言解析选项
- parserOptions: {
- // ECMAScript 版本
- ecmaVersion: 6,
- sourceType: 'module',
- // 额外的语言特性:
- ecmaFeatures: {
- experimentalDecorators: true,
- experimentalObjectRestSpread: true,
- jsx: true,
- },
- },
- extends: [
- 'plugin:import/errors',
- 'plugin:import/warnings',
- 'plugin:react/recommended',
- 'plugin:prettier/recommended',
- 'prettier/react',
- 'prettier/standard',
- ],
- plugins: ['babel', 'import', 'flowtype', 'jsx-a11y', 'react', 'redux-saga', 'prettier'],
- settings: {
- react: {
- version: '16.0',
- },
- 'import/resolver': {
- webpack: {
- config: path.resolve(__dirname, './config/webpack.config.dev.js'),
- },
- },
- },
- globals: {
- _: true,
- },
- // 预定义的全局变量。
- env: {
- browser: true,
- commonjs: true,
- es6: true,
- node: true,
- },
- // 以当前目录为根目录,不再向上查找
- root: true,
- rules: {
- // indent: [
- // 2,
- // 2,
- // {
- // SwitchCase: 1,
- // },
- // ],
- // 'comma-dangle': [2, 'always-multiline'],
- 'babel/new-cap': 0,
- 'arrow-body-style': [2, 'as-needed'],
- 'max-len': 0,
- 'no-plusplus': 0,
- 'no-console': 1,
- 'no-unused-vars': 'warn',
- 'no-script-url': 0,
- 'import/first': 0,
- 'no-underscore-dangle': 0,
- 'global-require': 0,
- 'import/imports-first': 0,
- 'import/no-dynamic-require': 0,
- 'import/extensions': 0,
- 'import/no-unresolved': [
- 2,
- {
- commonjs: true,
- amd: true,
- },
- ],
- 'import/prefer-default-export': 0,
- 'redux-saga/no-yield-in-race': 2,
- 'redux-saga/yield-effects': 2,
- 'react/require-default-props': 0,
- 'react/forbid-prop-types': 0,
- 'react/display-name': 0,
- 'jsx-a11y/aria-props': 2,
- 'jsx-a11y/heading-has-content': 0,
- 'jsx-a11y/label-has-for': 2,
- 'jsx-a11y/mouse-events-have-key-events': 2,
- 'jsx-a11y/role-has-required-aria-props': 2,
- 'jsx-a11y/role-supports-aria-props': 2,
- 'jsx-a11y/media-has-caption': 0,
- 'jsx-a11y/anchor-is-valid': [
- 'error',
- {
- components: ['Link'],
- specialLink: ['to'],
- aspects: ['noHref', 'preferButton'],
- },
- ],
- // 'react/jsx-first-prop-new-line': [2, 'multiline'],
- // 设置jsx允许的文件扩展名
- 'react/jsx-filename-extension': [
- 1,
- {
- extensions: ['.js', '.jsx'],
- },
- ],
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
- 'prettier/prettier': [
- 'error',
- // prettier 规则配置
- {
- endOfLine: 'auto', // 换行cr检查
- },
- ],
- },
- };
|