eslint-config-airbnb-extended 0.4.0 → 0.5.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.
@@ -2,7 +2,7 @@
2
2
  * Direct export not allowed, it will increase the size of d.ts
3
3
  */
4
4
  export declare const rules: {
5
- base: Record<"imports" | "variables" | "bestPractices" | "errors" | "es6" | "node" | "strict" | "style" | "importsStrict", import("eslint").Linter.Config>;
5
+ base: Record<"imports" | "variables" | "bestPractices" | "errors" | "es6" | "node" | "strict" | "style" | "stylistic" | "importsStrict" | "reactStrict", import("eslint").Linter.Config>;
6
6
  react: Record<"react" | "reactA11y" | "reactHooks", import("eslint").Linter.Config>;
7
7
  next: import("eslint").Linter.Config;
8
8
  typescript: Record<"imports" | "base" | "typescriptEslint", import("eslint").Linter.Config>;
@@ -10,6 +10,7 @@ const imports_1 = __importDefault(require("../../rules/imports"));
10
10
  const node_1 = __importDefault(require("../../rules/node"));
11
11
  const strict_1 = __importDefault(require("../../rules/strict"));
12
12
  const style_1 = __importDefault(require("../../rules/style"));
13
+ const stylistic_1 = __importDefault(require("../../rules/stylistic"));
13
14
  const variables_1 = __importDefault(require("../../rules/variables"));
14
15
  const baseConfig = {
15
16
  bestPractices: best_practices_1.default,
@@ -19,6 +20,7 @@ const baseConfig = {
19
20
  node: node_1.default,
20
21
  strict: strict_1.default,
21
22
  style: style_1.default,
23
+ stylistic: stylistic_1.default,
22
24
  variables: variables_1.default,
23
25
  };
24
26
  exports.default = baseConfig;
@@ -14,7 +14,6 @@ const baseRecommendedConfig = [
14
14
  sourceType: 'module',
15
15
  },
16
16
  },
17
- rules: {},
18
17
  },
19
18
  ];
20
19
  exports.default = baseRecommendedConfig;
