UNPKG

11.6 kBJavaScriptView Raw
1const path = require('path')
2const parser = require.resolve('babel-eslint', {paths: [__dirname]})
3
4module.exports = {
5 parser,
6 parserOptions: {
7 ecmaVersion: 2019,
8 sourceType: 'module'
9 },
10 rulePaths: [path.join(__dirname, 'lib', 'rules')],
11 plugins: ['html'],
12 resolvePluginsRelativeTo: __dirname,
13 rules: {
14 'no-func-keyword': 'error',
15 // possible errors
16 // https://eslint.org/docs/rules/no-console
17 // https://eslint.org/docs/rules/no-extra-boolean-cast
18 // https://eslint.org/docs/rules/no-func-assign
19 // https://eslint.org/docs/rules/no-inner-declarations
20 // https://eslint.org/docs/rules/no-obj-calls
21 // https://eslint.org/docs/rules/no-prototype-builtins
22 'for-direction': 'error',
23 'getter-return': 'error',
24 'no-async-promise-executor': 'error',
25 'no-await-in-loop': 'error',
26 'no-compare-neg-zero': 'error',
27 'no-cond-assign': 'error',
28 'no-constant-condition': 'error',
29 'no-control-regex': 'error',
30 'no-debugger': 'error',
31 'no-dupe-args': 'error',
32 'no-dupe-keys': 'error',
33 'no-duplicate-case': 'error',
34 'no-empty-character-class': 'error',
35 'no-empty': 'error',
36 'no-ex-assign': 'error',
37 'no-extra-parens': ['error', 'all', {
38 enforceForArrowConditionals: false,
39 nestedBinaryExpressions: false
40 }],
41 'no-extra-semi': 'error',
42 'no-invalid-regexp': 'error',
43 'no-irregular-whitespace': 'error',
44 'no-misleading-character-class': 'error',
45 'no-regex-spaces': 'error',
46 'no-sparse-arrays': 'error',
47 'no-template-curly-in-string': 'error',
48 'no-unexpected-multiline': 'error',
49 'no-unreachable': 'error',
50 'no-unsafe-finally': 'error',
51 'no-unsafe-negation': 'error',
52 'require-atomic-updates': 'error',
53 'use-isnan': 'error',
54 'valid-typeof': 'error',
55 // best practices
56 // https://eslint.org/docs/rules/block-scoped-var
57 // https://eslint.org/docs/rules/class-methods-use-this
58 // https://eslint.org/docs/rules/complexity
59 // https://eslint.org/docs/rules/consistent-return
60 // https://eslint.org/docs/rules/default-case
61 // https://eslint.org/docs/rules/max-classes-per-file
62 // https://eslint.org/docs/rules/no-empty-function
63 // https://eslint.org/docs/rules/no-empty-pattern
64 // https://eslint.org/docs/rules/no-eq-null
65 // https://eslint.org/docs/rules/no-extra-bind
66 // https://eslint.org/docs/rules/no-extra-label
67 // https://eslint.org/docs/rules/no-iterator
68 // https://eslint.org/docs/rules/no-magic-numbers
69 // https://eslint.org/docs/rules/no-param-reassign
70 // https://eslint.org/docs/rules/no-restricted-properties
71 // https://eslint.org/docs/rules/no-script-url
72 // https://eslint.org/docs/rules/no-unused-labels
73 // https://eslint.org/docs/rules/no-useless-call
74 // https://eslint.org/docs/rules/no-warning-comments
75 // https://eslint.org/docs/rules/require-await
76 // https://eslint.org/docs/rules/require-unicode-regexp
77 // https://eslint.org/docs/rules/vars-on-top
78 // https://eslint.org/docs/rules/wrap-iife
79 'accessor-pairs': 'error',
80 'array-callback-return': 'error',
81 curly: ['error', 'multi-line'],
82 'dot-location': ['error', 'property'],
83 'dot-notation': 'error',
84 eqeqeq: ['error', 'always', {null: 'never'}],
85 'guard-for-in': 'error',
86 'no-alert': 'error',
87 'no-caller': 'error',
88 'no-case-declarations': 'error',
89 'no-div-regex': 'error',
90 'no-else-return': 'error',
91 'no-eval': 'error',
92 'no-extend-native': 'error',
93 'no-fallthrough': 'error',
94 'no-floating-decimal': 'error',
95 'no-global-assign': 'error',
96 'no-implicit-coercion': 'error',
97 'no-implicit-globals': 'error',
98 'no-implied-eval': 'error',
99 'no-invalid-this': 'error',
100 'no-labels': 'error',
101 'no-lone-blocks': 'error',
102 'no-loop-func': 'error',
103 'no-multi-spaces': 'error',
104 'no-multi-str': 'error',
105 'no-new': 'error',
106 'no-new-func': 'error',
107 'no-new-wrappers': 'error',
108 'no-octal': 'error',
109 'no-octal-escape': 'error',
110 'no-proto': 'error',
111 'no-redeclare': 'error',
112 'no-return-assign': 'error',
113 'no-return-await': 'error',
114 'no-self-assign': 'error',
115 'no-self-compare': 'error',
116 'no-sequences': 'error',
117 'no-throw-literal': 'error',
118 'no-unmodified-loop-condition': 'error',
119 'no-unused-expressions': 'error',
120 'no-useless-concat': 'error',
121 'no-useless-escape': 'error',
122 'no-useless-return': 'error',
123 'no-void': 'error',
124 'no-with': 'error',
125 'prefer-promise-reject-errors': 'error',
126 radix: 'error',
127 yoda: 'error',
128 // variables
129 // https://eslint.org/docs/rules/init-declarations
130 // https://eslint.org/docs/rules/no-label-var
131 // https://eslint.org/docs/rules/no-restricted-globals
132 // https://eslint.org/docs/rules/no-shadow
133 // https://eslint.org/docs/rules/no-undefined
134 // https://eslint.org/docs/rules/no-use-before-define
135 'no-delete-var': 'error',
136 'no-shadow-restricted-names': 'error',
137 'no-undef': 'error',
138 'no-undef-init': 'error',
139 'no-unused-vars': ['error', {vars: 'all', args: 'none'}],
140 // node.js
141 // https://eslint.org/docs/rules/callback-return
142 // https://eslint.org/docs/rules/global-require
143 // https://eslint.org/docs/rules/no-mixed-requires
144 // https://eslint.org/docs/rules/no-process-env
145 // https://eslint.org/docs/rules/no-process-exit
146 // https://eslint.org/docs/rules/no-restricted-modules
147 // https://eslint.org/docs/rules/no-sync
148 'handle-callback-err': 'error',
149 'no-buffer-constructor': 'error',
150 'no-new-require': 'error',
151 'no-path-concat': 'error',
152 // stylistic
153 // https://eslint.org/docs/rules/capitalized-comments
154 // https://eslint.org/docs/rules/consistent-this
155 // https://eslint.org/docs/rules/func-name-matching
156 // https://eslint.org/docs/rules/func-names
157 // https://eslint.org/docs/rules/func-style
158 // https://eslint.org/docs/rules/id-blacklist
159 // https://eslint.org/docs/rules/id-length
160 // https://eslint.org/docs/rules/id-match
161 // https://eslint.org/docs/rules/jsx-quotes
162 // https://eslint.org/docs/rules/line-comment-position
163 // https://eslint.org/docs/rules/lines-around-comment
164 // https://eslint.org/docs/rules/max-depth
165 // https://eslint.org/docs/rules/max-len
166 // https://eslint.org/docs/rules/max-lines
167 // https://eslint.org/docs/rules/max-lines-per-function
168 // https://eslint.org/docs/rules/max-nested-callbacks
169 // https://eslint.org/docs/rules/max-params
170 // https://eslint.org/docs/rules/max-statements
171 // https://eslint.org/docs/rules/max-statements-per-line
172 // https://eslint.org/docs/rules/multiline-comment-style
173 // https://eslint.org/docs/rules/new-cap
174 // https://eslint.org/docs/rules/new-parens
175 // https://eslint.org/docs/rules/newline-per-chained-call
176 // https://eslint.org/docs/rules/no-bitwise
177 // https://eslint.org/docs/rules/no-continue
178 // https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
179 // https://eslint.org/docs/rules/no-negated-condition
180 // https://eslint.org/docs/rules/no-plusplus
181 // https://eslint.org/docs/rules/no-restricted-syntax
182 // https://eslint.org/docs/rules/no-tabs
183 // https://eslint.org/docs/rules/no-ternary
184 // https://eslint.org/docs/rules/no-underscore-dangle
185 // https://eslint.org/docs/rules/one-var-declaration-per-line
186 // https://eslint.org/docs/rules/operator-assignment
187 // https://eslint.org/docs/rules/padding-line-between-statements
188 // https://eslint.org/docs/rules/sort-keys
189 // https://eslint.org/docs/rules/sort-vars
190 // https://eslint.org/docs/rules/wrap-regex
191 'array-bracket-newline': ['error', 'consistent'],
192 'array-bracket-spacing': ['error', 'never'],
193 'array-element-newline': ['error', 'consistent'],
194 'block-spacing': ['error', 'always'],
195 'brace-style': ['error', '1tbs', {allowSingleLine: true}],
196 camelcase: ['error', {properties: 'never'}],
197 'comma-dangle': ['error', 'never'],
198 'comma-spacing': ['error', {before: false, after: true}],
199 'comma-style': ['error', 'last'],
200 'computed-property-spacing': ['error', 'never'],
201 'eol-last': ['error', 'always'],
202 'func-call-spacing': ['error', 'never'],
203 'function-paren-newline': ['error', 'multiline'],
204 'implicit-arrow-linebreak': ['error', 'beside'],
205 indent: ['error', 2, {
206 SwitchCase: 1,
207 ignoredNodes: ['TemplateLiteral[expressions] *']
208 }],
209 'key-spacing': ['error', {mode: 'minimum'}],
210 'keyword-spacing': ['error', {before: true, after: true}],
211 'linebreak-style': ['error', 'unix'],
212 'lines-between-class-members': ['error', 'always'],
213 'multiline-ternary': ['error', 'always-multiline'],
214 'no-array-constructor': 'error',
215 'no-inline-comments': 'error',
216 'no-lonely-if': 'error',
217 'no-mixed-operators': 'error',
218 'no-multi-assign': 'error',
219 'no-multiple-empty-lines': ['error', {max: 1, maxEOF: 0}],
220 'no-nested-ternary': 'error',
221 'no-new-object': 'error',
222 'no-trailing-spaces': 'error',
223 'no-unneeded-ternary': 'error',
224 'no-whitespace-before-property': 'error',
225 'nonblock-statement-body-position': ['error', 'beside'],
226 'object-curly-newline': ['error', {consistent: true}],
227 'object-curly-spacing': ['error', 'never'],
228 'object-property-newline': ['error', {allowAllPropertiesOnSameLine: true}],
229 'one-var': ['error', 'never'],
230 'operator-linebreak': ['error', 'none', {overrides: {'?': 'before', ':': 'before'}}],
231 'padded-blocks': ['error', 'never'],
232 // 'prefer-object-spread': 'error',
233 'quote-props': ['error', 'as-needed'],
234 quotes: ['error', 'single'],
235 semi: ['error', 'never'],
236 'semi-spacing': ['error', {before: false, after: true}],
237 'semi-style': ['error', 'first'],
238 'space-before-blocks': 'error',
239 'space-before-function-paren': ['error', {anonymous: 'always', named: 'never', asyncArrow: 'always'}],
240 'space-in-parens': ['error', 'never'],
241 'space-infix-ops': 'error',
242 'space-unary-ops': 'error',
243 'spaced-comment': ['error', 'always'],
244 'switch-colon-spacing': 'error',
245 'template-tag-spacing': ['error', 'never'],
246 'unicode-bom': 'error',
247 // es6
248 // https://eslint.org/docs/rules/constructor-super
249 // https://eslint.org/docs/rules/no-class-assign
250 // https://eslint.org/docs/rules/no-restricted-imports
251 // https://eslint.org/docs/rules/prefer-destructuring
252 // https://eslint.org/docs/rules/prefer-numeric-literals
253 // https://eslint.org/docs/rules/require-yield
254 // https://eslint.org/docs/rules/sort-imports
255 'arrow-body-style': ['error', 'as-needed', {requireReturnForObjectLiteral: true}],
256 'arrow-parens': ['error', 'always'],
257 'arrow-spacing': 'error',
258 'generator-star-spacing': ['error', {before: true, after: true}],
259 'no-confusing-arrow': ['error', {allowParens: true}],
260 'no-const-assign': 'error',
261 'no-dupe-class-members': 'error',
262 'no-duplicate-imports': 'error',
263 'no-new-symbol': 'error',
264 'no-this-before-super': 'error',
265 'no-useless-computed-key': 'error',
266 'no-useless-constructor': 'error',
267 'no-useless-rename': 'error',
268 'no-var': 'error',
269 'object-shorthand': 'error',
270 'prefer-arrow-callback': 'error',
271 'prefer-const': 'error',
272 'prefer-rest-params': 'error',
273 'prefer-spread': 'error',
274 'prefer-template': 'error',
275 'rest-spread-spacing': ['error', 'never'],
276 'symbol-description': 'error',
277 'template-curly-spacing': ['error', 'never'],
278 'yield-star-spacing': ['error', 'both']
279 }
280}