@gitlab/eslint-plugin 21.2.0 → 21.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,218 +0,0 @@
1
- module.exports = {
2
- env: {
3
- es6: true,
4
- },
5
- parserOptions: {
6
- ecmaVersion: 6,
7
- sourceType: 'module',
8
- ecmaFeatures: {
9
- generators: false,
10
- objectLiteralDuplicateProperties: false,
11
- },
12
- },
13
-
14
- rules: {
15
- // enforces no braces where they can be omitted
16
- // https://eslint.org/docs/rules/arrow-body-style
17
- // TODO: enable requireReturnForObjectLiteral?
18
- 'arrow-body-style': [
19
- 'error',
20
- 'as-needed',
21
- {
22
- requireReturnForObjectLiteral: false,
23
- },
24
- ],
25
-
26
- // require parens in arrow function arguments
27
- // https://eslint.org/docs/rules/arrow-parens
28
- 'arrow-parens': ['error', 'always'],
29
-
30
- // require space before/after arrow function's arrow
31
- // https://eslint.org/docs/rules/arrow-spacing
32
- 'arrow-spacing': ['error', { before: true, after: true }],
33
-
34
- // verify super() callings in constructors
35
- 'constructor-super': 'error',
36
-
37
- // enforce the spacing around the * in generator functions
38
- // https://eslint.org/docs/rules/generator-star-spacing
39
- 'generator-star-spacing': ['error', { before: false, after: true }],
40
-
41
- // disallow modifying variables of class declarations
42
- // https://eslint.org/docs/rules/no-class-assign
43
- 'no-class-assign': 'error',
44
-
45
- // disallow arrow functions where they could be confused with comparisons
46
- // https://eslint.org/docs/rules/no-confusing-arrow
47
- 'no-confusing-arrow': [
48
- 'error',
49
- {
50
- allowParens: true,
51
- },
52
- ],
53
-
54
- // disallow modifying variables that are declared using const
55
- 'no-const-assign': 'error',
56
-
57
- // disallow duplicate class members
58
- // https://eslint.org/docs/rules/no-dupe-class-members
59
- 'no-dupe-class-members': 'error',
60
-
61
- // disallow importing from the same path more than once
62
- // https://eslint.org/docs/rules/no-duplicate-imports
63
- // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
64
- 'no-duplicate-imports': 'off',
65
-
66
- // disallow symbol constructor
67
- // https://eslint.org/docs/rules/no-new-symbol
68
- 'no-new-symbol': 'error',
69
-
70
- // Disallow specified names in exports
71
- // https://eslint.org/docs/rules/no-restricted-exports
72
- 'no-restricted-exports': [
73
- 'error',
74
- {
75
- restrictedNamedExports: [
76
- 'default', // use `export default` to provide a default export
77
- 'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
78
- ],
79
- },
80
- ],
81
-
82
- // disallow specific imports
83
- // https://eslint.org/docs/rules/no-restricted-imports
84
- 'no-restricted-imports': [
85
- 'off',
86
- {
87
- paths: [],
88
- patterns: [],
89
- },
90
- ],
91
-
92
- // disallow to use this/super before super() calling in constructors.
93
- // https://eslint.org/docs/rules/no-this-before-super
94
- 'no-this-before-super': 'error',
95
-
96
- // disallow useless computed property keys
97
- // https://eslint.org/docs/rules/no-useless-computed-key
98
- 'no-useless-computed-key': 'error',
99
-
100
- // disallow unnecessary constructor
101
- // https://eslint.org/docs/rules/no-useless-constructor
102
- 'no-useless-constructor': 'error',
103
-
104
- // disallow renaming import, export, and destructured assignments to the same name
105
- // https://eslint.org/docs/rules/no-useless-rename
106
- 'no-useless-rename': [
107
- 'error',
108
- {
109
- ignoreDestructuring: false,
110
- ignoreImport: false,
111
- ignoreExport: false,
112
- },
113
- ],
114
-
115
- // require let or const instead of var
116
- 'no-var': 'error',
117
-
118
- // require method and property shorthand syntax for object literals
119
- // https://eslint.org/docs/rules/object-shorthand
120
- 'object-shorthand': [
121
- 'error',
122
- 'always',
123
- {
124
- ignoreConstructors: false,
125
- avoidQuotes: true,
126
- },
127
- ],
128
-
129
- // suggest using arrow functions as callbacks
130
- 'prefer-arrow-callback': [
131
- 'error',
132
- {
133
- allowNamedFunctions: false,
134
- allowUnboundThis: true,
135
- },
136
- ],
137
-
138
- // suggest using of const declaration for variables that are never modified after declared
139
- 'prefer-const': [
140
- 'error',
141
- {
142
- destructuring: 'any',
143
- ignoreReadBeforeAssign: true,
144
- },
145
- ],
146
-
147
- // Prefer destructuring from arrays and objects
148
- // https://eslint.org/docs/rules/prefer-destructuring
149
- 'prefer-destructuring': [
150
- 'error',
151
- {
152
- VariableDeclarator: {
153
- array: false,
154
- object: true,
155
- },
156
- AssignmentExpression: {
157
- array: true,
158
- object: false,
159
- },
160
- },
161
- {
162
- enforceForRenamedProperties: false,
163
- },
164
- ],
165
-
166
- // disallow parseInt() in favor of binary, octal, and hexadecimal literals
167
- // https://eslint.org/docs/rules/prefer-numeric-literals
168
- 'prefer-numeric-literals': 'error',
169
-
170
- // suggest using Reflect methods where applicable
171
- // https://eslint.org/docs/rules/prefer-reflect
172
- 'prefer-reflect': 'off',
173
-
174
- // use rest parameters instead of arguments
175
- // https://eslint.org/docs/rules/prefer-rest-params
176
- 'prefer-rest-params': 'error',
177
-
178
- // suggest using the spread syntax instead of .apply()
179
- // https://eslint.org/docs/rules/prefer-spread
180
- 'prefer-spread': 'error',
181
-
182
- // suggest using template literals instead of string concatenation
183
- // https://eslint.org/docs/rules/prefer-template
184
- 'prefer-template': 'error',
185
-
186
- // disallow generator functions that do not have yield
187
- // https://eslint.org/docs/rules/require-yield
188
- 'require-yield': 'error',
189
-
190
- // enforce spacing between object rest-spread
191
- // https://eslint.org/docs/rules/rest-spread-spacing
192
- 'rest-spread-spacing': ['error', 'never'],
193
-
194
- // import sorting
195
- // https://eslint.org/docs/rules/sort-imports
196
- 'sort-imports': [
197
- 'off',
198
- {
199
- ignoreCase: false,
200
- ignoreDeclarationSort: false,
201
- ignoreMemberSort: false,
202
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
203
- },
204
- ],
205
-
206
- // require a Symbol description
207
- // https://eslint.org/docs/rules/symbol-description
208
- 'symbol-description': 'error',
209
-
210
- // enforce usage of spacing in template strings
211
- // https://eslint.org/docs/rules/template-curly-spacing
212
- 'template-curly-spacing': 'error',
213
-
214
- // enforce spacing around the * in yield* expressions
215
- // https://eslint.org/docs/rules/yield-star-spacing
216
- 'yield-star-spacing': ['error', 'after'],
217
- },
218
- };
@@ -1,285 +0,0 @@
1
- module.exports = {
2
- env: {
3
- es6: true,
4
- },
5
- parserOptions: {
6
- ecmaVersion: 6,
7
- sourceType: 'module',
8
- },
9
- plugins: ['import'],
10
-
11
- settings: {
12
- 'import/resolver': {
13
- node: {
14
- extensions: ['.mjs', '.js', '.json'],
15
- },
16
- },
17
- 'import/extensions': ['.js', '.mjs', '.jsx'],
18
- 'import/core-modules': [],
19
- 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
20
- },
21
-
22
- rules: {
23
- // Static analysis:
24
-
25
- // ensure imports point to files/modules that can be resolved
26
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
27
- 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
28
-
29
- // ensure named imports coupled with named exports
30
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
31
- 'import/named': 'error',
32
-
33
- // ensure default import coupled with default export
34
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
35
- 'import/default': 'off',
36
-
37
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
38
- 'import/namespace': 'off',
39
-
40
- // Helpful warnings:
41
-
42
- // disallow invalid exports, e.g. multiple defaults
43
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
44
- 'import/export': 'error',
45
-
46
- // do not allow a default import name to match a named export
47
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
48
- 'import/no-named-as-default': 'error',
49
-
50
- // warn on accessing default export property names that are also named exports
51
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
52
- 'import/no-named-as-default-member': 'error',
53
-
54
- // disallow use of jsdoc-marked-deprecated imports
55
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
56
- 'import/no-deprecated': 'off',
57
-
58
- // Forbid the use of extraneous packages
59
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
60
- // paths are treated both as absolute paths, and relative to process.cwd()
61
- 'import/no-extraneous-dependencies': [
62
- 'error',
63
- {
64
- devDependencies: [
65
- 'test/**', // tape, common npm pattern
66
- 'tests/**', // also common npm pattern
67
- 'spec/**', // mocha, rspec-like pattern
68
- '**/__tests__/**', // jest pattern
69
- '**/__mocks__/**', // jest pattern
70
- 'test.{js,jsx}', // repos with a single test file
71
- 'test-*.{js,jsx}', // repos with multiple top-level test files
72
- '**/*{.,_}{test,spec}.{js,jsx}', // tests where the extension or filename suffix denotes that it is a test
73
- '**/jest.config.js', // jest config
74
- '**/jest.setup.js', // jest setup
75
- '**/vue.config.js', // vue-cli config
76
- '**/webpack.config.js', // webpack config
77
- '**/webpack.config.*.js', // webpack config
78
- '**/rollup.config.js', // rollup config
79
- '**/rollup.config.*.js', // rollup config
80
- '**/gulpfile.js', // gulp config
81
- '**/gulpfile.*.js', // gulp config
82
- '**/Gruntfile{,.js}', // grunt config
83
- '**/protractor.conf.js', // protractor config
84
- '**/protractor.conf.*.js', // protractor config
85
- '**/karma.conf.js', // karma config
86
- '**/.eslintrc.js', // eslint config
87
- ],
88
- optionalDependencies: false,
89
- },
90
- ],
91
-
92
- // Forbid mutable exports
93
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
94
- 'import/no-mutable-exports': 'error',
95
-
96
- // Module systems:
97
-
98
- // disallow require()
99
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
100
- 'import/no-commonjs': 'off',
101
-
102
- // disallow AMD require/define
103
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
104
- 'import/no-amd': 'error',
105
-
106
- // No Node.js builtin modules
107
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
108
- // TODO: enable?
109
- 'import/no-nodejs-modules': 'off',
110
-
111
- // Style guide:
112
-
113
- // disallow non-import statements appearing before import statements
114
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
115
- 'import/first': 'error',
116
-
117
- // disallow non-import statements appearing before import statements
118
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
119
- // deprecated: use `import/first`
120
- 'import/imports-first': 'off',
121
-
122
- // disallow duplicate imports
123
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
124
- 'import/no-duplicates': 'error',
125
-
126
- // disallow namespace imports
127
- // TODO: enable?
128
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
129
- 'import/no-namespace': 'off',
130
-
131
- // Ensure consistent use of file extension within the import path
132
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
133
- 'import/extensions': [
134
- 'error',
135
- 'ignorePackages',
136
- {
137
- js: 'never',
138
- mjs: 'never',
139
- jsx: 'never',
140
- },
141
- ],
142
-
143
- // ensure absolute imports are above relative imports and that unassigned imports are ignored
144
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
145
- // TODO: enforce a stricter convention in module import order?
146
- 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
147
-
148
- // Require a newline after the last import/require in a group
149
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
150
- 'import/newline-after-import': 'error',
151
-
152
- // Require modules with a single export to use a default export
153
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
154
- 'import/prefer-default-export': 'error',
155
-
156
- // Restrict which files can be imported in a given folder
157
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
158
- 'import/no-restricted-paths': 'off',
159
-
160
- // Forbid modules to have too many dependencies
161
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
162
- 'import/max-dependencies': ['off', { max: 10 }],
163
-
164
- // Forbid import of modules using absolute paths
165
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
166
- 'import/no-absolute-path': 'error',
167
-
168
- // Forbid require() calls with expressions
169
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
170
- 'import/no-dynamic-require': 'error',
171
-
172
- // prevent importing the submodules of other modules
173
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
174
- 'import/no-internal-modules': [
175
- 'off',
176
- {
177
- allow: [],
178
- },
179
- ],
180
-
181
- // Warn if a module could be mistakenly parsed as a script by a consumer
182
- // leveraging Unambiguous JavaScript Grammar
183
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
184
- // this should not be enabled until this proposal has at least been *presented* to TC39.
185
- // At the moment, it's not a thing.
186
- 'import/unambiguous': 'off',
187
-
188
- // Forbid Webpack loader syntax in imports
189
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
190
- 'import/no-webpack-loader-syntax': 'error',
191
-
192
- // Prevent unassigned imports
193
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
194
- // importing for side effects is perfectly acceptable, if you need side effects.
195
- 'import/no-unassigned-import': 'off',
196
-
197
- // Prevent importing the default as if it were named
198
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
199
- 'import/no-named-default': 'error',
200
-
201
- // Reports if a module's default export is unnamed
202
- // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
203
- 'import/no-anonymous-default-export': [
204
- 'off',
205
- {
206
- allowArray: false,
207
- allowArrowFunction: false,
208
- allowAnonymousClass: false,
209
- allowAnonymousFunction: false,
210
- allowLiteral: false,
211
- allowObject: false,
212
- },
213
- ],
214
-
215
- // This rule enforces that all exports are declared at the bottom of the file.
216
- // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
217
- // TODO: enable?
218
- 'import/exports-last': 'off',
219
-
220
- // Reports when named exports are not grouped together in a single export declaration
221
- // or when multiple assignments to CommonJS module.exports or exports object are present
222
- // in a single file.
223
- // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
224
- 'import/group-exports': 'off',
225
-
226
- // forbid default exports. this is a terrible rule, do not use it.
227
- // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
228
- 'import/no-default-export': 'off',
229
-
230
- // Prohibit named exports. this is a terrible rule, do not use it.
231
- // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
232
- 'import/no-named-export': 'off',
233
-
234
- // Forbid a module from importing itself
235
- // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
236
- 'import/no-self-import': 'error',
237
-
238
- // Forbid cyclical dependencies between modules
239
- // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
240
- 'import/no-cycle': ['error', { maxDepth: '∞' }],
241
-
242
- // Ensures that there are no useless path segments
243
- // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
244
- 'import/no-useless-path-segments': ['error', { commonjs: true }],
245
-
246
- // dynamic imports require a leading comment with a webpackChunkName
247
- // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
248
- 'import/dynamic-import-chunkname': [
249
- 'off',
250
- {
251
- importFunctions: [],
252
- webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
253
- },
254
- ],
255
-
256
- // Use this rule to prevent imports to folders in relative parent paths.
257
- // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
258
- 'import/no-relative-parent-imports': 'off',
259
-
260
- // Reports modules without any exports, or with unused exports
261
- // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
262
- // TODO: enable once it supports CJS
263
- 'import/no-unused-modules': [
264
- 'off',
265
- {
266
- ignoreExports: [],
267
- missingExports: true,
268
- unusedExports: true,
269
- },
270
- ],
271
-
272
- // Reports the use of import declarations with CommonJS exports in any module except for the main module.
273
- // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
274
- 'import/no-import-module-exports': [
275
- 'error',
276
- {
277
- exceptions: [],
278
- },
279
- ],
280
-
281
- // Use this rule to prevent importing packages through relative paths.
282
- // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md
283
- 'import/no-relative-packages': 'error',
284
- },
285
- };
@@ -1,43 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- },
5
-
6
- rules: {
7
- // enforce return after a callback
8
- 'callback-return': 'off',
9
-
10
- // require all requires be top-level
11
- // https://eslint.org/docs/rules/global-require
12
- 'global-require': 'error',
13
-
14
- // enforces error handling in callbacks (node environment)
15
- 'handle-callback-err': 'off',
16
-
17
- // disallow use of the Buffer() constructor
18
- // https://eslint.org/docs/rules/no-buffer-constructor
19
- 'no-buffer-constructor': 'error',
20
-
21
- // disallow mixing regular variable and require declarations
22
- 'no-mixed-requires': ['off', false],
23
-
24
- // disallow use of new operator with the require function
25
- 'no-new-require': 'error',
26
-
27
- // disallow string concatenation with __dirname and __filename
28
- // https://eslint.org/docs/rules/no-path-concat
29
- 'no-path-concat': 'error',
30
-
31
- // disallow use of process.env
32
- 'no-process-env': 'off',
33
-
34
- // disallow process.exit()
35
- 'no-process-exit': 'off',
36
-
37
- // restrict usage of specified node modules
38
- 'no-restricted-modules': 'off',
39
-
40
- // disallow use of synchronous methods (off by default)
41
- 'no-sync': 'off',
42
- },
43
- };
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // babel inserts `'use strict';` for us
4
- strict: ['error', 'never'],
5
- },
6
- };