eslint-config-airbnb-extended 1.0.11 → 2.0.0-beta-2
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.
- package/dist/@types/legacy.d.ts +12 -0
- package/dist/legacy/configs/base/config.js +24 -0
- package/dist/legacy/configs/base/index.js +18 -0
- package/dist/legacy/configs/base/legacy.js +46 -0
- package/dist/legacy/configs/base/recommended.js +21 -0
- package/dist/legacy/configs/base/typescript.js +8 -0
- package/dist/legacy/configs/index.js +15 -0
- package/dist/legacy/configs/react/base.js +8 -0
- package/dist/legacy/configs/react/config.js +14 -0
- package/dist/legacy/configs/react/hooks.js +8 -0
- package/dist/legacy/configs/react/index.js +24 -0
- package/dist/legacy/configs/react/legacy.js +8 -0
- package/dist/legacy/configs/react/recommended.js +13 -0
- package/dist/legacy/configs/react/typescript.js +35 -0
- package/dist/legacy/configs/typescript/config.js +12 -0
- package/dist/legacy/rules/best-practices.js +433 -0
- package/dist/legacy/rules/errors.js +167 -0
- package/dist/legacy/rules/es6.js +206 -0
- package/dist/legacy/rules/imports.js +280 -0
- package/dist/legacy/rules/index.js +18 -0
- package/dist/legacy/rules/node.js +35 -0
- package/dist/legacy/rules/react/react.js +663 -0
- package/dist/legacy/rules/react/reactHooks.js +30 -0
- package/dist/legacy/rules/react/reactJsxA11y.js +276 -0
- package/dist/legacy/rules/strict.js +12 -0
- package/dist/legacy/rules/style.js +655 -0
- package/dist/legacy/rules/typescript/typescript.js +253 -0
- package/dist/legacy/rules/typescript/typescriptOverrides.js +36 -0
- package/dist/legacy/rules/variables.js +68 -0
- package/dist/legacy.js +14 -0
- package/dist/rules/typescript/typescriptEslint.js +3 -0
- package/package.json +25 -10
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const typescript_eslint_1 = require("typescript-eslint");
|
|
7
|
+
const best_practices_1 = __importDefault(require("../../../legacy/rules/best-practices"));
|
|
8
|
+
const errors_1 = __importDefault(require("../../../legacy/rules/errors"));
|
|
9
|
+
const es6_1 = __importDefault(require("../../../legacy/rules/es6"));
|
|
10
|
+
const imports_1 = __importDefault(require("../../../legacy/rules/imports"));
|
|
11
|
+
const style_1 = __importDefault(require("../../../legacy/rules/style"));
|
|
12
|
+
const variables_1 = __importDefault(require("../../../legacy/rules/variables"));
|
|
13
|
+
const utils_1 = require("../../../utils");
|
|
14
|
+
const { rules: baseBestPracticesRules } = best_practices_1.default;
|
|
15
|
+
const { rules: baseErrorsRules } = errors_1.default;
|
|
16
|
+
const { rules: baseES6Rules } = es6_1.default;
|
|
17
|
+
const { rules: baseImportsRules } = imports_1.default;
|
|
18
|
+
const { rules: baseStyleRules } = style_1.default;
|
|
19
|
+
const { rules: baseVariablesRules } = variables_1.default;
|
|
20
|
+
const legacyTypescriptBaseRules = {
|
|
21
|
+
name: 'airbnb/config/typescript/legacy',
|
|
22
|
+
files: utils_1.tsFiles,
|
|
23
|
+
plugins: {
|
|
24
|
+
'@typescript-eslint': typescript_eslint_1.plugin,
|
|
25
|
+
},
|
|
26
|
+
languageOptions: {
|
|
27
|
+
parser: typescript_eslint_1.parser,
|
|
28
|
+
parserOptions: {
|
|
29
|
+
projectService: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
settings: {
|
|
33
|
+
// Apply special parsing for TypeScript files
|
|
34
|
+
'import/parsers': {
|
|
35
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
36
|
+
},
|
|
37
|
+
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
38
|
+
// Original: ['.mjs', '.js', '.json']
|
|
39
|
+
'import/resolver': {
|
|
40
|
+
node: {
|
|
41
|
+
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
|
|
42
|
+
},
|
|
43
|
+
typescript: true,
|
|
44
|
+
},
|
|
45
|
+
// Append 'ts' extensions to Airbnb 'import/extensions' setting
|
|
46
|
+
// Original: ['.js', '.mjs', '.jsx']
|
|
47
|
+
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
|
|
48
|
+
// Resolve type definition packages
|
|
49
|
+
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
// Replace Airbnb 'brace-style' rule with '@typescript-eslint' version
|
|
53
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
|
|
54
|
+
// @deprecated and deleted by @typescript-eslint
|
|
55
|
+
// 'brace-style': 'off',
|
|
56
|
+
// '@typescript-eslint/brace-style': baseStyleRules['brace-style'],
|
|
57
|
+
// Replace Airbnb 'camelcase' rule with '@typescript-eslint/naming-convention'
|
|
58
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
|
|
59
|
+
camelcase: 'off',
|
|
60
|
+
// The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
|
|
61
|
+
'@typescript-eslint/naming-convention': [
|
|
62
|
+
'error',
|
|
63
|
+
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
|
|
64
|
+
{
|
|
65
|
+
selector: 'variable',
|
|
66
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
67
|
+
},
|
|
68
|
+
// Allow camelCase functions (23.2), and PascalCase functions (23.8)
|
|
69
|
+
{
|
|
70
|
+
selector: 'function',
|
|
71
|
+
format: ['camelCase', 'PascalCase'],
|
|
72
|
+
},
|
|
73
|
+
// Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums
|
|
74
|
+
{
|
|
75
|
+
selector: 'typeLike',
|
|
76
|
+
format: ['PascalCase'],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
// Replace Airbnb 'comma-dangle' rule with '@typescript-eslint' version
|
|
80
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
81
|
+
// The TypeScript version also adds 3 new options, all of which should be set to the same value as the base config
|
|
82
|
+
// @deprecated and deleted by @typescript-eslint
|
|
83
|
+
// 'comma-dangle': 'off',
|
|
84
|
+
// '@typescript-eslint/comma-dangle': [
|
|
85
|
+
// baseStyleRules['comma-dangle'][0],
|
|
86
|
+
// {
|
|
87
|
+
// ...baseStyleRules['comma-dangle'][1],
|
|
88
|
+
// enums: baseStyleRules['comma-dangle'][1].arrays,
|
|
89
|
+
// generics: baseStyleRules['comma-dangle'][1].arrays,
|
|
90
|
+
// tuples: baseStyleRules['comma-dangle'][1].arrays,
|
|
91
|
+
// },
|
|
92
|
+
// ],
|
|
93
|
+
// Replace Airbnb 'comma-spacing' rule with '@typescript-eslint' version
|
|
94
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
95
|
+
// @deprecated and deleted by @typescript-eslint
|
|
96
|
+
// 'comma-spacing': 'off',
|
|
97
|
+
// '@typescript-eslint/comma-spacing': baseStyleRules['comma-spacing'],
|
|
98
|
+
// Replace Airbnb 'default-param-last' rule with '@typescript-eslint' version
|
|
99
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
|
|
100
|
+
'default-param-last': 'off',
|
|
101
|
+
'@typescript-eslint/default-param-last': baseBestPracticesRules['default-param-last'],
|
|
102
|
+
// Replace Airbnb 'dot-notation' rule with '@typescript-eslint' version
|
|
103
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
104
|
+
'dot-notation': 'off',
|
|
105
|
+
'@typescript-eslint/dot-notation': baseBestPracticesRules['dot-notation'],
|
|
106
|
+
// Replace Airbnb 'func-call-spacing' rule with '@typescript-eslint' version
|
|
107
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
108
|
+
// @deprecated and deleted by @typescript-eslint
|
|
109
|
+
// 'func-call-spacing': 'off',
|
|
110
|
+
// '@typescript-eslint/func-call-spacing': baseStyleRules['func-call-spacing'],
|
|
111
|
+
// Replace Airbnb 'indent' rule with '@typescript-eslint' version
|
|
112
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
|
|
113
|
+
// @deprecated and deleted by @typescript-eslint
|
|
114
|
+
// indent: 'off',
|
|
115
|
+
// '@typescript-eslint/indent': baseStyleRules.indent,
|
|
116
|
+
// Replace Airbnb 'keyword-spacing' rule with '@typescript-eslint' version
|
|
117
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
118
|
+
// @deprecated and deleted by @typescript-eslint
|
|
119
|
+
// 'keyword-spacing': 'off',
|
|
120
|
+
// '@typescript-eslint/keyword-spacing': baseStyleRules['keyword-spacing'],
|
|
121
|
+
// Replace Airbnb 'lines-between-class-members' rule with '@typescript-eslint' version
|
|
122
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
123
|
+
// @deprecated and deleted by @typescript-eslint
|
|
124
|
+
// 'lines-between-class-members': 'off',
|
|
125
|
+
// '@typescript-eslint/lines-between-class-members': baseStyleRules['lines-between-class-members'],
|
|
126
|
+
// Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
|
|
127
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
128
|
+
'no-array-constructor': 'off',
|
|
129
|
+
'@typescript-eslint/no-array-constructor': baseStyleRules['no-array-constructor'],
|
|
130
|
+
// Replace Airbnb 'no-dupe-class-members' rule with '@typescript-eslint' version
|
|
131
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
|
|
132
|
+
'no-dupe-class-members': 'off',
|
|
133
|
+
'@typescript-eslint/no-dupe-class-members': baseES6Rules['no-dupe-class-members'],
|
|
134
|
+
// Replace Airbnb 'no-empty-function' rule with '@typescript-eslint' version
|
|
135
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
136
|
+
'no-empty-function': 'off',
|
|
137
|
+
'@typescript-eslint/no-empty-function': baseBestPracticesRules['no-empty-function'],
|
|
138
|
+
// Replace Airbnb 'no-extra-parens' rule with '@typescript-eslint' version
|
|
139
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
|
|
140
|
+
'no-extra-parens': 'off',
|
|
141
|
+
'@typescript-eslint/no-extra-parens': baseErrorsRules['no-extra-parens'],
|
|
142
|
+
// Replace Airbnb 'no-extra-semi' rule with '@typescript-eslint' version
|
|
143
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
144
|
+
// @deprecated and deleted by @typescript-eslint
|
|
145
|
+
// 'no-extra-semi': 'off',
|
|
146
|
+
// '@typescript-eslint/no-extra-semi': baseErrorsRules['no-extra-semi'],
|
|
147
|
+
// Replace Airbnb 'no-implied-eval' and 'no-new-func' rules with '@typescript-eslint' version
|
|
148
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
|
|
149
|
+
'no-implied-eval': 'off',
|
|
150
|
+
'no-new-func': 'off',
|
|
151
|
+
'@typescript-eslint/no-implied-eval': baseBestPracticesRules['no-implied-eval'],
|
|
152
|
+
// Replace Airbnb 'no-loss-of-precision' rule with '@typescript-eslint' version
|
|
153
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
|
|
154
|
+
'no-loss-of-precision': 'off',
|
|
155
|
+
'@typescript-eslint/no-loss-of-precision': baseErrorsRules['no-loss-of-precision'],
|
|
156
|
+
// Replace Airbnb 'no-loop-func' rule with '@typescript-eslint' version
|
|
157
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
|
|
158
|
+
'no-loop-func': 'off',
|
|
159
|
+
'@typescript-eslint/no-loop-func': baseBestPracticesRules['no-loop-func'],
|
|
160
|
+
// Replace Airbnb 'no-magic-numbers' rule with '@typescript-eslint' version
|
|
161
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
|
|
162
|
+
'no-magic-numbers': 'off',
|
|
163
|
+
'@typescript-eslint/no-magic-numbers': baseBestPracticesRules['no-magic-numbers'],
|
|
164
|
+
// Replace Airbnb 'no-redeclare' rule with '@typescript-eslint' version
|
|
165
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
166
|
+
'no-redeclare': 'off',
|
|
167
|
+
'@typescript-eslint/no-redeclare': baseBestPracticesRules['no-redeclare'],
|
|
168
|
+
// Replace Airbnb 'no-shadow' rule with '@typescript-eslint' version
|
|
169
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
170
|
+
'no-shadow': 'off',
|
|
171
|
+
'@typescript-eslint/no-shadow': baseVariablesRules['no-shadow'],
|
|
172
|
+
// Replace Airbnb 'space-before-blocks' rule with '@typescript-eslint' version
|
|
173
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-blocks.md
|
|
174
|
+
// @deprecated and deleted by @typescript-eslint
|
|
175
|
+
// 'space-before-blocks': 'off',
|
|
176
|
+
// '@typescript-eslint/space-before-blocks': baseStyleRules['space-before-blocks'],
|
|
177
|
+
// Replace Airbnb 'no-throw-literal' rule with '@typescript-eslint' version
|
|
178
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
179
|
+
// @deprecated and deleted by @typescript-eslint
|
|
180
|
+
// 'no-throw-literal': 'off',
|
|
181
|
+
// '@typescript-eslint/no-throw-literal': baseBestPracticesRules['no-throw-literal'],
|
|
182
|
+
// Replace Airbnb 'no-unused-expressions' rule with '@typescript-eslint' version
|
|
183
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
184
|
+
'no-unused-expressions': 'off',
|
|
185
|
+
'@typescript-eslint/no-unused-expressions': baseBestPracticesRules['no-unused-expressions'],
|
|
186
|
+
// Replace Airbnb 'no-unused-vars' rule with '@typescript-eslint' version
|
|
187
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
188
|
+
'no-unused-vars': 'off',
|
|
189
|
+
'@typescript-eslint/no-unused-vars': baseVariablesRules['no-unused-vars'],
|
|
190
|
+
// Replace Airbnb 'no-use-before-define' rule with '@typescript-eslint' version
|
|
191
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
|
|
192
|
+
'no-use-before-define': 'off',
|
|
193
|
+
'@typescript-eslint/no-use-before-define': baseVariablesRules['no-use-before-define'],
|
|
194
|
+
// Replace Airbnb 'no-useless-constructor' rule with '@typescript-eslint' version
|
|
195
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
|
|
196
|
+
'no-useless-constructor': 'off',
|
|
197
|
+
'@typescript-eslint/no-useless-constructor': baseES6Rules['no-useless-constructor'],
|
|
198
|
+
// Replace Airbnb 'quotes' rule with '@typescript-eslint' version
|
|
199
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
|
|
200
|
+
// @deprecated and deleted by @typescript-eslint
|
|
201
|
+
// quotes: 'off',
|
|
202
|
+
// '@typescript-eslint/quotes': baseStyleRules.quotes,
|
|
203
|
+
// Replace Airbnb 'semi' rule with '@typescript-eslint' version
|
|
204
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
205
|
+
// @deprecated and deleted by @typescript-eslint
|
|
206
|
+
// semi: 'off',
|
|
207
|
+
// '@typescript-eslint/semi': baseStyleRules.semi,
|
|
208
|
+
// Replace Airbnb 'space-before-function-paren' rule with '@typescript-eslint' version
|
|
209
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
210
|
+
// @deprecated and deleted by @typescript-eslint
|
|
211
|
+
// 'space-before-function-paren': 'off',
|
|
212
|
+
// '@typescript-eslint/space-before-function-paren': baseStyleRules['space-before-function-paren'],
|
|
213
|
+
// Replace Airbnb 'require-await' rule with '@typescript-eslint' version
|
|
214
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
215
|
+
'require-await': 'off',
|
|
216
|
+
'@typescript-eslint/require-await': baseBestPracticesRules['require-await'],
|
|
217
|
+
// Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
|
|
218
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
|
|
219
|
+
'no-return-await': 'off',
|
|
220
|
+
'@typescript-eslint/return-await': [baseBestPracticesRules['no-return-await'], 'in-try-catch'],
|
|
221
|
+
// Replace Airbnb 'space-infix-ops' rule with '@typescript-eslint' version
|
|
222
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
223
|
+
// @deprecated and deleted by @typescript-eslint
|
|
224
|
+
// 'space-infix-ops': 'off',
|
|
225
|
+
// '@typescript-eslint/space-infix-ops': baseStyleRules['space-infix-ops'],
|
|
226
|
+
// Replace Airbnb 'object-curly-spacing' rule with '@typescript-eslint' version
|
|
227
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/object-curly-spacing.md
|
|
228
|
+
// @deprecated and deleted by @typescript-eslint
|
|
229
|
+
// 'object-curly-spacing': 'off',
|
|
230
|
+
// '@typescript-eslint/object-curly-spacing': baseStyleRules['object-curly-spacing'],
|
|
231
|
+
// Append 'ts' and 'tsx' to Airbnb 'import/extensions' rule
|
|
232
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
|
|
233
|
+
'import/extensions': [
|
|
234
|
+
baseImportsRules['import/extensions'][0],
|
|
235
|
+
baseImportsRules['import/extensions'][1],
|
|
236
|
+
Object.assign(Object.assign({}, baseImportsRules['import/extensions'][2]), { ts: 'never', tsx: 'never' }),
|
|
237
|
+
],
|
|
238
|
+
// Append 'ts' and 'tsx' extensions to Airbnb 'import/no-extraneous-dependencies' rule
|
|
239
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
240
|
+
'import/no-extraneous-dependencies': [
|
|
241
|
+
baseImportsRules['import/no-extraneous-dependencies'][0],
|
|
242
|
+
Object.assign(Object.assign({}, baseImportsRules['import/no-extraneous-dependencies'][1]), { devDependencies: baseImportsRules['import/no-extraneous-dependencies'][1].devDependencies.reduce((result, devDep) => {
|
|
243
|
+
const toAppend = [devDep];
|
|
244
|
+
const devDepWithTs = devDep.replaceAll(/\bjs(x?)\b/g, 'ts$1');
|
|
245
|
+
if (devDepWithTs !== devDep) {
|
|
246
|
+
toAppend.push(devDepWithTs);
|
|
247
|
+
}
|
|
248
|
+
return [...result, ...toAppend];
|
|
249
|
+
}, []) }),
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
exports.default = legacyTypescriptBaseRules;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../utils");
|
|
4
|
+
const legacyTypescriptOverridesRules = {
|
|
5
|
+
name: 'airbnb/config/typescript/overrides/legacy',
|
|
6
|
+
files: utils_1.tsFiles,
|
|
7
|
+
rules: {
|
|
8
|
+
// The following rules are enabled in Airbnb config, but are already checked (more thoroughly) by the TypeScript compiler
|
|
9
|
+
// Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
|
|
10
|
+
// Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
|
|
11
|
+
'constructor-super': 'off',
|
|
12
|
+
'getter-return': 'off',
|
|
13
|
+
'no-const-assign': 'off',
|
|
14
|
+
'no-dupe-args': 'off',
|
|
15
|
+
'no-dupe-class-members': 'off',
|
|
16
|
+
'no-dupe-keys': 'off',
|
|
17
|
+
'no-func-assign': 'off',
|
|
18
|
+
'no-import-assign': 'off',
|
|
19
|
+
'no-new-symbol': 'off',
|
|
20
|
+
'no-obj-calls': 'off',
|
|
21
|
+
'no-redeclare': 'off',
|
|
22
|
+
'no-setter-return': 'off',
|
|
23
|
+
'no-this-before-super': 'off',
|
|
24
|
+
'no-undef': 'off',
|
|
25
|
+
'no-unreachable': 'off',
|
|
26
|
+
'no-unsafe-negation': 'off',
|
|
27
|
+
'valid-typeof': 'off',
|
|
28
|
+
// The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
|
|
29
|
+
// See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
|
|
30
|
+
'import/named': 'off',
|
|
31
|
+
'import/no-named-as-default-member': 'off',
|
|
32
|
+
// Disable `import/no-unresolved`, see README.md for details
|
|
33
|
+
'import/no-unresolved': 'off',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
exports.default = legacyTypescriptOverridesRules;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const confusing_browser_globals_1 = __importDefault(require("confusing-browser-globals"));
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const legacyVariablesRules = {
|
|
9
|
+
name: 'airbnb/config/variables/legacy',
|
|
10
|
+
files: utils_1.allFiles,
|
|
11
|
+
rules: {
|
|
12
|
+
// enforce or disallow variable initializations at definition
|
|
13
|
+
'init-declarations': 'off',
|
|
14
|
+
// disallow the catch clause parameter name being the same as a variable in the outer scope
|
|
15
|
+
'no-catch-shadow': 'off',
|
|
16
|
+
// disallow deletion of variables
|
|
17
|
+
'no-delete-var': 'error',
|
|
18
|
+
// disallow labels that share a name with a variable
|
|
19
|
+
// https://eslint.org/docs/rules/no-label-var
|
|
20
|
+
'no-label-var': 'error',
|
|
21
|
+
// disallow specific globals
|
|
22
|
+
'no-restricted-globals': [
|
|
23
|
+
'error',
|
|
24
|
+
{
|
|
25
|
+
name: 'isFinite',
|
|
26
|
+
message: 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'isNaN',
|
|
30
|
+
message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
31
|
+
},
|
|
32
|
+
...confusing_browser_globals_1.default.map((g) => ({
|
|
33
|
+
name: g,
|
|
34
|
+
message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
|
|
35
|
+
})),
|
|
36
|
+
],
|
|
37
|
+
// disallow declaration of variables already declared in the outer scope
|
|
38
|
+
'no-shadow': 'error',
|
|
39
|
+
// disallow shadowing of names such as arguments
|
|
40
|
+
'no-shadow-restricted-names': 'error',
|
|
41
|
+
// disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
42
|
+
'no-undef': 'error',
|
|
43
|
+
// disallow use of undefined when initializing variables
|
|
44
|
+
'no-undef-init': 'error',
|
|
45
|
+
// disallow use of undefined variable
|
|
46
|
+
// https://eslint.org/docs/rules/no-undefined
|
|
47
|
+
'no-undefined': 'off',
|
|
48
|
+
// disallow declaration of variables that are not used in the code
|
|
49
|
+
'no-unused-vars': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
vars: 'all',
|
|
53
|
+
args: 'after-used',
|
|
54
|
+
ignoreRestSiblings: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
// disallow use of variables before they are defined
|
|
58
|
+
'no-use-before-define': [
|
|
59
|
+
'error',
|
|
60
|
+
{
|
|
61
|
+
functions: true,
|
|
62
|
+
classes: true,
|
|
63
|
+
variables: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
exports.default = legacyVariablesRules;
|
package/dist/legacy.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable import-x/no-rename-default, unicorn/prefer-export-from */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.configs = exports.rules = void 0;
|
|
8
|
+
const configs_1 = __importDefault(require("./legacy/configs"));
|
|
9
|
+
const rules_1 = __importDefault(require("./legacy/rules"));
|
|
10
|
+
/**
|
|
11
|
+
* Direct export isn't allowed, it will increase the size of d.ts
|
|
12
|
+
*/
|
|
13
|
+
exports.rules = rules_1.default;
|
|
14
|
+
exports.configs = configs_1.default;
|
|
@@ -305,6 +305,9 @@ const typescriptEslintRules = {
|
|
|
305
305
|
// Disallow unnecessary constraints on generic types.
|
|
306
306
|
// https://typescript-eslint.io/rules/no-unnecessary-type-constraint
|
|
307
307
|
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
308
|
+
// Disallow conversion idioms when they do not change the type or value of the expression.
|
|
309
|
+
// https://typescript-eslint.io/rules/no-unnecessary-type-conversion
|
|
310
|
+
'@typescript-eslint/no-unnecessary-type-conversion': 'off',
|
|
308
311
|
// Disallow type parameters that aren't used multiple times.
|
|
309
312
|
// https://typescript-eslint.io/rules/no-unnecessary-type-parameters
|
|
310
313
|
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-airbnb-extended",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta-2",
|
|
4
4
|
"description": "Eslint Airbnb Config Extended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -28,21 +28,29 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"author": "Nisharg Shah <nishargshah3101@gmail.com>",
|
|
30
30
|
"type": "commonjs",
|
|
31
|
-
"
|
|
32
|
-
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"default": "./dist/index.js",
|
|
34
|
+
"types": "./dist/@types/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./legacy": {
|
|
37
|
+
"default": "./dist/legacy.js",
|
|
38
|
+
"types": "./dist/@types/legacy.d.ts"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
33
41
|
"dependencies": {
|
|
34
42
|
"confusing-browser-globals": "^1.0.11",
|
|
35
|
-
"globals": "^16.
|
|
43
|
+
"globals": "^16.2.0"
|
|
36
44
|
},
|
|
37
45
|
"devDependencies": {
|
|
38
46
|
"@stylistic/eslint-plugin": "^3.1.0",
|
|
39
47
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
40
|
-
"@types/node": "^22.15.
|
|
48
|
+
"@types/node": "^22.15.29",
|
|
41
49
|
"rimraf": "^6.0.1",
|
|
42
|
-
"tsc-alias": "^1.8.
|
|
43
|
-
"tsx": "^4.19.
|
|
50
|
+
"tsc-alias": "^1.8.16",
|
|
51
|
+
"tsx": "^4.19.4",
|
|
44
52
|
"typescript": "^5.8.3",
|
|
45
|
-
"typescript-eslint": "^8.
|
|
53
|
+
"typescript-eslint": "^8.33.0"
|
|
46
54
|
},
|
|
47
55
|
"peerDependencies": {
|
|
48
56
|
"@next/eslint-plugin-next": "15.x",
|
|
@@ -50,6 +58,7 @@
|
|
|
50
58
|
"@types/eslint-plugin-jsx-a11y": "6.x",
|
|
51
59
|
"eslint": "9.x",
|
|
52
60
|
"eslint-import-resolver-typescript": "4.x",
|
|
61
|
+
"eslint-plugin-import": "2.x",
|
|
53
62
|
"eslint-plugin-import-x": "4.x",
|
|
54
63
|
"eslint-plugin-jsx-a11y": "6.x",
|
|
55
64
|
"eslint-plugin-n": "17.x",
|
|
@@ -71,10 +80,16 @@
|
|
|
71
80
|
"optional": false
|
|
72
81
|
},
|
|
73
82
|
"eslint-import-resolver-typescript": {
|
|
74
|
-
"optional":
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"eslint-plugin-import": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"eslint-plugin-import-x": {
|
|
89
|
+
"optional": true
|
|
75
90
|
},
|
|
76
91
|
"eslint-plugin-jsx-a11y": {
|
|
77
|
-
"optional":
|
|
92
|
+
"optional": true
|
|
78
93
|
},
|
|
79
94
|
"eslint-plugin-n": {
|
|
80
95
|
"optional": true
|