eslint-config-airbnb-extended 0.1.0 → 0.1.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.
- package/dist/base/index.d.ts +841 -0
- package/dist/base/index.js +23 -0
- package/dist/base/recommended.d.ts +2 -0
- package/dist/base/recommended.js +19 -0
- package/dist/index.d.ts +2654 -0
- package/dist/index.js +29 -0
- package/dist/react/index.d.ts +1798 -0
- package/dist/react/index.js +13 -0
- package/dist/react/recommended.d.ts +2 -0
- package/dist/react/recommended.js +8 -0
- package/dist/rules/best-practices.d.ts +177 -0
- package/dist/rules/best-practices.js +379 -0
- package/dist/rules/errors.d.ts +69 -0
- package/dist/rules/errors.js +151 -0
- package/dist/rules/es6.d.ts +146 -0
- package/dist/rules/es6.js +192 -0
- package/dist/rules/imports.d.ts +157 -0
- package/dist/rules/imports.js +256 -0
- package/dist/rules/node.d.ts +90 -0
- package/dist/rules/node.js +39 -0
- package/dist/rules/react-a11y.d.ts +117 -0
- package/dist/rules/react-a11y.js +255 -0
- package/dist/rules/react-hooks.d.ts +19 -0
- package/dist/rules/react-hooks.js +57 -0
- package/dist/rules/react.d.ts +1664 -0
- package/dist/rules/react.js +583 -0
- package/dist/rules/strict.d.ts +7 -0
- package/dist/rules/strict.js +9 -0
- package/dist/rules/style.d.ts +320 -0
- package/dist/rules/style.js +530 -0
- package/dist/rules/typescript.d.ts +4 -0
- package/dist/rules/typescript.js +264 -0
- package/dist/rules/variables.d.ts +35 -0
- package/dist/rules/variables.js +65 -0
- package/dist/typescript/index.d.ts +5 -0
- package/dist/typescript/index.js +9 -0
- package/dist/typescript/recommended.d.ts +6 -0
- package/dist/typescript/recommended.js +62 -0
- package/package.json +6 -7
- package/CHANGELOG.md +0 -7
- package/base/index.ts +0 -21
- package/base/recommended.ts +0 -17
- package/index.ts +0 -25
- package/react/index.ts +0 -11
- package/react/recommended.ts +0 -6
- package/rules/best-practices.ts +0 -462
- package/rules/errors.ts +0 -199
- package/rules/es6.ts +0 -224
- package/rules/imports.ts +0 -308
- package/rules/node.ts +0 -49
- package/rules/react-a11y.ts +0 -295
- package/rules/react-hooks.ts +0 -26
- package/rules/react.ts +0 -692
- package/rules/strict.ts +0 -9
- package/rules/style.ts +0 -632
- package/rules/typescript.ts +0 -312
- package/rules/variables.ts +0 -76
- package/tsconfig.json +0 -22
- package/typescript/index.ts +0 -7
- package/typescript/recommended.ts +0 -30
|
@@ -0,0 +1,264 @@
|
|
|
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
|
+
exports.importResolverExtensions = void 0;
|
|
7
|
+
const typescript_eslint_1 = require("typescript-eslint");
|
|
8
|
+
const best_practices_1 = __importDefault(require("../rules/best-practices"));
|
|
9
|
+
const errors_1 = __importDefault(require("../rules/errors"));
|
|
10
|
+
const es6_1 = __importDefault(require("../rules/es6"));
|
|
11
|
+
const imports_1 = require("../rules/imports");
|
|
12
|
+
const style_1 = __importDefault(require("../rules/style"));
|
|
13
|
+
const variables_1 = __importDefault(require("../rules/variables"));
|
|
14
|
+
exports.importResolverExtensions = [
|
|
15
|
+
...imports_1.importConfig.settings['import/resolver'].node.extensions,
|
|
16
|
+
'.ts',
|
|
17
|
+
'.cts',
|
|
18
|
+
'.mts',
|
|
19
|
+
'.d.ts',
|
|
20
|
+
];
|
|
21
|
+
exports.default = [
|
|
22
|
+
{
|
|
23
|
+
name: 'airbnb/config/typescript',
|
|
24
|
+
plugins: {
|
|
25
|
+
'@typescript-eslint': typescript_eslint_1.plugin,
|
|
26
|
+
},
|
|
27
|
+
languageOptions: {
|
|
28
|
+
parser: typescript_eslint_1.parser,
|
|
29
|
+
parserOptions: {
|
|
30
|
+
projectService: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
settings: {
|
|
34
|
+
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
35
|
+
'import/resolver': {
|
|
36
|
+
node: {
|
|
37
|
+
extensions: exports.importResolverExtensions,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
// Append 'ts' extensions to Airbnb 'import/extensions' setting
|
|
41
|
+
'import/extensions': [...imports_1.importConfig.settings['import/extensions'], '.ts', '.tsx', '.d.ts'],
|
|
42
|
+
// Resolve type definition packages
|
|
43
|
+
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
44
|
+
},
|
|
45
|
+
rules: {
|
|
46
|
+
// Replace Airbnb 'brace-style' rule with '@typescript-eslint' version
|
|
47
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
|
|
48
|
+
'brace-style': 'off',
|
|
49
|
+
'@typescript-eslint/brace-style': style_1.default.rules['brace-style'],
|
|
50
|
+
// Replace Airbnb 'camelcase' rule with '@typescript-eslint/naming-convention'
|
|
51
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
|
|
52
|
+
camelcase: 'off',
|
|
53
|
+
// The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
|
|
54
|
+
'@typescript-eslint/naming-convention': [
|
|
55
|
+
'error',
|
|
56
|
+
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
|
|
57
|
+
{
|
|
58
|
+
selector: 'variable',
|
|
59
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
60
|
+
},
|
|
61
|
+
// Allow camelCase functions (23.2), and PascalCase functions (23.8)
|
|
62
|
+
{
|
|
63
|
+
selector: 'function',
|
|
64
|
+
format: ['camelCase', 'PascalCase'],
|
|
65
|
+
},
|
|
66
|
+
// 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
|
|
67
|
+
{
|
|
68
|
+
selector: 'typeLike',
|
|
69
|
+
format: ['PascalCase'],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
// Replace Airbnb 'comma-dangle' rule with '@typescript-eslint' version
|
|
73
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
74
|
+
// The TypeScript version also adds 3 new options, all of which should be set to the same value as the base config
|
|
75
|
+
'comma-dangle': 'off',
|
|
76
|
+
'@typescript-eslint/comma-dangle': [
|
|
77
|
+
style_1.default.rules['comma-dangle'][0],
|
|
78
|
+
Object.assign(Object.assign({}, style_1.default.rules['comma-dangle'][1]), { enums: style_1.default.rules['comma-dangle'][1].arrays, generics: style_1.default.rules['comma-dangle'][1].arrays, tuples: style_1.default.rules['comma-dangle'][1].arrays }),
|
|
79
|
+
],
|
|
80
|
+
// Replace Airbnb 'comma-spacing' rule with '@typescript-eslint' version
|
|
81
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
82
|
+
'comma-spacing': 'off',
|
|
83
|
+
'@typescript-eslint/comma-spacing': style_1.default.rules['comma-spacing'],
|
|
84
|
+
// Replace Airbnb 'default-param-last' rule with '@typescript-eslint' version
|
|
85
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
|
|
86
|
+
'default-param-last': 'off',
|
|
87
|
+
'@typescript-eslint/default-param-last': best_practices_1.default.rules['default-param-last'],
|
|
88
|
+
// Replace Airbnb 'dot-notation' rule with '@typescript-eslint' version
|
|
89
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
90
|
+
'dot-notation': 'off',
|
|
91
|
+
'@typescript-eslint/dot-notation': best_practices_1.default.rules['dot-notation'],
|
|
92
|
+
// Replace Airbnb 'func-call-spacing' rule with '@typescript-eslint' version
|
|
93
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
94
|
+
'func-call-spacing': 'off',
|
|
95
|
+
'@typescript-eslint/func-call-spacing': style_1.default.rules['func-call-spacing'],
|
|
96
|
+
// Replace Airbnb 'indent' rule with '@typescript-eslint' version
|
|
97
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
|
|
98
|
+
indent: 'off',
|
|
99
|
+
'@typescript-eslint/indent': style_1.default.rules.indent,
|
|
100
|
+
// Replace Airbnb 'keyword-spacing' rule with '@typescript-eslint' version
|
|
101
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
102
|
+
'keyword-spacing': 'off',
|
|
103
|
+
'@typescript-eslint/keyword-spacing': style_1.default.rules['keyword-spacing'],
|
|
104
|
+
// Replace Airbnb 'lines-between-class-members' rule with '@typescript-eslint' version
|
|
105
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
106
|
+
'lines-between-class-members': 'off',
|
|
107
|
+
'@typescript-eslint/lines-between-class-members': style_1.default.rules['lines-between-class-members'],
|
|
108
|
+
// Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
|
|
109
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
110
|
+
'no-array-constructor': 'off',
|
|
111
|
+
'@typescript-eslint/no-array-constructor': style_1.default.rules['no-array-constructor'],
|
|
112
|
+
// Replace Airbnb 'no-dupe-class-members' rule with '@typescript-eslint' version
|
|
113
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
|
|
114
|
+
'no-dupe-class-members': 'off',
|
|
115
|
+
'@typescript-eslint/no-dupe-class-members': es6_1.default.rules['no-dupe-class-members'],
|
|
116
|
+
// Replace Airbnb 'no-empty-function' rule with '@typescript-eslint' version
|
|
117
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
118
|
+
'no-empty-function': 'off',
|
|
119
|
+
'@typescript-eslint/no-empty-function': best_practices_1.default.rules['no-empty-function'],
|
|
120
|
+
// Replace Airbnb 'no-extra-parens' rule with '@typescript-eslint' version
|
|
121
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
|
|
122
|
+
'no-extra-parens': 'off',
|
|
123
|
+
'@typescript-eslint/no-extra-parens': errors_1.default.rules['no-extra-parens'],
|
|
124
|
+
// Replace Airbnb 'no-extra-semi' rule with '@typescript-eslint' version
|
|
125
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
126
|
+
'no-extra-semi': 'off',
|
|
127
|
+
'@typescript-eslint/no-extra-semi': errors_1.default.rules['no-extra-semi'],
|
|
128
|
+
// Replace Airbnb 'no-implied-eval' and 'no-new-func' rules with '@typescript-eslint' version
|
|
129
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
|
|
130
|
+
'no-implied-eval': 'off',
|
|
131
|
+
'no-new-func': 'off',
|
|
132
|
+
'@typescript-eslint/no-implied-eval': best_practices_1.default.rules['no-implied-eval'],
|
|
133
|
+
// Replace Airbnb 'no-loss-of-precision' rule with '@typescript-eslint' version
|
|
134
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
|
|
135
|
+
'no-loss-of-precision': 'off',
|
|
136
|
+
'@typescript-eslint/no-loss-of-precision': errors_1.default.rules['no-loss-of-precision'],
|
|
137
|
+
// Replace Airbnb 'no-loop-func' rule with '@typescript-eslint' version
|
|
138
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
|
|
139
|
+
'no-loop-func': 'off',
|
|
140
|
+
'@typescript-eslint/no-loop-func': best_practices_1.default.rules['no-loop-func'],
|
|
141
|
+
// Replace Airbnb 'no-magic-numbers' rule with '@typescript-eslint' version
|
|
142
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
|
|
143
|
+
'no-magic-numbers': 'off',
|
|
144
|
+
'@typescript-eslint/no-magic-numbers': best_practices_1.default.rules['no-magic-numbers'],
|
|
145
|
+
// Replace Airbnb 'no-redeclare' rule with '@typescript-eslint' version
|
|
146
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
147
|
+
'no-redeclare': 'off',
|
|
148
|
+
'@typescript-eslint/no-redeclare': best_practices_1.default.rules['no-redeclare'],
|
|
149
|
+
// Replace Airbnb 'no-shadow' rule with '@typescript-eslint' version
|
|
150
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
151
|
+
'no-shadow': 'off',
|
|
152
|
+
'@typescript-eslint/no-shadow': variables_1.default.rules['no-shadow'],
|
|
153
|
+
// Replace Airbnb 'space-before-blocks' rule with '@typescript-eslint' version
|
|
154
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-blocks.md
|
|
155
|
+
'space-before-blocks': 'off',
|
|
156
|
+
'@typescript-eslint/space-before-blocks': style_1.default.rules['space-before-blocks'],
|
|
157
|
+
// Replace Airbnb 'no-throw-literal' rule with '@typescript-eslint' version
|
|
158
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
159
|
+
'no-throw-literal': 'off',
|
|
160
|
+
'@typescript-eslint/no-throw-literal': best_practices_1.default.rules['no-throw-literal'],
|
|
161
|
+
// Replace Airbnb 'no-unused-expressions' rule with '@typescript-eslint' version
|
|
162
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
163
|
+
'no-unused-expressions': 'off',
|
|
164
|
+
'@typescript-eslint/no-unused-expressions': best_practices_1.default.rules['no-unused-expressions'],
|
|
165
|
+
// Replace Airbnb 'no-unused-vars' rule with '@typescript-eslint' version
|
|
166
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
167
|
+
'no-unused-vars': 'off',
|
|
168
|
+
'@typescript-eslint/no-unused-vars': variables_1.default.rules['no-unused-vars'],
|
|
169
|
+
// Replace Airbnb 'no-use-before-define' rule with '@typescript-eslint' version
|
|
170
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
|
|
171
|
+
'no-use-before-define': 'off',
|
|
172
|
+
'@typescript-eslint/no-use-before-define': variables_1.default.rules['no-use-before-define'],
|
|
173
|
+
// Replace Airbnb 'no-useless-constructor' rule with '@typescript-eslint' version
|
|
174
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
|
|
175
|
+
'no-useless-constructor': 'off',
|
|
176
|
+
'@typescript-eslint/no-useless-constructor': es6_1.default.rules['no-useless-constructor'],
|
|
177
|
+
// Replace Airbnb 'quotes' rule with '@typescript-eslint' version
|
|
178
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
|
|
179
|
+
quotes: 'off',
|
|
180
|
+
'@typescript-eslint/quotes': style_1.default.rules.quotes,
|
|
181
|
+
// Replace Airbnb 'semi' rule with '@typescript-eslint' version
|
|
182
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
183
|
+
semi: 'off',
|
|
184
|
+
'@typescript-eslint/semi': style_1.default.rules.semi,
|
|
185
|
+
// Replace Airbnb 'space-before-function-paren' rule with '@typescript-eslint' version
|
|
186
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
187
|
+
'space-before-function-paren': 'off',
|
|
188
|
+
'@typescript-eslint/space-before-function-paren': style_1.default.rules['space-before-function-paren'],
|
|
189
|
+
// Replace Airbnb 'require-await' rule with '@typescript-eslint' version
|
|
190
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
191
|
+
'require-await': 'off',
|
|
192
|
+
'@typescript-eslint/require-await': best_practices_1.default.rules['require-await'],
|
|
193
|
+
// Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
|
|
194
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
|
|
195
|
+
'no-return-await': 'off',
|
|
196
|
+
'@typescript-eslint/return-await': [best_practices_1.default.rules['no-return-await'], 'in-try-catch'],
|
|
197
|
+
// Replace Airbnb 'space-infix-ops' rule with '@typescript-eslint' version
|
|
198
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
199
|
+
'space-infix-ops': 'off',
|
|
200
|
+
'@typescript-eslint/space-infix-ops': style_1.default.rules['space-infix-ops'],
|
|
201
|
+
// Replace Airbnb 'object-curly-spacing' rule with '@typescript-eslint' version
|
|
202
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/object-curly-spacing.md
|
|
203
|
+
'object-curly-spacing': 'off',
|
|
204
|
+
'@typescript-eslint/object-curly-spacing': style_1.default.rules['object-curly-spacing'],
|
|
205
|
+
// Append 'ts' and 'tsx' to Airbnb 'import/extensions' rule
|
|
206
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
|
|
207
|
+
'import/extensions': [
|
|
208
|
+
imports_1.importConfig.rules['import/extensions'][0],
|
|
209
|
+
imports_1.importConfig.rules['import/extensions'][1],
|
|
210
|
+
Object.assign(Object.assign({}, imports_1.importConfig.rules['import/extensions'][2]), { ts: 'never', tsx: 'never' }),
|
|
211
|
+
],
|
|
212
|
+
// Append 'ts' and 'tsx' extensions to Airbnb 'import/no-extraneous-dependencies' rule
|
|
213
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
214
|
+
'import/no-extraneous-dependencies': [
|
|
215
|
+
imports_1.importConfig.rules['import/no-extraneous-dependencies'][0],
|
|
216
|
+
Object.assign(Object.assign({}, imports_1.importConfig.rules['import/no-extraneous-dependencies'][1]), { devDependencies: imports_1.importConfig.rules['import/no-extraneous-dependencies'][1].devDependencies.reduce((result, devDep) => {
|
|
217
|
+
const toAppend = [devDep];
|
|
218
|
+
const devDepWithTs = devDep.replaceAll(/\bjs(x?)\b/g, 'ts$1');
|
|
219
|
+
if (devDepWithTs !== devDep) {
|
|
220
|
+
toAppend.push(devDepWithTs);
|
|
221
|
+
}
|
|
222
|
+
return [...result, ...toAppend];
|
|
223
|
+
}, []) }),
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'airbnb/config/typescript-overrides',
|
|
229
|
+
files: ['*.ts', '*.tsx'],
|
|
230
|
+
rules: {
|
|
231
|
+
// The following rules are enabled in Airbnb config, but are already checked (more thoroughly) by the TypeScript compiler
|
|
232
|
+
// Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended-raw.ts
|
|
233
|
+
'constructor-super': 'off', // ts(2335) & ts(2377)
|
|
234
|
+
'getter-return': 'off', // ts(2378)
|
|
235
|
+
'no-class-assign': 'off', // ts(2629)
|
|
236
|
+
'no-const-assign': 'off', // ts(2588)
|
|
237
|
+
'no-dupe-args': 'off', // ts(2300)
|
|
238
|
+
'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
|
|
239
|
+
'no-dupe-keys': 'off', // ts(1117)
|
|
240
|
+
'no-func-assign': 'off', // ts(2630)
|
|
241
|
+
'no-import-assign': 'off', // ts(2632) & ts(2540)
|
|
242
|
+
'no-new-native-nonconstructor': 'off', // ts(7009)
|
|
243
|
+
'no-obj-calls': 'off', // ts(2349)
|
|
244
|
+
'no-redeclare': 'off', // ts(2451)
|
|
245
|
+
'no-setter-return': 'off', // ts(2408)
|
|
246
|
+
'no-this-before-super': 'off', // ts(2376) & ts(17009)
|
|
247
|
+
'no-undef': 'off', // ts(2304) & ts(2552)
|
|
248
|
+
'no-unreachable': 'off', // ts(7027)
|
|
249
|
+
'no-unsafe-negation': 'off', // ts(2365) & ts(2322) & ts(2358)
|
|
250
|
+
'no-with': 'off', // ts(1101) & ts(2410)
|
|
251
|
+
'valid-typeof': 'off',
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'airbnb/config/typescript-import-overrides',
|
|
256
|
+
files: ['*.ts', '*.tsx'],
|
|
257
|
+
rules: {
|
|
258
|
+
// The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
|
|
259
|
+
// See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
|
|
260
|
+
'import/named': 'off',
|
|
261
|
+
'import/no-named-as-default-member': 'off',
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
name: string;
|
|
3
|
+
rules: {
|
|
4
|
+
'init-declarations': "off";
|
|
5
|
+
'no-catch-shadow': "off";
|
|
6
|
+
'no-delete-var': "error";
|
|
7
|
+
'no-label-var': "error";
|
|
8
|
+
'no-restricted-globals': ["error", {
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}, {
|
|
12
|
+
name: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}, ...{
|
|
15
|
+
name: "self" | "location" | "external" | "addEventListener" | "blur" | "close" | "closed" | "confirm" | "defaultStatus" | "defaultstatus" | "event" | "find" | "focus" | "frameElement" | "frames" | "history" | "innerHeight" | "innerWidth" | "length" | "locationbar" | "menubar" | "moveBy" | "moveTo" | "name" | "onblur" | "onerror" | "onfocus" | "onload" | "onresize" | "onunload" | "open" | "opener" | "opera" | "outerHeight" | "outerWidth" | "pageXOffset" | "pageYOffset" | "parent" | "print" | "removeEventListener" | "resizeBy" | "resizeTo" | "screen" | "screenLeft" | "screenTop" | "screenX" | "screenY" | "scroll" | "scrollbars" | "scrollBy" | "scrollTo" | "scrollX" | "scrollY" | "status" | "statusbar" | "stop" | "toolbar" | "top";
|
|
16
|
+
message: string;
|
|
17
|
+
}[]];
|
|
18
|
+
'no-shadow': "error";
|
|
19
|
+
'no-shadow-restricted-names': "error";
|
|
20
|
+
'no-undef': "error";
|
|
21
|
+
'no-undef-init': "error";
|
|
22
|
+
'no-undefined': "off";
|
|
23
|
+
'no-unused-vars': ["error", {
|
|
24
|
+
vars: string;
|
|
25
|
+
args: string;
|
|
26
|
+
ignoreRestSiblings: boolean;
|
|
27
|
+
}];
|
|
28
|
+
'no-use-before-define': ["error", {
|
|
29
|
+
functions: boolean;
|
|
30
|
+
classes: boolean;
|
|
31
|
+
variables: boolean;
|
|
32
|
+
}];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
exports.default = {
|
|
8
|
+
name: 'airbnb/config/variables',
|
|
9
|
+
rules: {
|
|
10
|
+
// enforce or disallow variable initializations at definition
|
|
11
|
+
'init-declarations': 'off',
|
|
12
|
+
// disallow the catch clause parameter name being the same as a variable in the outer scope
|
|
13
|
+
'no-catch-shadow': 'off',
|
|
14
|
+
// disallow deletion of variables
|
|
15
|
+
'no-delete-var': 'error',
|
|
16
|
+
// disallow labels that share a name with a variable
|
|
17
|
+
// https://eslint.org/docs/rules/no-label-var
|
|
18
|
+
'no-label-var': 'error',
|
|
19
|
+
// disallow specific globals
|
|
20
|
+
'no-restricted-globals': [
|
|
21
|
+
'error',
|
|
22
|
+
{
|
|
23
|
+
name: 'isFinite',
|
|
24
|
+
message: 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'isNaN',
|
|
28
|
+
message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
29
|
+
},
|
|
30
|
+
...confusing_browser_globals_1.default.map((g) => ({
|
|
31
|
+
name: g,
|
|
32
|
+
message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
|
|
33
|
+
})),
|
|
34
|
+
],
|
|
35
|
+
// disallow declaration of variables already declared in the outer scope
|
|
36
|
+
'no-shadow': 'error',
|
|
37
|
+
// disallow shadowing of names such as arguments
|
|
38
|
+
'no-shadow-restricted-names': 'error',
|
|
39
|
+
// disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
40
|
+
'no-undef': 'error',
|
|
41
|
+
// disallow use of undefined when initializing variables
|
|
42
|
+
'no-undef-init': 'error',
|
|
43
|
+
// disallow use of undefined variable
|
|
44
|
+
// https://eslint.org/docs/rules/no-undefined
|
|
45
|
+
'no-undefined': 'off',
|
|
46
|
+
// disallow declaration of variables that are not used in the code
|
|
47
|
+
'no-unused-vars': [
|
|
48
|
+
'error',
|
|
49
|
+
{
|
|
50
|
+
vars: 'all',
|
|
51
|
+
args: 'after-used',
|
|
52
|
+
ignoreRestSiblings: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
// disallow use of variables before they are defined
|
|
56
|
+
'no-use-before-define': [
|
|
57
|
+
'error',
|
|
58
|
+
{
|
|
59
|
+
functions: true,
|
|
60
|
+
classes: true,
|
|
61
|
+
variables: true,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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_1 = __importDefault(require("../rules/typescript"));
|
|
7
|
+
exports.default = {
|
|
8
|
+
typescript: typescript_1.default,
|
|
9
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const typescript_1 = __importStar(require("../rules/typescript"));
|
|
37
|
+
exports.default = {
|
|
38
|
+
base: typescript_1.default,
|
|
39
|
+
react: [
|
|
40
|
+
...typescript_1.default,
|
|
41
|
+
{
|
|
42
|
+
name: 'airbnb/config/typescript-react',
|
|
43
|
+
settings: {
|
|
44
|
+
// Append 'tsx' extensions to Airbnb 'import/resolver' setting
|
|
45
|
+
'import/resolver': {
|
|
46
|
+
node: {
|
|
47
|
+
extensions: [...typescript_1.importResolverExtensions, '.tsx'],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
// Append 'tsx' to Airbnb 'react/jsx-filename-extension' rule
|
|
53
|
+
'react/jsx-filename-extension': [
|
|
54
|
+
'error',
|
|
55
|
+
{
|
|
56
|
+
extensions: ['.jsx', '.tsx'],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-airbnb-extended",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Eslint Airbnb Config Extended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -37,16 +37,14 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
39
39
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
40
|
-
"eslint": "^9.
|
|
40
|
+
"eslint": "^9.24.0",
|
|
41
41
|
"eslint-plugin-import": "^2.31.0",
|
|
42
42
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
43
|
-
"eslint-plugin-react": "^7.37.
|
|
43
|
+
"eslint-plugin-react": "^7.37.5",
|
|
44
44
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
45
|
-
"
|
|
46
|
-
"tsconfig-paths": "^4.2.0",
|
|
45
|
+
"tsc-alias": "^1.8.13",
|
|
47
46
|
"typescript": "^5.8.2",
|
|
48
|
-
"typescript-eslint": "^8.29.0"
|
|
49
|
-
"typescript-transform-paths": "^3.5.5"
|
|
47
|
+
"typescript-eslint": "^8.29.0"
|
|
50
48
|
},
|
|
51
49
|
"peerDependencies": {
|
|
52
50
|
"eslint": "9.x",
|
|
@@ -72,6 +70,7 @@
|
|
|
72
70
|
},
|
|
73
71
|
"scripts": {
|
|
74
72
|
"build": "tsc",
|
|
73
|
+
"postbuild": "tsc-alias",
|
|
75
74
|
"typecheck": "tsc --noEmit"
|
|
76
75
|
}
|
|
77
76
|
}
|
package/CHANGELOG.md
DELETED
package/base/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import bestPractices from '@/rules/best-practices';
|
|
2
|
-
import errors from '@/rules/errors';
|
|
3
|
-
import es6 from '@/rules/es6';
|
|
4
|
-
import imports from '@/rules/imports';
|
|
5
|
-
import node from '@/rules/node';
|
|
6
|
-
import strict from '@/rules/strict';
|
|
7
|
-
import style from '@/rules/style';
|
|
8
|
-
import variables from '@/rules/variables';
|
|
9
|
-
|
|
10
|
-
import type { Linter } from 'eslint';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
bestPractices,
|
|
14
|
-
errors,
|
|
15
|
-
es6,
|
|
16
|
-
imports,
|
|
17
|
-
node,
|
|
18
|
-
strict,
|
|
19
|
-
style,
|
|
20
|
-
variables,
|
|
21
|
-
} satisfies Record<string, Linter.Config>;
|
package/base/recommended.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import base from '@/base';
|
|
2
|
-
|
|
3
|
-
import type { Linter } from 'eslint';
|
|
4
|
-
|
|
5
|
-
export default [
|
|
6
|
-
...Object.values(base),
|
|
7
|
-
{
|
|
8
|
-
name: 'airbnb/config/language-configurations',
|
|
9
|
-
languageOptions: {
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaVersion: 2018,
|
|
12
|
-
sourceType: 'module',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
rules: {},
|
|
16
|
-
},
|
|
17
|
-
] satisfies Linter.Config[];
|
package/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import base from '@/base';
|
|
2
|
-
import baseRecommended from '@/base/recommended';
|
|
3
|
-
import react from '@/react';
|
|
4
|
-
import reactRecommended from '@/react/recommended';
|
|
5
|
-
import typescript from '@/typescript';
|
|
6
|
-
import typescriptRecommended from '@/typescript/recommended';
|
|
7
|
-
|
|
8
|
-
export const rules = {
|
|
9
|
-
react,
|
|
10
|
-
base,
|
|
11
|
-
typescript,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const configs = {
|
|
15
|
-
base: {
|
|
16
|
-
recommended: baseRecommended,
|
|
17
|
-
'typescript-only': typescriptRecommended.base,
|
|
18
|
-
typescript: [...baseRecommended, ...typescriptRecommended.base],
|
|
19
|
-
},
|
|
20
|
-
react: {
|
|
21
|
-
recommended: reactRecommended,
|
|
22
|
-
'typescript-only': typescriptRecommended.react,
|
|
23
|
-
typescript: [...reactRecommended, ...typescriptRecommended.react],
|
|
24
|
-
},
|
|
25
|
-
};
|
package/react/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import react from '@/rules/react';
|
|
2
|
-
import reactA11y from '@/rules/react-a11y';
|
|
3
|
-
import reactHooks from '@/rules/react-hooks';
|
|
4
|
-
|
|
5
|
-
import type { Linter } from 'eslint';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
react,
|
|
9
|
-
reactA11y,
|
|
10
|
-
reactHooks,
|
|
11
|
-
} satisfies Record<string, Linter.Config>;
|