|
| 1 | +module.exports = { |
| 2 | + extends: [ |
| 3 | + 'eslint:recommended', |
| 4 | + 'plugin:react/recommended' |
| 5 | + ], |
| 6 | + parser: 'babel-eslint', |
| 7 | + parserOptions: { |
| 8 | + parser: 'babel-eslint', |
| 9 | + ecmaVersion: 2017, |
| 10 | + sourceType: 'module', |
| 11 | + allowImportExportEverywhere: true |
| 12 | + }, |
| 13 | + settings: { |
| 14 | + "react": { |
| 15 | + pragma: 'React', |
| 16 | + version: "detect", |
| 17 | + } |
| 18 | + }, |
| 19 | + env: { |
| 20 | + amd: true, |
| 21 | + browser: true, |
| 22 | + node: true, |
| 23 | + }, |
| 24 | + rules: { |
| 25 | + 'indent': ['error', 4, { 'SwitchCase': 1, 'MemberExpression': 1 }], |
| 26 | + 'no-trailing-spaces': 'error', |
| 27 | + 'no-console': process.env.NODE_ENV === 'production' ? [ |
| 28 | + 'error', |
| 29 | + { 'allow': ['warn', 'error'] }, |
| 30 | + ] : 'off', |
| 31 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', |
| 32 | + 'no-fallthrough': 'off', |
| 33 | + 'no-case-declarations': 'off', |
| 34 | + 'space-before-function-paren': 'error', |
| 35 | + 'spaced-comment': 'error', |
| 36 | + 'arrow-spacing': 'error', |
| 37 | + 'keyword-spacing': 'error', |
| 38 | + 'semi': ['error', 'always'], |
| 39 | + 'dot-location': ['error', 'property'], |
| 40 | + 'dot-notation': 'error', |
| 41 | + 'no-alert': 'off', |
| 42 | + 'eqeqeq': ['error', 'always'], |
| 43 | + 'no-floating-decimal': 'error', |
| 44 | + 'no-global-assign': 'error', |
| 45 | + 'no-multi-spaces': 'error', |
| 46 | + 'no-useless-return': 'error', |
| 47 | + 'no-undef-init': 'warn', |
| 48 | + 'no-use-before-define': ['error', { 'functions': false }], |
| 49 | + 'array-bracket-newline': ['error', 'consistent'], |
| 50 | + 'brace-style': ['error', '1tbs'], |
| 51 | + 'comma-dangle': ['error', 'always-multiline'], |
| 52 | + 'comma-spacing': 'error', |
| 53 | + 'comma-style': 'error', |
| 54 | + 'eol-last': 'error', |
| 55 | + 'func-call-spacing': 'error', |
| 56 | + 'jsx-quotes': ['error', 'prefer-single'], |
| 57 | + 'quotes': ['error', 'single', { 'allowTemplateLiterals': true }], |
| 58 | + 'quote-props': ['error', 'as-needed'], |
| 59 | + 'linebreak-style': 'warn', |
| 60 | + 'lines-around-comment': 'warn', |
| 61 | + 'max-depth': ['error', 3], |
| 62 | + 'max-statements-per-line': 'error', |
| 63 | + 'newline-per-chained-call': 'error', |
| 64 | + 'no-lonely-if': 'error', |
| 65 | + 'no-mixed-operators': 'warn', |
| 66 | + 'no-multiple-empty-lines': ['error', { 'max': 1, 'maxEOF': 0, 'maxBOF': 0 }], |
| 67 | + 'no-tabs': 'warn', |
| 68 | + 'space-before-blocks': 'error', |
| 69 | + 'space-infix-ops': 'error', |
| 70 | + 'space-unary-ops': [2, { |
| 71 | + 'words': true, |
| 72 | + 'nonwords': true, |
| 73 | + 'overrides': { |
| 74 | + '-': false, |
| 75 | + '++': false, |
| 76 | + '--': false, |
| 77 | + }, |
| 78 | + }], |
| 79 | + 'space-in-parens': 'error', |
| 80 | + 'switch-colon-spacing': 'error', |
| 81 | + 'arrow-body-style': 'error', |
| 82 | + 'no-duplicate-imports': 'warn', |
| 83 | + 'no-useless-computed-key': 'warn', |
| 84 | + 'no-var': 'error', |
| 85 | + 'arrow-parens': ['error', 'as-needed'], |
| 86 | + 'curly': 'error', |
| 87 | + 'require-atomic-updates': 'off', |
| 88 | + 'no-prototype-builtins': 'off', |
| 89 | + 'react/prop-types': 0, |
| 90 | + 'react/jsx-max-props-per-line': ['error', {'maximum': 1, 'when': 'always' }], |
| 91 | + 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'], |
| 92 | + 'react/jsx-closing-bracket-location': ['error', 'tag-aligned'], |
| 93 | + 'react/jsx-closing-tag-location': 'error', |
| 94 | + 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }], |
| 95 | + 'react/sort-comp': ['error', { |
| 96 | + order: [ |
| 97 | + 'static-variables', |
| 98 | + 'static-methods', |
| 99 | + 'instance-variables', |
| 100 | + 'lifecycle', |
| 101 | + '/^on.+$/', |
| 102 | + 'getters', |
| 103 | + 'setters', |
| 104 | + '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', |
| 105 | + 'instance-methods', |
| 106 | + 'everything-else', |
| 107 | + 'rendering', |
| 108 | + ], |
| 109 | + groups: { |
| 110 | + lifecycle: [ |
| 111 | + 'displayName', |
| 112 | + 'propTypes', |
| 113 | + 'contextTypes', |
| 114 | + 'childContextTypes', |
| 115 | + 'mixins', |
| 116 | + 'statics', |
| 117 | + 'defaultProps', |
| 118 | + 'constructor', |
| 119 | + 'getDefaultProps', |
| 120 | + 'getInitialState', |
| 121 | + 'state', |
| 122 | + 'getChildContext', |
| 123 | + 'getDerivedStateFromProps', |
| 124 | + 'componentWillMount', |
| 125 | + 'UNSAFE_componentWillMount', |
| 126 | + 'componentDidMount', |
| 127 | + 'componentWillReceiveProps', |
| 128 | + 'UNSAFE_componentWillReceiveProps', |
| 129 | + 'shouldComponentUpdate', |
| 130 | + 'componentWillUpdate', |
| 131 | + 'UNSAFE_componentWillUpdate', |
| 132 | + 'getSnapshotBeforeUpdate', |
| 133 | + 'componentDidUpdate', |
| 134 | + 'componentDidCatch', |
| 135 | + 'componentWillUnmount' |
| 136 | + ], |
| 137 | + rendering: [ |
| 138 | + '/^render.+$/', |
| 139 | + 'render' |
| 140 | + ], |
| 141 | + }, |
| 142 | + }], |
| 143 | + 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], |
| 144 | + 'react/jsx-pascal-case': ['error', { |
| 145 | + allowAllCaps: true, |
| 146 | + ignore: [], |
| 147 | + }], |
| 148 | + 'react/no-danger': 'warn', |
| 149 | + 'react/prefer-es6-class': ['error', 'always'], |
| 150 | + 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }], |
| 151 | + 'react/react-in-jsx-scope': 'error', |
| 152 | + 'react/require-render-return': 'error', |
| 153 | + 'react/self-closing-comp': 'error', |
| 154 | + 'react/jsx-wrap-multilines': ['error', { |
| 155 | + declaration: 'parens-new-line', |
| 156 | + assignment: 'parens-new-line', |
| 157 | + return: 'parens-new-line', |
| 158 | + arrow: 'parens-new-line', |
| 159 | + condition: 'parens-new-line', |
| 160 | + logical: 'parens-new-line', |
| 161 | + prop: 'parens-new-line', |
| 162 | + }], |
| 163 | + 'react/no-danger-with-children': 'error', |
| 164 | + 'react/no-unused-prop-types': ['error', { |
| 165 | + customValidators: [ |
| 166 | + ], |
| 167 | + skipShapeProps: true, |
| 168 | + }], |
| 169 | + 'react/destructuring-assignment': ['error', 'always'], |
| 170 | + 'react/no-redundant-should-component-update': 'error', |
| 171 | + 'react/no-unused-state': 'error', |
| 172 | + 'react/no-typos': 'error', |
| 173 | + 'react/jsx-tag-spacing': ['error', { |
| 174 | + closingSlash: 'never', |
| 175 | + beforeSelfClosing: 'always', |
| 176 | + afterOpening: 'never', |
| 177 | + beforeClosing: 'never', |
| 178 | + }], |
| 179 | + 'react/boolean-prop-naming': ['off', { |
| 180 | + propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'], |
| 181 | + rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+', |
| 182 | + message: '', |
| 183 | + }], |
| 184 | + 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }], |
| 185 | + 'react/no-access-state-in-setstate': 'error', |
| 186 | + 'react/jsx-props-no-multi-spaces': 'error', |
| 187 | + 'react/jsx-curly-newline': ['error', { |
| 188 | + multiline: 'consistent', |
| 189 | + singleline: 'consistent', |
| 190 | + }], |
| 191 | + 'react/jsx-props-no-spreading': ['warn', { |
| 192 | + html: 'enforce', |
| 193 | + custom: 'enforce', |
| 194 | + exceptions: [], |
| 195 | + }], |
| 196 | + }, |
| 197 | +}; |
0 commit comments