eslint-config-airbnb-extended 0.0.9 → 0.1.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/base/index.ts +21 -0
  3. package/base/recommended.ts +17 -0
  4. package/index.ts +25 -0
  5. package/package.json +12 -31
  6. package/react/index.ts +11 -0
  7. package/react/recommended.ts +6 -0
  8. package/rules/best-practices.ts +462 -0
  9. package/rules/errors.ts +199 -0
  10. package/rules/es6.ts +224 -0
  11. package/rules/imports.ts +308 -0
  12. package/rules/node.ts +49 -0
  13. package/rules/react-a11y.ts +295 -0
  14. package/rules/react-hooks.ts +26 -0
  15. package/rules/react.ts +692 -0
  16. package/rules/strict.ts +9 -0
  17. package/rules/style.ts +632 -0
  18. package/rules/typescript.ts +312 -0
  19. package/rules/variables.ts +76 -0
  20. package/tsconfig.json +22 -0
  21. package/typescript/index.ts +7 -0
  22. package/typescript/recommended.ts +30 -0
  23. package/README.md +0 -1
  24. package/dist/base/index.d.ts +0 -841
  25. package/dist/base/index.js +0 -23
  26. package/dist/base/recommended.d.ts +0 -2
  27. package/dist/base/recommended.js +0 -19
  28. package/dist/index.d.ts +0 -2654
  29. package/dist/index.js +0 -29
  30. package/dist/react/index.d.ts +0 -1798
  31. package/dist/react/index.js +0 -13
  32. package/dist/react/recommended.d.ts +0 -2
  33. package/dist/react/recommended.js +0 -8
  34. package/dist/rules/best-practices.d.ts +0 -177
  35. package/dist/rules/best-practices.js +0 -379
  36. package/dist/rules/errors.d.ts +0 -69
  37. package/dist/rules/errors.js +0 -151
  38. package/dist/rules/es6.d.ts +0 -146
  39. package/dist/rules/es6.js +0 -192
  40. package/dist/rules/imports.d.ts +0 -157
  41. package/dist/rules/imports.js +0 -256
  42. package/dist/rules/node.d.ts +0 -90
  43. package/dist/rules/node.js +0 -39
  44. package/dist/rules/react-a11y.d.ts +0 -117
  45. package/dist/rules/react-a11y.js +0 -255
  46. package/dist/rules/react-hooks.d.ts +0 -19
  47. package/dist/rules/react-hooks.js +0 -57
  48. package/dist/rules/react.d.ts +0 -1664
  49. package/dist/rules/react.js +0 -586
  50. package/dist/rules/strict.d.ts +0 -7
  51. package/dist/rules/strict.js +0 -9
  52. package/dist/rules/style.d.ts +0 -320
  53. package/dist/rules/style.js +0 -530
  54. package/dist/rules/typescript.d.ts +0 -4
  55. package/dist/rules/typescript.js +0 -264
  56. package/dist/rules/variables.d.ts +0 -35
  57. package/dist/rules/variables.js +0 -65
  58. package/dist/typescript/index.d.ts +0 -5
  59. package/dist/typescript/index.js +0 -9
  60. package/dist/typescript/recommended.d.ts +0 -6
  61. package/dist/typescript/recommended.js +0 -62
  62. package/dist/utils/index.d.ts +0 -1
  63. package/dist/utils/index.js +0 -4
