@gitlab/eslint-plugin 21.2.0 → 21.2.1

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,186 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // Enforce “for” loop update clause moving the counter in the right direction
4
- // https://eslint.org/docs/rules/for-direction
5
- 'for-direction': 'error',
6
-
7
- // Enforces that a return statement is present in property getters
8
- // https://eslint.org/docs/rules/getter-return
9
- 'getter-return': ['error', { allowImplicit: true }],
10
-
11
- // disallow using an async function as a Promise executor
12
- // https://eslint.org/docs/rules/no-async-promise-executor
13
- 'no-async-promise-executor': 'error',
14
-
15
- // Disallow await inside of loops
16
- // https://eslint.org/docs/rules/no-await-in-loop
17
- 'no-await-in-loop': 'error',
18
-
19
- // Disallow comparisons to negative zero
20
- // https://eslint.org/docs/rules/no-compare-neg-zero
21
- 'no-compare-neg-zero': 'error',
22
-
23
- // disallow assignment in conditional expressions
24
- 'no-cond-assign': ['error', 'always'],
25
-
26
- // disallow use of console
27
- 'no-console': 'warn',
28
-
29
- // disallow use of constant expressions in conditions
30
- 'no-constant-condition': 'warn',
31
-
32
- // disallow control characters in regular expressions
33
- 'no-control-regex': 'error',
34
-
35
- // disallow use of debugger
36
- 'no-debugger': 'error',
37
-
38
- // disallow duplicate arguments in functions
39
- 'no-dupe-args': 'error',
40
-
41
- // Disallow duplicate conditions in if-else-if chains
42
- // https://eslint.org/docs/rules/no-dupe-else-if
43
- 'no-dupe-else-if': 'error',
44
-
45
- // disallow duplicate keys when creating object literals
46
- 'no-dupe-keys': 'error',
47
-
48
- // disallow a duplicate case label.
49
- 'no-duplicate-case': 'error',
50
-
51
- // disallow empty statements
52
- 'no-empty': 'error',
53
-
54
- // disallow the use of empty character classes in regular expressions
55
- 'no-empty-character-class': 'error',
56
-
57
- // disallow assigning to the exception in a catch block
58
- 'no-ex-assign': 'error',
59
-
60
- // disallow double-negation boolean casts in a boolean context
61
- // https://eslint.org/docs/rules/no-extra-boolean-cast
62
- 'no-extra-boolean-cast': 'error',
63
-
64
- // disallow unnecessary parentheses
65
- // https://eslint.org/docs/rules/no-extra-parens
66
- 'no-extra-parens': [
67
- 'off',
68
- 'all',
69
- {
70
- conditionalAssign: true,
71
- nestedBinaryExpressions: false,
72
- returnAssign: false,
73
- ignoreJSX: 'all', // delegate to eslint-plugin-react
74
- enforceForArrowConditionals: false,
75
- },
76
- ],
77
-
78
- // disallow unnecessary semicolons
79
- 'no-extra-semi': 'error',
80
-
81
- // disallow overwriting functions written as function declarations
82
- 'no-func-assign': 'error',
83
-
84
- // https://eslint.org/docs/rules/no-import-assign
85
- 'no-import-assign': 'error',
86
-
87
- // disallow function or variable declarations in nested blocks
88
- 'no-inner-declarations': 'error',
89
-
90
- // disallow invalid regular expression strings in the RegExp constructor
91
- 'no-invalid-regexp': 'error',
92
-
93
- // disallow irregular whitespace outside of strings and comments
94
- 'no-irregular-whitespace': 'error',
95
-
96
- // Disallow Number Literals That Lose Precision
97
- // https://eslint.org/docs/rules/no-loss-of-precision
98
- 'no-loss-of-precision': 'error',
99
-
100
- // Disallow characters which are made with multiple code points in character class syntax
101
- // https://eslint.org/docs/rules/no-misleading-character-class
102
- 'no-misleading-character-class': 'error',
103
-
104
- // disallow the use of object properties of the global object (Math and JSON) as functions
105
- 'no-obj-calls': 'error',
106
-
107
- // Disallow returning values from Promise executor functions
108
- // https://eslint.org/docs/rules/no-promise-executor-return
109
- 'no-promise-executor-return': 'error',
110
-
111
- // disallow use of Object.prototypes builtins directly
112
- // https://eslint.org/docs/rules/no-prototype-builtins
113
- 'no-prototype-builtins': 'error',
114
-
115
- // disallow multiple spaces in a regular expression literal
116
- 'no-regex-spaces': 'error',
117
-
118
- // Disallow returning values from setters
119
- // https://eslint.org/docs/rules/no-setter-return
120
- 'no-setter-return': 'error',
121
-
122
- // disallow sparse arrays
123
- 'no-sparse-arrays': 'error',
124
-
125
- // Disallow template literal placeholder syntax in regular strings
126
- // https://eslint.org/docs/rules/no-template-curly-in-string
127
- 'no-template-curly-in-string': 'error',
128
-
129
- // Avoid code that looks like two expressions but is actually one
130
- // https://eslint.org/docs/rules/no-unexpected-multiline
131
- 'no-unexpected-multiline': 'error',
132
-
133
- // disallow unreachable statements after a return, throw, continue, or break statement
134
- 'no-unreachable': 'error',
135
-
136
- // Disallow loops with a body that allows only one iteration
137
- // https://eslint.org/docs/rules/no-unreachable-loop
138
- 'no-unreachable-loop': [
139
- 'error',
140
- {
141
- ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
142
- },
143
- ],
144
-
145
- // disallow return/throw/break/continue inside finally blocks
146
- // https://eslint.org/docs/rules/no-unsafe-finally
147
- 'no-unsafe-finally': 'error',
148
-
149
- // disallow negating the left operand of relational operators
150
- // https://eslint.org/docs/rules/no-unsafe-negation
151
- 'no-unsafe-negation': 'error',
152
-
153
- // disallow use of optional chaining in contexts where the undefined value is not allowed
154
- // https://eslint.org/docs/rules/no-unsafe-optional-chaining
155
- 'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
156
-
157
- // Disallow Unused Private Class Members
158
- // https://eslint.org/docs/rules/no-unused-private-class-members
159
- // TODO: enable once eslint 7 is dropped (which is semver-major)
160
- 'no-unused-private-class-members': 'off',
161
-
162
- // Disallow useless backreferences in regular expressions
163
- // https://eslint.org/docs/rules/no-useless-backreference
164
- 'no-useless-backreference': 'error',
165
-
166
- // disallow negation of the left operand of an in expression
167
- // deprecated in favor of no-unsafe-negation
168
- 'no-negated-in-lhs': 'off',
169
-
170
- // Disallow assignments that can lead to race conditions due to usage of await or yield
171
- // https://eslint.org/docs/rules/require-atomic-updates
172
- // note: not enabled because it is very buggy
173
- 'require-atomic-updates': 'off',
174
-
175
- // disallow comparisons with the value NaN
176
- 'use-isnan': 'error',
177
-
178
- // ensure JSDoc comments are valid
179
- // https://eslint.org/docs/rules/valid-jsdoc
180
- 'valid-jsdoc': 'off',
181
-
182
- // ensure that the results of typeof are compared against a valid string
183
- // https://eslint.org/docs/rules/valid-typeof
184
- 'valid-typeof': ['error', { requireStringLiterals: true }],
185
- },
186
- };
@@ -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
- };