@@ -15,7 +15,7 @@ const base = {
15
15
  const react = {
16
16
  recommended: recommended_2.default,
17
17
  typescript: recommended_3.default.react,
18
- all: [...recommended_1.default, ...recommended_2.default, ...recommended_3.default.react],
18
+ all: [...recommended_2.default, ...recommended_3.default.react],
19
19
  };
20
20
  const next = {
21
21
  recommended: [...react.recommended, next_1.default],
@@ -8,11 +8,11 @@ const utils_1 = require("../../utils");
8
8
  const typescriptRecommendedConfig = {
9
9
  base: Object.values(index_1.default),
10
10
  react: [
11
- ...Object.values(index_1.default),
12
11
  {
13
12
  name: 'airbnb/config/typescript-react',
14
13
  rules: {
15
- // Append 'tsx' to Airbnb 'react/jsx-filename-extension' rule
14
+ // only .jsx and .tsx files may have JSX
15
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
16
16
  'react/jsx-filename-extension': [
17
17
  'error',
18
18
  {
@@ -40,12 +40,5 @@ const reactHooksPlugin = {
40
40
  plugins: {
41
41
  'react-hooks': EsLintPluginReactHooks,
42
42
  },
43
- languageOptions: {
44
- parserOptions: {
45
- ecmaFeatures: {
46
- jsx: true,
47
- },
48
- },
49
- },
50
43
  };
51
44
  exports.default = reactHooksPlugin;
@@ -8,9 +8,6 @@ const typescriptEslintPlugin = {
8
8
  },
9
9
  languageOptions: {
10
10
  parser: typescript_eslint_1.parser,
11
- parserOptions: {
12
- projectService: true,
13
- },
14
11
  },
15
12
  };
16
13
  exports.default = typescriptEslintPlugin;
@@ -8,13 +8,15 @@ const bestPracticesRules = {
8
8
  'accessor-pairs': 'off',
9
9
  // enforces return statements in callbacks of array's methods
10
10
  // https://eslint.org/docs/rules/array-callback-return
11
- 'array-callback-return': ['error', { allowImplicit: true }],
11
+ 'array-callback-return': [
12
+ 'error',
13
+ {
14
+ allowImplicit: true,
15
+ },
16
+ ],
12
17
  // treat var statements as if they were block scoped
13
18
  // https://eslint.org/docs/rules/block-scoped-var
14
19
  'block-scoped-var': 'error',
15
- // specify the maximum cyclomatic complexity allowed in a program
16
- // https://eslint.org/docs/rules/complexity
17
- complexity: ['off', 20],
18
20
  // enforce that class methods use "this"
19
21
  // https://eslint.org/docs/rules/class-methods-use-this
20
22
  'class-methods-use-this': [
@@ -23,15 +25,23 @@ const bestPracticesRules = {
23
25
  exceptMethods: [],
24
26
  },
25
27
  ],
28
+ // specify the maximum cyclomatic complexity allowed in a program
29
+ // https://eslint.org/docs/rules/complexity
30
+ complexity: 'off',
26
31
  // require return statements to either always or never specify values
27
32
  // https://eslint.org/docs/rules/consistent-return
28
33
  'consistent-return': 'error',
29
34
  // specify curly brace conventions for all control statements
30
35
  // https://eslint.org/docs/rules/curly
31
- curly: ['error', 'multi-line'], // multiline
36
+ curly: ['error', 'multi-line'],
32
37
  // require default case in switch statements
33
38
  // https://eslint.org/docs/rules/default-case
34
- 'default-case': ['error', { commentPattern: '^no default$' }],
39
+ 'default-case': [
40
+ 'error',
41
+ {
42
+ commentPattern: '^no default$',
43
+ },
44
+ ],
35
45
  // Enforce default clauses in switch statements to be last
36
46
  // https://eslint.org/docs/rules/default-case-last
37
47
  'default-case-last': 'error',
@@ -39,13 +49,21 @@ const bestPracticesRules = {
39
49
  'default-param-last': 'error',
40
50
  // encourages use of dot notation whenever possible
41
51
  // https://eslint.org/docs/rules/dot-notation
42
- 'dot-notation': ['error', { allowKeywords: true }],
43
- // enforces consistent newlines before or after dots
44
- // https://eslint.org/docs/rules/dot-location
45
- 'dot-location': ['error', 'property'],
52
+ 'dot-notation': [
53
+ 'error',
54
+ {
55
+ allowKeywords: true,
56
+ },
57
+ ],
46
58
  // require the use of === and !==
47
59
  // https://eslint.org/docs/rules/eqeqeq
48
- eqeqeq: ['error', 'always', { null: 'ignore' }],
60
+ eqeqeq: [
61
+ 'error',
62
+ 'always',
63
+ {
64
+ null: 'ignore',
65
+ },
66
+ ],
49
67
  // Require grouped accessor pairs in object literals and classes
50
68
  // https://eslint.org/docs/rules/grouped-accessor-pairs
51
69
  'grouped-accessor-pairs': 'error',
@@ -57,7 +75,6 @@ const bestPracticesRules = {
57
75
  'max-classes-per-file': ['error', 1],
58
76
  // disallow the use of alert, confirm, and prompt
59
77
  // https://eslint.org/docs/rules/no-alert
60
- // TODO: enable, semver-major
61
78
  'no-alert': 'warn',
62
79
  // disallow use of arguments.caller or arguments.callee
63
80
  // https://eslint.org/docs/rules/no-caller
@@ -73,7 +90,12 @@ const bestPracticesRules = {
73
90
  'no-div-regex': 'off',
74
91
  // disallow else after a return in an if
75
92
  // https://eslint.org/docs/rules/no-else-return
76
- 'no-else-return': ['error', { allowElseIf: false }],
93
+ 'no-else-return': [
94
+ 'error',
95
+ {
96
+ allowElseIf: false,
97
+ },
98
+ ],
77
99
  // disallow empty functions, except for standalone funcs/arrows
78
100
  // https://eslint.org/docs/rules/no-empty-function
79
101
  'no-empty-function': [
@@ -87,7 +109,6 @@ const bestPracticesRules = {
87
109
  'no-empty-pattern': 'error',
88
110
  // Disallow empty static blocks
89
111
  // https://eslint.org/docs/latest/rules/no-empty-static-block
90
- // TODO: semver-major, enable
91
112
  'no-empty-static-block': 'off',
92
113
  // disallow comparisons to null without a type-checking operator
93
114
  // https://eslint.org/docs/rules/no-eq-null
@@ -107,15 +128,14 @@ const bestPracticesRules = {
107
128
  // disallow fallthrough of case statements
108
129
  // https://eslint.org/docs/rules/no-fallthrough
109
130
  'no-fallthrough': 'error',
110
- // disallow the use of leading or trailing decimal points in numeric literals
111
- // https://eslint.org/docs/rules/no-floating-decimal
112
- 'no-floating-decimal': 'error',
113
131
  // disallow reassignments of native objects or read-only globals
114
132
  // https://eslint.org/docs/rules/no-global-assign
115
- 'no-global-assign': ['error', { exceptions: [] }],
116
- // deprecated in favor of no-global-assign
117
- // https://eslint.org/docs/rules/no-native-reassign
118
- 'no-native-reassign': 'off',
133
+ 'no-global-assign': [
134
+ 'error',
135
+ {
136
+ exceptions: [],
137
+ },
138
+ ],
119
139
  // disallow implicit type conversions
120
140
  // https://eslint.org/docs/rules/no-implicit-coercion
121
141
  'no-implicit-coercion': [
@@ -141,7 +161,13 @@ const bestPracticesRules = {
141
161
  'no-iterator': 'error',
142
162
  // disallow use of labels for anything other than loops and switches
143
163
  // https://eslint.org/docs/rules/no-labels
144
- 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
164
+ 'no-labels': [
165
+ 'error',
166
+ {
167
+ allowLoop: false,
168
+ allowSwitch: false,
169
+ },
170
+ ],
145
171
  // disallow unnecessary nested blocks
146
172
  // https://eslint.org/docs/rules/no-lone-blocks
147
173
  'no-lone-blocks': 'error',
@@ -159,14 +185,6 @@ const bestPracticesRules = {
159
185
  detectObjects: false,
160
186
  },
161
187
  ],
162
- // disallow use of multiple spaces
163
- // https://eslint.org/docs/rules/no-multi-spaces
164
- 'no-multi-spaces': [
165
- 'error',
166
- {
167
- ignoreEOLComments: false,
168
- },
169
- ],
170
188
  // disallow use of multiline strings
171
189
  // https://eslint.org/docs/rules/no-multi-str
172
190
  'no-multi-str': 'error',
@@ -277,9 +295,6 @@ const bestPracticesRules = {
277
295
  // disallow use of assignment in return statement
278
296
  // https://eslint.org/docs/rules/no-return-assign
279
297
  'no-return-assign': ['error', 'always'],
280
- // disallow redundant `return await`
281
- // https://eslint.org/docs/rules/no-return-await
282
- 'no-return-await': 'error',
283
298
  // disallow use of `javascript:` urls.
284
299
  // https://eslint.org/docs/rules/no-script-url
285
300
  'no-script-url': 'error',
@@ -334,22 +349,32 @@ const bestPracticesRules = {
334
349
  // disallow use of void operator
335
350
  // https://eslint.org/docs/rules/no-void
336
351
  'no-void': 'error',
337
- // disallow usage of configurable warning terms in comments: e.g. todo
352
+ // disallow usage of configurable warning terms in comments
338
353
  // https://eslint.org/docs/rules/no-warning-comments
339
- 'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
354
+ 'no-warning-comments': [
355
+ 'off',
356
+ {
357
+ terms: ['todo', 'fixme', 'remember'],
358
+ location: 'start',
359
+ },
360
+ ],
340
361
  // disallow use of the with statement
341
362
  // https://eslint.org/docs/rules/no-with
342
363
  'no-with': 'error',
343
364
  // require using Error objects as Promise rejection reasons
344
365
  // https://eslint.org/docs/rules/prefer-promise-reject-errors
345
- 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
366
+ 'prefer-promise-reject-errors': [
367
+ 'error',
368
+ {
369
+ allowEmptyReject: true,
370
+ },
371
+ ],
346
372
  // Suggest using named capture group in regular expression
347
373
  // https://eslint.org/docs/rules/prefer-named-capture-group
348
374
  'prefer-named-capture-group': 'off',
349
375
  // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
350
376
  // https://eslint.org/docs/rules/prefer-object-has-own
351
- // TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
352
- 'prefer-object-has-own': 'off',
377
+ 'prefer-object-has-own': 'error',
353
378
  // https://eslint.org/docs/rules/prefer-regex-literals
354
379
  'prefer-regex-literals': [
355
380
  'error',
@@ -369,9 +394,6 @@ const bestPracticesRules = {
369
394
  // requires to declare all vars on top of their containing scope
370
395
  // https://eslint.org/docs/rules/vars-on-top
371
396
  'vars-on-top': 'error',
372
- // require immediate function invocation to be wrapped in parentheses
373
- // https://eslint.org/docs/rules/wrap-iife.html
374
- 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
375
397
  // require or disallow Yoda conditions
376
398
  // https://eslint.org/docs/rules/yoda
377
399
  yoda: 'error',
@@ -8,7 +8,12 @@ const errorsRules = {
8
8
  'for-direction': 'error',
9
9
  // Enforces that a return statement is present in property getters
10
10
  // https://eslint.org/docs/rules/getter-return
11
- 'getter-return': ['error', { allowImplicit: true }],
11
+ 'getter-return': [
12
+ 'error',
13
+ {
14
+ allowImplicit: true,
15
+ },
16
+ ],
12
17
  // disallow using an async function as a Promise executor
13
18
  // https://eslint.org/docs/rules/no-async-promise-executor
14
19
  'no-async-promise-executor': 'error',
@@ -24,7 +29,6 @@ const errorsRules = {
24
29
  'no-console': 'warn',
25
30
  // Disallows expressions where the operation doesn't affect the value
26
31
  // https://eslint.org/docs/rules/no-constant-binary-expression
27
- // TODO: semver-major, enable
28
32
  'no-constant-binary-expression': 'off',
29
33
  // disallow use of constant expressions in conditions
30
34
  'no-constant-condition': 'warn',
@@ -50,21 +54,6 @@ const errorsRules = {
50
54
  // disallow double-negation boolean casts in a boolean context
51
55
  // https://eslint.org/docs/rules/no-extra-boolean-cast
52
56
  'no-extra-boolean-cast': 'error',
53
- // disallow unnecessary parentheses
54
- // https://eslint.org/docs/rules/no-extra-parens
55
- 'no-extra-parens': [
56
- 'off',
57
- 'all',
58
- {
59
- conditionalAssign: true,
60
- nestedBinaryExpressions: false,
61
- returnAssign: false,
62
- ignoreJSX: 'all', // delegate to eslint-plugin-react
63
- enforceForArrowConditionals: false,
64
- },
65
- ],
66
- // disallow unnecessary semicolons
67
- 'no-extra-semi': 'error',
68
57
  // disallow overwriting functions written as function declarations
69
58
  'no-func-assign': 'error',
70
59
  // https://eslint.org/docs/rules/no-import-assign
@@ -85,14 +74,13 @@ const errorsRules = {
85
74
  'no-obj-calls': 'error',
86
75
  // Disallow new operators with global non-constructor functions
87
76
  // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
88
- // TODO: semver-major, enable
89
- 'no-new-native-nonconstructor': 'off',
90
- // Disallow returning values from Promise executor functions
91
- // https://eslint.org/docs/rules/no-promise-executor-return
92
- 'no-promise-executor-return': 'error',
77
+ 'no-new-native-nonconstructor': 'error',
93
78
  // disallow use of Object.prototypes builtins directly
94
79
  // https://eslint.org/docs/rules/no-prototype-builtins
95
80
  'no-prototype-builtins': 'error',
81
+ // Disallow returning values from Promise executor functions
82
+ // https://eslint.org/docs/rules/no-promise-executor-return
83
+ 'no-promise-executor-return': 'error',
96
84
  // disallow multiple spaces in a regular expression literal
97
85
  'no-regex-spaces': 'error',
98
86
  // Disallow returning values from setters
@@ -124,29 +112,32 @@ const errorsRules = {
124
112
  'no-unsafe-negation': 'error',
125
113
  // disallow use of optional chaining in contexts where the undefined value is not allowed
126
114
  // https://eslint.org/docs/rules/no-unsafe-optional-chaining
127
- 'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
115
+ 'no-unsafe-optional-chaining': [
116
+ 'error',
117
+ {
118
+ disallowArithmeticOperators: true,
119
+ },
120
+ ],
128
121
  // Disallow Unused Private Class Members
129
122
  // https://eslint.org/docs/rules/no-unused-private-class-members
130
- // TODO: enable once eslint 7 is dropped (which is semver-major)
131
123
  'no-unused-private-class-members': 'off',
132
124
  // Disallow useless backreferences in regular expressions
133
125
  // https://eslint.org/docs/rules/no-useless-backreference
134
126
  'no-useless-backreference': 'error',
135
- // disallow negation of the left operand of an in expression
136
- // deprecated in favor of no-unsafe-negation
137
- 'no-negated-in-lhs': 'off',
138
127
  // Disallow assignments that can lead to race conditions due to usage of await or yield
139
128
  // https://eslint.org/docs/rules/require-atomic-updates
140
129
  // note: not enabled because it is very buggy
141
130
  'require-atomic-updates': 'off',
142
131
  // disallow comparisons with the value NaN
143
132
  'use-isnan': 'error',
144
- // ensure JSDoc comments are valid
145
- // https://eslint.org/docs/rules/valid-jsdoc
146
- 'valid-jsdoc': 'off',
147
133
  // ensure that the results of typeof are compared against a valid string
148
134
  // https://eslint.org/docs/rules/valid-typeof
149
- 'valid-typeof': ['error', { requireStringLiterals: true }],
135
+ 'valid-typeof': [
136
+ 'error',
137
+ {
138
+ requireStringLiterals: true,
139
+ },
140
+ ],
150
141
  },
151
142
  };
152
143
  exports.default = errorsRules;
package/dist/rules/es6.js CHANGED
@@ -28,28 +28,11 @@ const es6Rules = {
28
28
  requireReturnForObjectLiteral: false,
29
29
  },
30
30
  ],
31
- // require parens in arrow function arguments
32
- // https://eslint.org/docs/rules/arrow-parens
33
- 'arrow-parens': ['error', 'always'],
34
- // require space before/after arrow function's arrow
35
- // https://eslint.org/docs/rules/arrow-spacing
36
- 'arrow-spacing': ['error', { before: true, after: true }],
37
31
  // verify super() callings in constructors
38
32
  'constructor-super': 'error',
39
- // enforce the spacing around the * in generator functions
40
- // https://eslint.org/docs/rules/generator-star-spacing
41
- 'generator-star-spacing': ['error', { before: false, after: true }],
42
33
  // disallow modifying variables of class declarations
43
34
  // https://eslint.org/docs/rules/no-class-assign
44
35
  'no-class-assign': 'error',
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
36
  // disallow modifying variables that are declared using const
54
37
  'no-const-assign': 'error',
55
38
  // disallow duplicate class members
@@ -59,9 +42,6 @@ const es6Rules = {
59
42
  // https://eslint.org/docs/rules/no-duplicate-imports
60
43
  // replaced by https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
61
44
  'no-duplicate-imports': 'off',
62
- // disallow symbol constructor
63
- // https://eslint.org/docs/rules/no-new-symbol
64
- 'no-new-symbol': 'error',
65
45
  // Disallow specified names in exports
66
46
  // https://eslint.org/docs/rules/no-restricted-exports
67
47
  'no-restricted-exports': [
@@ -150,9 +130,6 @@ const es6Rules = {
150
130
  // disallow parseInt() in favor of binary, octal, and hexadecimal literals
151
131
  // https://eslint.org/docs/rules/prefer-numeric-literals
152
132
  'prefer-numeric-literals': 'error',
153
- // suggest using Reflect methods where applicable
154
- // https://eslint.org/docs/rules/prefer-reflect
155
- 'prefer-reflect': 'off',
156
133
  // use rest parameters instead of arguments
157
134
  // https://eslint.org/docs/rules/prefer-rest-params
158
135
  'prefer-rest-params': 'error',
@@ -165,9 +142,6 @@ const es6Rules = {
165
142
  // disallow generator functions that do not have yield
166
143
  // https://eslint.org/docs/rules/require-yield
167
144
  'require-yield': 'error',
168
- // enforce spacing between object rest-spread
169
- // https://eslint.org/docs/rules/rest-spread-spacing
170
- 'rest-spread-spacing': ['error', 'never'],
171
145
  // import sorting
172
146
  // https://eslint.org/docs/rules/sort-imports
173
147
  'sort-imports': [
@@ -182,12 +156,6 @@ const es6Rules = {
182
156
  // require a Symbol description
183
157
  // https://eslint.org/docs/rules/symbol-description
184
158
  'symbol-description': 'error',
185
- // enforce usage of spacing in template strings
186
- // https://eslint.org/docs/rules/template-curly-spacing
187
- 'template-curly-spacing': 'error',
188
- // enforce spacing around the * in yield* expressions
189
- // https://eslint.org/docs/rules/yield-star-spacing
190
- 'yield-star-spacing': ['error', 'after'],
191
159
  },
192
160
  };
193
161
  exports.default = es6Rules;
@@ -52,7 +52,7 @@ const importsRules = Object.assign(Object.assign({}, eslint_plugin_import_x_1.fl
52
52
  // disallow non-import statements appearing before import statements
53
53
  // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/imports-first.md
54
54
  // @deprecated: use `import-x/first`
55
- 'import-x/imports-first': 'off',
55
+ // 'import-x/imports-first': 'off',
56
56
  // Forbid modules to have too many dependencies
57
57
  // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
58
58
  'import-x/max-dependencies': 'off',
@@ -8,7 +8,8 @@ const react_1 = __importDefault(require("../configs/react"));
8
8
  const typescript_1 = __importDefault(require("../configs/typescript"));
9
9
  const importsStrict_1 = __importDefault(require("../rules/importsStrict"));
10
10
  const next_1 = __importDefault(require("../rules/next"));
11
- const baseRules = Object.assign(Object.assign({}, base_1.default), { importsStrict: importsStrict_1.default });
11
+ const reactStrict_1 = __importDefault(require("../rules/reactStrict"));
12
+ const baseRules = Object.assign(Object.assign({}, base_1.default), { importsStrict: importsStrict_1.default, reactStrict: reactStrict_1.default });
12
13
  /**
13
14
  * as is given due to less size of index.d.ts
14
15
  */