@@ -0,0 +1,312 @@
1
+ import { parser, plugin } from 'typescript-eslint';
2
+
3
+ import bestPractices from '@/rules/best-practices';
4
+ import errors from '@/rules/errors';
5
+ import es6 from '@/rules/es6';
6
+ import { importConfig } from '@/rules/imports';
7
+ import style from '@/rules/style';
8
+ import variables from '@/rules/variables';
9
+
10
+ import type { Linter } from 'eslint';
11
+
12
+ export const importResolverExtensions = [
13
+ ...importConfig.settings['import/resolver'].node.extensions,
14
+ '.ts',
15
+ '.cts',
16
+ '.mts',
17
+ '.d.ts',
18
+ ];
19
+
20
+ export default [
21
+ {
22
+ name: 'airbnb/config/typescript',
23
+ plugins: {
24
+ '@typescript-eslint': plugin,
25
+ },
26
+ languageOptions: {
27
+ parser,
28
+ parserOptions: {
29
+ projectService: true,
30
+ },
31
+ },
32
+ settings: {
33
+ // Append 'ts' extensions to Airbnb 'import/resolver' setting
34
+ 'import/resolver': {
35
+ node: {
36
+ extensions: importResolverExtensions,
37
+ },
38
+ },
39
+ // Append 'ts' extensions to Airbnb 'import/extensions' setting
40
+ 'import/extensions': [...importConfig.settings['import/extensions'], '.ts', '.tsx', '.d.ts'],
41
+ // Resolve type definition packages
42
+ 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
43
+ },
44
+ rules: {
45
+ // Replace Airbnb 'brace-style' rule with '@typescript-eslint' version
46
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
47
+ 'brace-style': 'off',
48
+ '@typescript-eslint/brace-style': style.rules['brace-style'],
49
+
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
+
73
+ // Replace Airbnb 'comma-dangle' rule with '@typescript-eslint' version
74
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
75
+ // The TypeScript version also adds 3 new options, all of which should be set to the same value as the base config
76
+ 'comma-dangle': 'off',
77
+ '@typescript-eslint/comma-dangle': [
78
+ style.rules['comma-dangle'][0],
79
+ {
80
+ ...style.rules['comma-dangle'][1],
81
+ enums: style.rules['comma-dangle'][1].arrays,
82
+ generics: style.rules['comma-dangle'][1].arrays,
83
+ tuples: style.rules['comma-dangle'][1].arrays,
84
+ },
85
+ ],
86
+
87
+ // Replace Airbnb 'comma-spacing' rule with '@typescript-eslint' version
88
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
89
+ 'comma-spacing': 'off',
90
+ '@typescript-eslint/comma-spacing': style.rules['comma-spacing'],
91
+
92
+ // Replace Airbnb 'default-param-last' rule with '@typescript-eslint' version
93
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
94
+ 'default-param-last': 'off',
95
+ '@typescript-eslint/default-param-last': bestPractices.rules['default-param-last'],
96
+
97
+ // Replace Airbnb 'dot-notation' rule with '@typescript-eslint' version
98
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
99
+ 'dot-notation': 'off',
100
+ '@typescript-eslint/dot-notation': bestPractices.rules['dot-notation'],
101
+
102
+ // Replace Airbnb 'func-call-spacing' rule with '@typescript-eslint' version
103
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
104
+ 'func-call-spacing': 'off',
105
+ '@typescript-eslint/func-call-spacing': style.rules['func-call-spacing'],
106
+
107
+ // Replace Airbnb 'indent' rule with '@typescript-eslint' version
108
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
109
+ indent: 'off',
110
+ '@typescript-eslint/indent': style.rules.indent,
111
+
112
+ // Replace Airbnb 'keyword-spacing' rule with '@typescript-eslint' version
113
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
114
+ 'keyword-spacing': 'off',
115
+ '@typescript-eslint/keyword-spacing': style.rules['keyword-spacing'],
116
+
117
+ // Replace Airbnb 'lines-between-class-members' rule with '@typescript-eslint' version
118
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
119
+ 'lines-between-class-members': 'off',
120
+ '@typescript-eslint/lines-between-class-members': style.rules['lines-between-class-members'],
121
+
122
+ // Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
123
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
124
+ 'no-array-constructor': 'off',
125
+ '@typescript-eslint/no-array-constructor': style.rules['no-array-constructor'],
126
+
127
+ // Replace Airbnb 'no-dupe-class-members' rule with '@typescript-eslint' version
128
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
129
+ 'no-dupe-class-members': 'off',
130
+ '@typescript-eslint/no-dupe-class-members': es6.rules['no-dupe-class-members'],
131
+
132
+ // Replace Airbnb 'no-empty-function' rule with '@typescript-eslint' version
133
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
134
+ 'no-empty-function': 'off',
135
+ '@typescript-eslint/no-empty-function': bestPractices.rules['no-empty-function'],
136
+
137
+ // Replace Airbnb 'no-extra-parens' rule with '@typescript-eslint' version
138
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
139
+ 'no-extra-parens': 'off',
140
+ '@typescript-eslint/no-extra-parens': errors.rules['no-extra-parens'],
141
+
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
+ 'no-extra-semi': 'off',
145
+ '@typescript-eslint/no-extra-semi': errors.rules['no-extra-semi'],
146
+
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': bestPractices.rules['no-implied-eval'],
152
+
153
+ // Replace Airbnb 'no-loss-of-precision' rule with '@typescript-eslint' version
154
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
155
+ 'no-loss-of-precision': 'off',
156
+ '@typescript-eslint/no-loss-of-precision': errors.rules['no-loss-of-precision'],
157
+
158
+ // Replace Airbnb 'no-loop-func' rule with '@typescript-eslint' version
159
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
160
+ 'no-loop-func': 'off',
161
+ '@typescript-eslint/no-loop-func': bestPractices.rules['no-loop-func'],
162
+
163
+ // Replace Airbnb 'no-magic-numbers' rule with '@typescript-eslint' version
164
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
165
+ 'no-magic-numbers': 'off',
166
+ '@typescript-eslint/no-magic-numbers': bestPractices.rules['no-magic-numbers'],
167
+
168
+ // Replace Airbnb 'no-redeclare' rule with '@typescript-eslint' version
169
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
170
+ 'no-redeclare': 'off',
171
+ '@typescript-eslint/no-redeclare': bestPractices.rules['no-redeclare'],
172
+
173
+ // Replace Airbnb 'no-shadow' rule with '@typescript-eslint' version
174
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
175
+ 'no-shadow': 'off',
176
+ '@typescript-eslint/no-shadow': variables.rules['no-shadow'],
177
+
178
+ // Replace Airbnb 'space-before-blocks' rule with '@typescript-eslint' version
179
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-blocks.md
180
+ 'space-before-blocks': 'off',
181
+ '@typescript-eslint/space-before-blocks': style.rules['space-before-blocks'],
182
+
183
+ // Replace Airbnb 'no-throw-literal' rule with '@typescript-eslint' version
184
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
185
+ 'no-throw-literal': 'off',
186
+ '@typescript-eslint/no-throw-literal': bestPractices.rules['no-throw-literal'],
187
+
188
+ // Replace Airbnb 'no-unused-expressions' rule with '@typescript-eslint' version
189
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
190
+ 'no-unused-expressions': 'off',
191
+ '@typescript-eslint/no-unused-expressions': bestPractices.rules['no-unused-expressions'],
192
+
193
+ // Replace Airbnb 'no-unused-vars' rule with '@typescript-eslint' version
194
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
195
+ 'no-unused-vars': 'off',
196
+ '@typescript-eslint/no-unused-vars': variables.rules['no-unused-vars'],
197
+
198
+ // Replace Airbnb 'no-use-before-define' rule with '@typescript-eslint' version
199
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
200
+ 'no-use-before-define': 'off',
201
+ '@typescript-eslint/no-use-before-define': variables.rules['no-use-before-define'],
202
+
203
+ // Replace Airbnb 'no-useless-constructor' rule with '@typescript-eslint' version
204
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
205
+ 'no-useless-constructor': 'off',
206
+ '@typescript-eslint/no-useless-constructor': es6.rules['no-useless-constructor'],
207
+
208
+ // Replace Airbnb 'quotes' rule with '@typescript-eslint' version
209
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
210
+ quotes: 'off',
211
+ '@typescript-eslint/quotes': style.rules.quotes,
212
+
213
+ // Replace Airbnb 'semi' rule with '@typescript-eslint' version
214
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
215
+ semi: 'off',
216
+ '@typescript-eslint/semi': style.rules.semi,
217
+
218
+ // Replace Airbnb 'space-before-function-paren' rule with '@typescript-eslint' version
219
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
220
+ 'space-before-function-paren': 'off',
221
+ '@typescript-eslint/space-before-function-paren': style.rules['space-before-function-paren'],
222
+
223
+ // Replace Airbnb 'require-await' rule with '@typescript-eslint' version
224
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
225
+ 'require-await': 'off',
226
+ '@typescript-eslint/require-await': bestPractices.rules['require-await'],
227
+
228
+ // Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
229
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
230
+ 'no-return-await': 'off',
231
+ '@typescript-eslint/return-await': [bestPractices.rules['no-return-await'], 'in-try-catch'],
232
+
233
+ // Replace Airbnb 'space-infix-ops' rule with '@typescript-eslint' version
234
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
235
+ 'space-infix-ops': 'off',
236
+ '@typescript-eslint/space-infix-ops': style.rules['space-infix-ops'],
237
+
238
+ // Replace Airbnb 'object-curly-spacing' rule with '@typescript-eslint' version
239
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/object-curly-spacing.md
240
+ 'object-curly-spacing': 'off',
241
+ '@typescript-eslint/object-curly-spacing': style.rules['object-curly-spacing'],
242
+
243
+ // Append 'ts' and 'tsx' to Airbnb 'import/extensions' rule
244
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
245
+ 'import/extensions': [
246
+ importConfig.rules['import/extensions'][0],
247
+ importConfig.rules['import/extensions'][1],
248
+ {
249
+ ...importConfig.rules['import/extensions'][2],
250
+ ts: 'never',
251
+ tsx: 'never',
252
+ },
253
+ ],
254
+
255
+ // Append 'ts' and 'tsx' extensions to Airbnb 'import/no-extraneous-dependencies' rule
256
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
257
+ 'import/no-extraneous-dependencies': [
258
+ importConfig.rules['import/no-extraneous-dependencies'][0],
259
+ {
260
+ ...importConfig.rules['import/no-extraneous-dependencies'][1],
261
+ devDependencies: importConfig.rules[
262
+ 'import/no-extraneous-dependencies'
263
+ ][1].devDependencies.reduce<string[]>((result, devDep) => {
264
+ const toAppend = [devDep];
265
+ const devDepWithTs = devDep.replaceAll(/\bjs(x?)\b/g, 'ts$1');
266
+ if (devDepWithTs !== devDep) {
267
+ toAppend.push(devDepWithTs);
268
+ }
269
+ return [...result, ...toAppend];
270
+ }, []),
271
+ },
272
+ ],
273
+ },
274
+ },
275
+ {
276
+ name: 'airbnb/config/typescript-overrides',
277
+ files: ['*.ts', '*.tsx'],
278
+ rules: {
279
+ // The following rules are enabled in Airbnb config, but are already checked (more thoroughly) by the TypeScript compiler
280
+ // Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended-raw.ts
281
+ 'constructor-super': 'off', // ts(2335) & ts(2377)
282
+ 'getter-return': 'off', // ts(2378)
283
+ 'no-class-assign': 'off', // ts(2629)
284
+ 'no-const-assign': 'off', // ts(2588)
285
+ 'no-dupe-args': 'off', // ts(2300)
286
+ 'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
287
+ 'no-dupe-keys': 'off', // ts(1117)
288
+ 'no-func-assign': 'off', // ts(2630)
289
+ 'no-import-assign': 'off', // ts(2632) & ts(2540)
290
+ 'no-new-native-nonconstructor': 'off', // ts(7009)
291
+ 'no-obj-calls': 'off', // ts(2349)
292
+ 'no-redeclare': 'off', // ts(2451)
293
+ 'no-setter-return': 'off', // ts(2408)
294
+ 'no-this-before-super': 'off', // ts(2376) & ts(17009)
295
+ 'no-undef': 'off', // ts(2304) & ts(2552)
296
+ 'no-unreachable': 'off', // ts(7027)
297
+ 'no-unsafe-negation': 'off', // ts(2365) & ts(2322) & ts(2358)
298
+ 'no-with': 'off', // ts(1101) & ts(2410)
299
+ 'valid-typeof': 'off',
300
+ },
301
+ },
302
+ {
303
+ name: 'airbnb/config/typescript-import-overrides',
304
+ files: ['*.ts', '*.tsx'],
305
+ rules: {
306
+ // The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
307
+ // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
308
+ 'import/named': 'off',
309
+ 'import/no-named-as-default-member': 'off',
310
+ },
311
+ },
312
+ ] as Linter.Config[];
@@ -0,0 +1,76 @@
1
+ import confusingBrowserGlobals from 'confusing-browser-globals';
2
+
3
+ import type { Linter } from 'eslint';
4
+
5
+ export default {
6
+ name: 'airbnb/config/variables',
7
+ rules: {
8
+ // enforce or disallow variable initializations at definition
9
+ 'init-declarations': 'off',
10
+
11
+ // disallow the catch clause parameter name being the same as a variable in the outer scope
12
+ 'no-catch-shadow': 'off',
13
+
14
+ // disallow deletion of variables
15
+ 'no-delete-var': 'error',
16
+
17
+ // disallow labels that share a name with a variable
18
+ // https://eslint.org/docs/rules/no-label-var
19
+ 'no-label-var': 'error',
20
+
21
+ // disallow specific globals
22
+ 'no-restricted-globals': [
23
+ 'error',
24
+ {
25
+ name: 'isFinite',
26
+ message:
27
+ 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
28
+ },
29
+ {
30
+ name: 'isNaN',
31
+ message:
32
+ 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
33
+ },
34
+ ...confusingBrowserGlobals.map((g) => ({
35
+ name: g,
36
+ message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
37
+ })),
38
+ ],
39
+
40
+ // disallow declaration of variables already declared in the outer scope
41
+ 'no-shadow': 'error',
42
+
43
+ // disallow shadowing of names such as arguments
44
+ 'no-shadow-restricted-names': 'error',
45
+
46
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
47
+ 'no-undef': 'error',
48
+
49
+ // disallow use of undefined when initializing variables
50
+ 'no-undef-init': 'error',
51
+
52
+ // disallow use of undefined variable
53
+ // https://eslint.org/docs/rules/no-undefined
54
+ 'no-undefined': 'off',
55
+
56
+ // disallow declaration of variables that are not used in the code
57
+ 'no-unused-vars': [
58
+ 'error',
59
+ {
60
+ vars: 'all',
61
+ args: 'after-used',
62
+ ignoreRestSiblings: true,
63
+ },
64
+ ],
65
+
66
+ // disallow use of variables before they are defined
67
+ 'no-use-before-define': [
68
+ 'error',
69
+ {
70
+ functions: true,
71
+ classes: true,
72
+ variables: true,
73
+ },
74
+ ],
75
+ },
76
+ } satisfies Linter.Config;
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "skipLibCheck": true,
5
+ "outDir": "./dist",
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@/*": ["./*"]
9
+ },
10
+ "plugins": [
11
+ {
12
+ "transform": "typescript-transform-paths"
13
+ },
14
+ {
15
+ "transform": "typescript-transform-paths",
16
+ "afterDeclarations": true
17
+ }
18
+ ]
19
+ },
20
+ "include": ["**/*.ts", "**/*.tsx", "**/*.mjs", "**/*.mts"],
21
+ "exclude": ["node_modules", "dist"]
22
+ }
@@ -0,0 +1,7 @@
1
+ import typescript from '@/rules/typescript';
2
+
3
+ import type { Linter } from 'eslint';
4
+
5
+ export default {
6
+ typescript,
7
+ } satisfies Record<string, Linter.Config[]>;
@@ -0,0 +1,30 @@
1
+ import typescript, { importResolverExtensions } from '@/rules/typescript';
2
+
3
+ import type { Linter } from 'eslint';
4
+
5
+ export default {
6
+ base: typescript,
7
+ react: [
8
+ ...typescript,
9
+ {
10
+ name: 'airbnb/config/typescript-react',
11
+ settings: {
12
+ // Append 'tsx' extensions to Airbnb 'import/resolver' setting
13
+ 'import/resolver': {
14
+ node: {
15
+ extensions: [...importResolverExtensions, '.tsx'],
16
+ },
17
+ },
18
+ },
19
+ rules: {
20
+ // Append 'tsx' to Airbnb 'react/jsx-filename-extension' rule
21
+ 'react/jsx-filename-extension': [
22
+ 'error',
23
+ {
24
+ extensions: ['.jsx', '.tsx'],
25
+ },
26
+ ],
27
+ },
28
+ },
29
+ ],
30
+ } satisfies Record<string, Linter.Config[]>;
package/README.md DELETED
@@ -1 +0,0 @@
1
- WIP