eslint-config-airbnb-extended 0.10.2 → 0.11.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.
- package/README.md +1 -0
- package/dist/@types/index.d.ts +2 -2
- package/dist/configs/base/typescript.js +2 -0
- package/dist/configs/typescript/configExtended.js +9 -0
- package/dist/plugins/index.js +3 -3
- package/dist/rules/best-practices.js +1 -9
- package/dist/rules/es6.js +1 -7
- package/dist/rules/index.js +1 -1
- package/dist/rules/typescript/typescriptEslint.js +426 -55
- package/dist/rules/typescript/typescriptEslintStrict.js +231 -0
- package/dist/rules/variables.js +2 -1
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ The configuration may change over time, and `create-airbnb-x-config` will always
|
|
|
37
37
|
|
|
38
38
|
This configuration relies on the following essential packages:
|
|
39
39
|
|
|
40
|
+
- **`@stylistic/eslint-plugin`**: Ensures fine-tuned styling rules for code formatting.
|
|
40
41
|
- **`eslint-import-x`**: A powerful tool for managing and validating imports.
|
|
41
42
|
- **`eslint-plugin-n`**: Enforces best practices for Node.js.
|
|
42
43
|
- **`eslint-plugin-react`**: Enforces React-specific linting rules and best practices.
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const rules: {
|
|
|
6
6
|
readonly node: Record<"globals" | "base" | "promises" | "noUnsupportedFeatures", import("eslint").Linter.Config>;
|
|
7
7
|
readonly react: Record<"strict" | "stylistic" | "base" | "jsxA11y" | "hooks", import("eslint").Linter.Config>;
|
|
8
8
|
readonly next: Record<"base" | "coreWebVitals", import("eslint").Linter.Config>;
|
|
9
|
-
readonly typescript: Record<"imports" | "stylistic" | "stylisticPlus" | "base" | "typescriptEslint", import("eslint").Linter.Config>;
|
|
9
|
+
readonly typescript: Record<"imports" | "stylistic" | "stylisticPlus" | "base" | "typescriptEslint" | "typescriptEslintStrict", import("eslint").Linter.Config>;
|
|
10
10
|
};
|
|
11
11
|
export declare const configs: {
|
|
12
12
|
readonly base: Record<"all" | "typescript" | "recommended", import("eslint").Linter.Config[]>;
|
|
@@ -15,6 +15,7 @@ export declare const configs: {
|
|
|
15
15
|
readonly node: Record<"recommended", import("eslint").Linter.Config[]>;
|
|
16
16
|
};
|
|
17
17
|
export declare const plugins: {
|
|
18
|
+
readonly stylistic: import("eslint").Linter.Config;
|
|
18
19
|
readonly importX: import("eslint").Linter.Config;
|
|
19
20
|
readonly node: import("eslint").Linter.Config;
|
|
20
21
|
readonly react: import("eslint").Linter.Config;
|
|
@@ -22,5 +23,4 @@ export declare const plugins: {
|
|
|
22
23
|
readonly reactHooks: import("eslint").Linter.Config;
|
|
23
24
|
readonly next: import("eslint").Linter.Config;
|
|
24
25
|
readonly typescriptEslint: import("eslint").Linter.Config;
|
|
25
|
-
readonly stylistic: import("eslint").Linter.Config;
|
|
26
26
|
};
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const eslint_import_resolver_typescript_1 = require("eslint-import-resolver-typescript");
|
|
7
|
+
const typescript_eslint_1 = require("typescript-eslint");
|
|
7
8
|
const config_1 = __importDefault(require("../../configs/typescript/config"));
|
|
8
9
|
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
9
10
|
const baseTypescriptConfig = [
|
|
@@ -20,5 +21,6 @@ const baseTypescriptConfig = [
|
|
|
20
21
|
},
|
|
21
22
|
},
|
|
22
23
|
Object.assign({ name: 'airbnb/config/base-typescript-disable-legacy-stylistic-ts-config' }, (0, getStylisticLegacyConfig_1.default)('typescript')),
|
|
24
|
+
Object.assign(Object.assign({}, typescript_eslint_1.configs.disableTypeChecked), { name: 'airbnb/config/base-typescript-disable-type-checked', files: ['**/*.{js,cjs,mjs}'] }),
|
|
23
25
|
];
|
|
24
26
|
exports.default = baseTypescriptConfig;
|
|
@@ -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 config_1 = __importDefault(require("../../configs/typescript/config"));
|
|
7
|
+
const typescriptEslintStrict_1 = __importDefault(require("../../rules/typescript/typescriptEslintStrict"));
|
|
8
|
+
const typescriptConfigExtended = Object.assign(Object.assign({}, config_1.default), { typescriptEslintStrict: typescriptEslintStrict_1.default });
|
|
9
|
+
exports.default = typescriptConfigExtended;
|
package/dist/plugins/index.js
CHANGED
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
* as is given due to less size of index.d.ts
|
|
6
6
|
*/
|
|
7
7
|
const plugins = {
|
|
8
|
+
get stylistic() {
|
|
9
|
+
return require('../plugins/stylisticPlugin').default;
|
|
10
|
+
},
|
|
8
11
|
get importX() {
|
|
9
12
|
return require('../plugins/importXPlugin').default;
|
|
10
13
|
},
|
|
@@ -26,8 +29,5 @@ const plugins = {
|
|
|
26
29
|
get typescriptEslint() {
|
|
27
30
|
return require('../plugins/typescriptEslintPlugin').default;
|
|
28
31
|
},
|
|
29
|
-
get stylistic() {
|
|
30
|
-
return require('../plugins/stylisticPlugin').default;
|
|
31
|
-
},
|
|
32
32
|
};
|
|
33
33
|
exports.default = plugins;
|
|
@@ -176,15 +176,7 @@ const bestPracticesRules = {
|
|
|
176
176
|
'no-loop-func': 'error',
|
|
177
177
|
// disallow magic numbers
|
|
178
178
|
// https://eslint.org/docs/rules/no-magic-numbers
|
|
179
|
-
'no-magic-numbers':
|
|
180
|
-
'off',
|
|
181
|
-
{
|
|
182
|
-
ignore: [],
|
|
183
|
-
ignoreArrayIndexes: true,
|
|
184
|
-
enforceConst: true,
|
|
185
|
-
detectObjects: false,
|
|
186
|
-
},
|
|
187
|
-
],
|
|
179
|
+
'no-magic-numbers': 'off',
|
|
188
180
|
// disallow use of multiline strings
|
|
189
181
|
// https://eslint.org/docs/rules/no-multi-str
|
|
190
182
|
'no-multi-str': 'error',
|
package/dist/rules/es6.js
CHANGED
|
@@ -55,13 +55,7 @@ const es6Rules = {
|
|
|
55
55
|
],
|
|
56
56
|
// disallow specific imports
|
|
57
57
|
// https://eslint.org/docs/rules/no-restricted-imports
|
|
58
|
-
'no-restricted-imports':
|
|
59
|
-
'off',
|
|
60
|
-
{
|
|
61
|
-
paths: [],
|
|
62
|
-
patterns: [],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
58
|
+
'no-restricted-imports': 'off',
|
|
65
59
|
// disallow to use this/super before super() calling in constructors.
|
|
66
60
|
// https://eslint.org/docs/rules/no-this-before-super
|
|
67
61
|
'no-this-before-super': 'error',
|
package/dist/rules/index.js
CHANGED
|
@@ -18,7 +18,7 @@ const rules = {
|
|
|
18
18
|
return require('../configs/next/config').default;
|
|
19
19
|
},
|
|
20
20
|
get typescript() {
|
|
21
|
-
return require('../configs/typescript/
|
|
21
|
+
return require('../configs/typescript/configExtended').default;
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
exports.default = rules;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deprecatedTypescriptEslintRules = void 0;
|
|
6
7
|
const best_practices_1 = __importDefault(require("../../rules/best-practices"));
|
|
7
8
|
const es6_1 = __importDefault(require("../../rules/es6"));
|
|
8
9
|
const style_1 = __importDefault(require("../../rules/style"));
|
|
@@ -15,97 +16,467 @@ const typescriptEslintRules = {
|
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
rules: {
|
|
18
|
-
//
|
|
19
|
-
// https://
|
|
19
|
+
// Require that function overload signatures be consecutive.
|
|
20
|
+
// https://typescript-eslint.io/rules/adjacent-overload-signatures
|
|
21
|
+
'@typescript-eslint/adjacent-overload-signatures': 'off',
|
|
22
|
+
// Require consistently using either T[] or Array<T> for arrays.
|
|
23
|
+
// https://typescript-eslint.io/rules/array-type
|
|
24
|
+
'@typescript-eslint/array-type': 'off',
|
|
25
|
+
// Disallow awaiting a value that is not a Thenable.
|
|
26
|
+
// https://typescript-eslint.io/rules/await-thenable
|
|
27
|
+
'@typescript-eslint/await-thenable': 'off',
|
|
28
|
+
// Disallow @ts-<directive> comments or require descriptions after directives.
|
|
29
|
+
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
30
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
31
|
+
// Disallow // tslint:<rule-flag> comments.
|
|
32
|
+
// https://typescript-eslint.io/rules/ban-tslint-comment
|
|
33
|
+
'@typescript-eslint/ban-tslint-comment': 'error',
|
|
34
|
+
// Enforce that literals on classes are exposed in a consistent style.
|
|
35
|
+
// https://typescript-eslint.io/rules/class-literal-property-style
|
|
36
|
+
'@typescript-eslint/class-literal-property-style': 'off',
|
|
37
|
+
// Enforce that class methods utilize this.
|
|
38
|
+
// https://typescript-eslint.io/rules/class-methods-use-this
|
|
39
|
+
'@typescript-eslint/class-methods-use-this': 'off',
|
|
40
|
+
// Enforce specifying generic type arguments on type annotation or constructor name of a constructor call.
|
|
41
|
+
// https://typescript-eslint.io/rules/consistent-generic-constructors
|
|
42
|
+
'@typescript-eslint/consistent-generic-constructors': 'off',
|
|
43
|
+
// Require or disallow the Record type.
|
|
44
|
+
// https://typescript-eslint.io/rules/consistent-indexed-object-style
|
|
45
|
+
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
|
46
|
+
// Require return statements to either always or never specify values.
|
|
47
|
+
// https://typescript-eslint.io/rules/consistent-return
|
|
48
|
+
// Not recommended by the TypeScript Eslint team due to "noImplicitReturns" TypeScript rule
|
|
49
|
+
'@typescript-eslint/consistent-return': 'off',
|
|
50
|
+
// Enforce consistent usage of type assertions.
|
|
51
|
+
// https://typescript-eslint.io/rules/consistent-type-assertions
|
|
52
|
+
'@typescript-eslint/consistent-type-assertions': 'off',
|
|
53
|
+
// Enforce type definitions to consistently use either interface or type.
|
|
54
|
+
// https://typescript-eslint.io/rules/consistent-type-definitions
|
|
55
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
56
|
+
// Enforce consistent usage of type exports.
|
|
57
|
+
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
58
|
+
'@typescript-eslint/consistent-type-exports': 'off',
|
|
59
|
+
// Enforce consistent usage of type imports.
|
|
60
|
+
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
61
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
62
|
+
// Enforce default parameters to be last.
|
|
63
|
+
// https://typescript-eslint.io/rules/default-param-last
|
|
64
|
+
'default-param-last': 'off',
|
|
65
|
+
'@typescript-eslint/default-param-last': best_practices_1.default.rules['default-param-last'],
|
|
66
|
+
// Enforce dot notation whenever possible.
|
|
67
|
+
// https://typescript-eslint.io/rules/dot-notation
|
|
68
|
+
'dot-notation': 'off',
|
|
69
|
+
'@typescript-eslint/dot-notation': [
|
|
70
|
+
best_practices_1.default.rules['dot-notation'][0],
|
|
71
|
+
Object.assign(Object.assign({}, best_practices_1.default.rules['dot-notation'][1]), { allowPrivateClassPropertyAccess: false, allowProtectedClassPropertyAccess: false, allowIndexSignaturePropertyAccess: false }),
|
|
72
|
+
],
|
|
73
|
+
// Require explicit return types on functions and class methods.
|
|
74
|
+
// https://typescript-eslint.io/rules/explicit-function-return-type
|
|
75
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
76
|
+
// Require explicit accessibility modifiers on class properties and methods.
|
|
77
|
+
// https://typescript-eslint.io/rules/explicit-member-accessibility
|
|
78
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
79
|
+
// Require explicit return and argument types on exported functions' and classes' public class methods.
|
|
80
|
+
// https://typescript-eslint.io/rules/explicit-module-boundary-types
|
|
81
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
82
|
+
// Require or disallow initialization in variable declarations.
|
|
83
|
+
// https://typescript-eslint.io/rules/init-declarations
|
|
84
|
+
'@typescript-eslint/init-declarations': 'off',
|
|
85
|
+
// Enforce a maximum number of parameters in function definitions.
|
|
86
|
+
// https://typescript-eslint.io/rules/max-params
|
|
87
|
+
'@typescript-eslint/max-params': 'off',
|
|
88
|
+
// Require a consistent member declaration order.
|
|
89
|
+
// https://typescript-eslint.io/rules/member-ordering
|
|
90
|
+
// Not recommended by the TypeScript Eslint team due to "eslint-plugin-perfectionist"
|
|
91
|
+
'@typescript-eslint/member-ordering': 'off',
|
|
92
|
+
// Enforce using a particular method signature syntax.
|
|
93
|
+
// https://typescript-eslint.io/rules/method-signature-style
|
|
94
|
+
'@typescript-eslint/method-signature-style': 'off',
|
|
95
|
+
// Enforce naming conventions for everything across a codebase.
|
|
96
|
+
// https://typescript-eslint.io/rules/naming-convention
|
|
20
97
|
camelcase: 'off',
|
|
21
|
-
// The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
|
|
22
98
|
'@typescript-eslint/naming-convention': [
|
|
23
99
|
'error',
|
|
24
|
-
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
|
|
25
100
|
{
|
|
26
101
|
selector: 'variable',
|
|
27
102
|
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
28
103
|
},
|
|
29
|
-
// Allow camelCase functions (23.2), and PascalCase functions (23.8)
|
|
30
104
|
{
|
|
31
105
|
selector: 'function',
|
|
32
106
|
format: ['camelCase', 'PascalCase'],
|
|
33
107
|
},
|
|
34
|
-
// 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
|
|
35
108
|
{
|
|
36
109
|
selector: 'typeLike',
|
|
37
110
|
format: ['PascalCase'],
|
|
38
111
|
},
|
|
39
112
|
],
|
|
40
|
-
//
|
|
41
|
-
// https://
|
|
42
|
-
'default-param-last': 'off',
|
|
43
|
-
'@typescript-eslint/default-param-last': best_practices_1.default.rules['default-param-last'],
|
|
44
|
-
// Replace Airbnb 'dot-notation' rule with '@typescript-eslint' version
|
|
45
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
46
|
-
'dot-notation': 'off',
|
|
47
|
-
'@typescript-eslint/dot-notation': best_practices_1.default.rules['dot-notation'],
|
|
48
|
-
// Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
|
|
49
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
113
|
+
// Disallow generic Array constructors.
|
|
114
|
+
// https://typescript-eslint.io/rules/no-array-constructor
|
|
50
115
|
'no-array-constructor': 'off',
|
|
51
116
|
'@typescript-eslint/no-array-constructor': style_1.default.rules['no-array-constructor'],
|
|
52
|
-
//
|
|
53
|
-
// https://
|
|
54
|
-
'no-
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
|
|
117
|
+
// Disallow using the delete operator on array values.
|
|
118
|
+
// https://typescript-eslint.io/rules/no-array-delete
|
|
119
|
+
'@typescript-eslint/no-array-delete': 'off',
|
|
120
|
+
// Require .toString() and .toLocaleString() to only be called on objects which provide useful information when stringified.
|
|
121
|
+
// https://typescript-eslint.io/rules/no-base-to-string
|
|
122
|
+
'@typescript-eslint/no-base-to-string': 'off',
|
|
123
|
+
// Disallow non-null assertion in locations that may be confusing.
|
|
124
|
+
// https://typescript-eslint.io/rules/no-confusing-non-null-assertion
|
|
125
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'off',
|
|
126
|
+
// Require expressions of type void to appear in statement position.
|
|
127
|
+
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
128
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
129
|
+
// Disallow using code marked as @deprecated.
|
|
130
|
+
// https://typescript-eslint.io/rules/no-deprecated
|
|
131
|
+
'@typescript-eslint/no-deprecated': 'off',
|
|
132
|
+
// Disallow duplicate class members.
|
|
133
|
+
// https://typescript-eslint.io/rules/no-dupe-class-members
|
|
134
|
+
// Not recommended by the TypeScript Eslint team
|
|
135
|
+
'@typescript-eslint/no-dupe-class-members': 'off',
|
|
136
|
+
// Disallow duplicate enum member values.
|
|
137
|
+
// https://typescript-eslint.io/rules/no-duplicate-enum-values
|
|
138
|
+
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
139
|
+
// Disallow duplicate constituents of union or intersection types.
|
|
140
|
+
// https://typescript-eslint.io/rules/no-duplicate-type-constituents
|
|
141
|
+
'@typescript-eslint/no-duplicate-type-constituents': 'off',
|
|
142
|
+
// Disallow using the delete operator on computed key expressions.
|
|
143
|
+
// https://typescript-eslint.io/rules/no-dynamic-delete
|
|
144
|
+
'@typescript-eslint/no-dynamic-delete': 'off',
|
|
145
|
+
// Disallow empty functions.
|
|
146
|
+
// https://typescript-eslint.io/rules/no-empty-function
|
|
58
147
|
'no-empty-function': 'off',
|
|
59
148
|
'@typescript-eslint/no-empty-function': best_practices_1.default.rules['no-empty-function'],
|
|
60
|
-
//
|
|
61
|
-
// https://
|
|
149
|
+
// Disallow accidentally using the "empty object" type.
|
|
150
|
+
// https://typescript-eslint.io/rules/no-empty-object-type
|
|
151
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
152
|
+
// Disallow the any type.
|
|
153
|
+
// https://typescript-eslint.io/rules/no-explicit-any
|
|
154
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
155
|
+
// Disallow extra non-null assertions.
|
|
156
|
+
// https://typescript-eslint.io/rules/no-extra-non-null-assertion
|
|
157
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
158
|
+
// Disallow classes used as namespaces.
|
|
159
|
+
// https://typescript-eslint.io/rules/no-extraneous-class
|
|
160
|
+
'@typescript-eslint/no-extraneous-class': 'off',
|
|
161
|
+
// Require Promise-like statements to be handled appropriately.
|
|
162
|
+
// https://typescript-eslint.io/rules/no-floating-promises
|
|
163
|
+
'@typescript-eslint/no-floating-promises': 'off',
|
|
164
|
+
// Disallow iterating over an array with a for-in loop.
|
|
165
|
+
// https://typescript-eslint.io/rules/no-for-in-array
|
|
166
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
167
|
+
// Disallow the use of eval()-like functions.
|
|
168
|
+
// https://typescript-eslint.io/rules/no-implied-eval
|
|
62
169
|
'no-implied-eval': 'off',
|
|
63
170
|
'no-new-func': 'off',
|
|
64
171
|
'@typescript-eslint/no-implied-eval': best_practices_1.default.rules['no-implied-eval'],
|
|
65
|
-
//
|
|
66
|
-
// https://
|
|
172
|
+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers.
|
|
173
|
+
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
174
|
+
'@typescript-eslint/no-import-type-side-effects': 'off',
|
|
175
|
+
// Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean.
|
|
176
|
+
// https://typescript-eslint.io/rules/no-inferrable-types
|
|
177
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
178
|
+
'error',
|
|
179
|
+
{
|
|
180
|
+
ignoreParameters: false,
|
|
181
|
+
ignoreProperties: false,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
// Disallow this keywords outside of classes or class-like objects.
|
|
185
|
+
// https://typescript-eslint.io/rules/no-invalid-this
|
|
186
|
+
'@typescript-eslint/no-invalid-this': 'off',
|
|
187
|
+
// Disallow void type outside of generic or return types.
|
|
188
|
+
// https://typescript-eslint.io/rules/no-invalid-void-type
|
|
189
|
+
'@typescript-eslint/no-invalid-void-type': 'off',
|
|
190
|
+
// Disallow function declarations that contain unsafe references inside loop statements.
|
|
191
|
+
// https://typescript-eslint.io/rules/no-loop-func
|
|
67
192
|
'no-loop-func': 'off',
|
|
68
193
|
'@typescript-eslint/no-loop-func': best_practices_1.default.rules['no-loop-func'],
|
|
69
|
-
//
|
|
70
|
-
// https://
|
|
71
|
-
'no-magic-numbers': 'off',
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//
|
|
194
|
+
// Disallow magic numbers.
|
|
195
|
+
// https://typescript-eslint.io/rules/no-magic-numbers
|
|
196
|
+
'@typescript-eslint/no-magic-numbers': 'off',
|
|
197
|
+
// Disallow the void operator except when used to discard a value.
|
|
198
|
+
// https://typescript-eslint.io/rules/no-meaningless-void-operator
|
|
199
|
+
'@typescript-eslint/no-meaningless-void-operator': 'off',
|
|
200
|
+
// Enforce valid definition of new and constructor.
|
|
201
|
+
// https://typescript-eslint.io/rules/no-misused-new
|
|
202
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
203
|
+
// Disallow Promises in places not designed to handle them.
|
|
204
|
+
// https://typescript-eslint.io/rules/no-misused-promises
|
|
205
|
+
'@typescript-eslint/no-misused-promises': 'off',
|
|
206
|
+
// Disallow using the spread operator when it might cause unexpected behavior.
|
|
207
|
+
// https://typescript-eslint.io/rules/no-misused-spread
|
|
208
|
+
'@typescript-eslint/no-misused-spread': 'off',
|
|
209
|
+
// Disallow enums from having both number and string members.
|
|
210
|
+
// https://typescript-eslint.io/rules/no-mixed-enums
|
|
211
|
+
'@typescript-eslint/no-mixed-enums': 'error',
|
|
212
|
+
// Disallow TypeScript namespaces.
|
|
213
|
+
// https://typescript-eslint.io/rules/no-namespace
|
|
214
|
+
'@typescript-eslint/no-namespace': [
|
|
215
|
+
'error',
|
|
216
|
+
{
|
|
217
|
+
allowDeclarations: false,
|
|
218
|
+
allowDefinitionFiles: true,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
// Disallow non-null assertions in the left operand of a nullish coalescing operator.
|
|
222
|
+
// https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
|
|
223
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'off',
|
|
224
|
+
// Disallow non-null assertions after an optional chain expression.
|
|
225
|
+
// https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
|
|
226
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
|
227
|
+
// Disallow non-null assertions using the ! postfix operator.
|
|
228
|
+
// https://typescript-eslint.io/rules/no-non-null-assertion
|
|
229
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
230
|
+
// Disallow variable redeclaration.
|
|
231
|
+
// https://typescript-eslint.io/rules/no-redeclare
|
|
232
|
+
'@typescript-eslint/no-redeclare': 'off',
|
|
233
|
+
// Disallow members of unions and intersections that do nothing or override type information.
|
|
234
|
+
// https://typescript-eslint.io/rules/no-redundant-type-constituents
|
|
235
|
+
'@typescript-eslint/no-redundant-type-constituents': 'off',
|
|
236
|
+
// Disallow invocation of require().
|
|
237
|
+
// https://typescript-eslint.io/rules/no-require-imports
|
|
238
|
+
'@typescript-eslint/no-require-imports': [
|
|
239
|
+
'error',
|
|
240
|
+
{
|
|
241
|
+
allow: [],
|
|
242
|
+
allowAsImport: false,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
// Disallow specified modules when loaded by import.
|
|
246
|
+
// https://typescript-eslint.io/rules/no-restricted-imports
|
|
247
|
+
'@typescript-eslint/no-restricted-imports': 'off',
|
|
248
|
+
// Disallow certain types.
|
|
249
|
+
// https://typescript-eslint.io/rules/no-restricted-types
|
|
250
|
+
'@typescript-eslint/no-restricted-types': 'off',
|
|
251
|
+
// Disallow variable declarations from shadowing variables declared in the outer scope.
|
|
252
|
+
// https://typescript-eslint.io/rules/no-shadow
|
|
79
253
|
'no-shadow': 'off',
|
|
80
254
|
'@typescript-eslint/no-shadow': variables_1.default.rules['no-shadow'],
|
|
81
|
-
//
|
|
82
|
-
// https://
|
|
83
|
-
'no-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
255
|
+
// Disallow aliasing this.
|
|
256
|
+
// https://typescript-eslint.io/rules/no-this-alias
|
|
257
|
+
'@typescript-eslint/no-this-alias': [
|
|
258
|
+
'error',
|
|
259
|
+
{
|
|
260
|
+
allowDestructuring: true,
|
|
261
|
+
allowedNames: ['self', 'that'],
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
// Disallow unnecessary equality comparisons against boolean literals.
|
|
265
|
+
// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
266
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
|
|
267
|
+
// Disallow conditionals where the type is always truthy or always falsy.
|
|
268
|
+
// https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
269
|
+
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
270
|
+
// Disallow unnecessary assignment of constructor property parameter.
|
|
271
|
+
// https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
|
|
272
|
+
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
|
273
|
+
// Disallow unnecessary namespace qualifiers.
|
|
274
|
+
// https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
275
|
+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
276
|
+
// Disallow unnecessary template expressions.
|
|
277
|
+
// https://typescript-eslint.io/rules/no-unnecessary-template-expression
|
|
278
|
+
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
279
|
+
// Disallow type arguments that are equal to the default.
|
|
280
|
+
// https://typescript-eslint.io/rules/no-unnecessary-type-arguments
|
|
281
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
282
|
+
// Disallow type assertions that do not change the type of an expression.
|
|
283
|
+
// https://typescript-eslint.io/rules/no-unnecessary-type-assertion
|
|
284
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
285
|
+
// Disallow unnecessary constraints on generic types.
|
|
286
|
+
// https://typescript-eslint.io/rules/no-unnecessary-type-constraint
|
|
287
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
288
|
+
// Disallow type parameters that aren't used multiple times.
|
|
289
|
+
// https://typescript-eslint.io/rules/no-unnecessary-type-parameters
|
|
290
|
+
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
|
|
291
|
+
// Disallow calling a function with a value with type any.
|
|
292
|
+
// https://typescript-eslint.io/rules/no-unsafe-argument
|
|
293
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
294
|
+
// Disallow assigning a value with type any to variables and properties.
|
|
295
|
+
// https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
296
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
297
|
+
// Disallow calling a value with type any.
|
|
298
|
+
// https://typescript-eslint.io/rules/no-unsafe-call
|
|
299
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
300
|
+
// Disallow unsafe declaration merging.
|
|
301
|
+
// https://typescript-eslint.io/rules/no-unsafe-declaration-merging
|
|
302
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
303
|
+
// Disallow comparing an enum value with a non-enum value.
|
|
304
|
+
// https://typescript-eslint.io/rules/no-unsafe-enum-comparison
|
|
305
|
+
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
306
|
+
// Disallow using the unsafe built-in Function type.
|
|
307
|
+
// https://typescript-eslint.io/rules/no-unsafe-function-type
|
|
308
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
309
|
+
// Disallow member access on a value with type any.
|
|
310
|
+
// https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
311
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
312
|
+
// Disallow returning a value with type any from a function.
|
|
313
|
+
// https://typescript-eslint.io/rules/no-unsafe-return
|
|
314
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
315
|
+
// Disallow type assertions that narrow a type.
|
|
316
|
+
// https://typescript-eslint.io/rules/no-unsafe-type-assertion
|
|
317
|
+
'@typescript-eslint/no-unsafe-type-assertion': 'off',
|
|
318
|
+
// Require unary negation to take a number.
|
|
319
|
+
// https://typescript-eslint.io/rules/no-unsafe-unary-minus
|
|
320
|
+
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
321
|
+
// Disallow unused expressions.
|
|
322
|
+
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
87
323
|
'no-unused-expressions': 'off',
|
|
88
324
|
'@typescript-eslint/no-unused-expressions': best_practices_1.default.rules['no-unused-expressions'],
|
|
89
|
-
//
|
|
90
|
-
// https://
|
|
325
|
+
// Disallow unused variables.
|
|
326
|
+
// https://typescript-eslint.io/rules/no-unused-vars
|
|
91
327
|
'no-unused-vars': 'off',
|
|
92
328
|
'@typescript-eslint/no-unused-vars': variables_1.default.rules['no-unused-vars'],
|
|
93
|
-
//
|
|
94
|
-
// https://
|
|
329
|
+
// Disallow the use of variables before they are defined.
|
|
330
|
+
// https://typescript-eslint.io/rules/no-use-before-define
|
|
95
331
|
'no-use-before-define': 'off',
|
|
96
332
|
'@typescript-eslint/no-use-before-define': variables_1.default.rules['no-use-before-define'],
|
|
97
|
-
//
|
|
98
|
-
// https://
|
|
333
|
+
// Disallow unnecessary constructors.
|
|
334
|
+
// https://typescript-eslint.io/rules/no-useless-constructor
|
|
99
335
|
'no-useless-constructor': 'off',
|
|
100
336
|
'@typescript-eslint/no-useless-constructor': es6_1.default.rules['no-useless-constructor'],
|
|
101
|
-
//
|
|
102
|
-
// https://
|
|
103
|
-
'
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
//
|
|
337
|
+
// Disallow empty exports that don't change anything in a module file.
|
|
338
|
+
// https://typescript-eslint.io/rules/no-useless-empty-export
|
|
339
|
+
'@typescript-eslint/no-useless-empty-export': 'off',
|
|
340
|
+
// Disallow using confusing built-in primitive class wrappers.
|
|
341
|
+
// https://typescript-eslint.io/rules/no-wrapper-object-types
|
|
342
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
343
|
+
// Enforce non-null assertions over explicit type assertions.
|
|
344
|
+
// https://typescript-eslint.io/rules/non-nullable-type-assertion-style
|
|
345
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
|
346
|
+
// Disallow throwing non-Error values as exceptions.
|
|
347
|
+
// https://typescript-eslint.io/rules/only-throw-error
|
|
348
|
+
'no-throw-literal': 'off',
|
|
349
|
+
'@typescript-eslint/only-throw-error': best_practices_1.default.rules['no-throw-literal'],
|
|
350
|
+
// Require or disallow parameter properties in class constructors.
|
|
351
|
+
// https://typescript-eslint.io/rules/parameter-properties
|
|
352
|
+
'@typescript-eslint/parameter-properties': 'off',
|
|
353
|
+
// Enforce the use of as const over literal type.
|
|
354
|
+
// https://typescript-eslint.io/rules/prefer-as-const
|
|
355
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
356
|
+
// Require destructuring from arrays and/or objects.
|
|
357
|
+
// https://typescript-eslint.io/rules/prefer-destructuring
|
|
358
|
+
'prefer-destructuring': 'off',
|
|
359
|
+
'@typescript-eslint/prefer-destructuring': es6_1.default.rules['prefer-destructuring'],
|
|
360
|
+
// Require each enum member value to be explicitly initialized.
|
|
361
|
+
// https://typescript-eslint.io/rules/prefer-enum-initializers
|
|
362
|
+
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
363
|
+
// Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0] when looking for a single result.
|
|
364
|
+
// https://typescript-eslint.io/rules/prefer-find
|
|
365
|
+
'@typescript-eslint/prefer-find': 'error',
|
|
366
|
+
// Enforce the use of for-of loop over the standard for loop where possible.
|
|
367
|
+
// https://typescript-eslint.io/rules/prefer-for-of
|
|
368
|
+
'@typescript-eslint/prefer-for-of': 'off',
|
|
369
|
+
// Enforce using function types instead of interfaces with call signatures.
|
|
370
|
+
// https://typescript-eslint.io/rules/prefer-function-type
|
|
371
|
+
'@typescript-eslint/prefer-function-type': 'error',
|
|
372
|
+
// Enforce includes method over indexOf method.
|
|
373
|
+
// https://typescript-eslint.io/rules/prefer-includes
|
|
374
|
+
'@typescript-eslint/prefer-includes': 'off',
|
|
375
|
+
// Require all enum members to be literal values.
|
|
376
|
+
// https://typescript-eslint.io/rules/prefer-literal-enum-member
|
|
377
|
+
'@typescript-eslint/prefer-literal-enum-member': 'off',
|
|
378
|
+
// Require using the namespace keyword over module keyword to declare custom TypeScript modules.
|
|
379
|
+
// https://typescript-eslint.io/rules/prefer-namespace-keyword
|
|
380
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
381
|
+
// Enforce using the nullish coalescing operator instead of logical assignments or chaining.
|
|
382
|
+
// https://typescript-eslint.io/rules/prefer-nullish-coalescing
|
|
383
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
384
|
+
// Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects.
|
|
385
|
+
// https://typescript-eslint.io/rules/prefer-optional-chain
|
|
386
|
+
'@typescript-eslint/prefer-optional-chain': 'off',
|
|
387
|
+
// Require using Error objects as Promise rejection reasons.
|
|
388
|
+
// https://typescript-eslint.io/rules/prefer-promise-reject-errors
|
|
389
|
+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
|
|
390
|
+
// Require private members to be marked as readonly if they're never modified outside of the constructor.
|
|
391
|
+
// https://typescript-eslint.io/rules/prefer-readonly
|
|
392
|
+
'@typescript-eslint/prefer-readonly': 'off',
|
|
393
|
+
// Require function parameters to be typed as readonly to prevent accidental mutation of inputs.
|
|
394
|
+
// https://typescript-eslint.io/rules/prefer-readonly-parameter-types
|
|
395
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
396
|
+
// Enforce using type parameter when calling Array#reduce instead of using a type assertion.
|
|
397
|
+
// https://typescript-eslint.io/rules/prefer-reduce-type-parameter
|
|
398
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
|
399
|
+
// Enforce RegExp#exec over String#match if no global flag is provided.
|
|
400
|
+
// https://typescript-eslint.io/rules/prefer-regexp-exec
|
|
401
|
+
'@typescript-eslint/prefer-regexp-exec': 'off',
|
|
402
|
+
// Enforce that this is used when only this type is returned.
|
|
403
|
+
// https://typescript-eslint.io/rules/prefer-return-this-type
|
|
404
|
+
'@typescript-eslint/prefer-return-this-type': 'off',
|
|
405
|
+
// Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings.
|
|
406
|
+
// https://typescript-eslint.io/rules/prefer-string-starts-ends-with
|
|
407
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
|
|
408
|
+
// Require any function or method that returns a Promise to be marked async.
|
|
409
|
+
// https://typescript-eslint.io/rules/promise-function-async
|
|
410
|
+
'@typescript-eslint/promise-function-async': 'off',
|
|
411
|
+
// Enforce that get() types should be assignable to their equivalent set() type.
|
|
412
|
+
// https://typescript-eslint.io/rules/related-getter-setter-pairs
|
|
413
|
+
'@typescript-eslint/related-getter-setter-pairs': 'off',
|
|
414
|
+
// Require Array#sort and Array#toSorted calls to always provide a compareFunction.
|
|
415
|
+
// https://typescript-eslint.io/rules/require-array-sort-compare
|
|
416
|
+
'@typescript-eslint/require-array-sort-compare': 'off',
|
|
417
|
+
// Disallow async functions which do not return promises and have no await expression.
|
|
418
|
+
// https://typescript-eslint.io/rules/require-await
|
|
419
|
+
'@typescript-eslint/require-await': 'off',
|
|
420
|
+
// Require both operands of addition to be the same type and be bigint, number, or string.
|
|
421
|
+
// https://typescript-eslint.io/rules/restrict-plus-operands
|
|
422
|
+
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
423
|
+
// Enforce template literal expressions to be of string type.
|
|
424
|
+
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
425
|
+
'@typescript-eslint/restrict-template-expressions': 'off',
|
|
426
|
+
// Enforce consistent awaiting of returned promises.
|
|
427
|
+
// https://typescript-eslint.io/rules/return-await
|
|
108
428
|
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
429
|
+
// Disallow certain types in boolean expressions.
|
|
430
|
+
// https://typescript-eslint.io/rules/strict-boolean-expressions
|
|
431
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
432
|
+
// Require switch-case statements to be exhaustive.
|
|
433
|
+
// https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
434
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'off',
|
|
435
|
+
// Disallow certain triple slash directives in favor of ES6-style import declarations.
|
|
436
|
+
// https://typescript-eslint.io/rules/triple-slash-reference
|
|
437
|
+
'@typescript-eslint/triple-slash-reference': [
|
|
438
|
+
'error',
|
|
439
|
+
{
|
|
440
|
+
lib: 'always',
|
|
441
|
+
path: 'never',
|
|
442
|
+
types: 'prefer-import',
|
|
443
|
+
},
|
|
444
|
+
],
|
|
445
|
+
// Require type annotations in certain places.
|
|
446
|
+
// https://typescript-eslint.io/rules/typedef
|
|
447
|
+
'@typescript-eslint/typedef': 'off',
|
|
448
|
+
// Enforce unbound methods are called with their expected scope.
|
|
449
|
+
// https://typescript-eslint.io/rules/unbound-method
|
|
450
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
451
|
+
// Disallow two overloads that could be unified into one with a union or an optional/rest parameter.
|
|
452
|
+
// https://typescript-eslint.io/rules/unified-signatures
|
|
453
|
+
'@typescript-eslint/unified-signatures': 'off',
|
|
454
|
+
// Enforce typing arguments in Promise rejection callbacks as unknown.
|
|
455
|
+
// https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
456
|
+
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
exports.deprecatedTypescriptEslintRules = {
|
|
460
|
+
name: 'airbnb/config/typescript/typescript-eslint/deprecated',
|
|
461
|
+
rules: {
|
|
462
|
+
// Disallow the declaration of empty interfaces.
|
|
463
|
+
// https://typescript-eslint.io/rules/no-empty-interface
|
|
464
|
+
'@typescript-eslint/no-empty-interface': 'off',
|
|
465
|
+
// Disallow literal numbers that lose precision.
|
|
466
|
+
// https://typescript-eslint.io/rules/no-loss-of-precision
|
|
467
|
+
'@typescript-eslint/no-loss-of-precision': 'off',
|
|
468
|
+
// Disallow type aliases.
|
|
469
|
+
// https://typescript-eslint.io/rules/no-type-alias
|
|
470
|
+
'@typescript-eslint/no-type-alias': 'off',
|
|
471
|
+
// Disallow require statements except in import statements.
|
|
472
|
+
// https://typescript-eslint.io/rules/no-var-requires
|
|
473
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
474
|
+
// Enforce using @ts-expect-error over @ts-ignore.
|
|
475
|
+
// https://typescript-eslint.io/rules/prefer-ts-expect-error
|
|
476
|
+
'@typescript-eslint/prefer-ts-expect-error': 'off',
|
|
477
|
+
// Enforce constituents of a type union/intersection to be sorted alphabetically.
|
|
478
|
+
// https://typescript-eslint.io/rules/sort-type-constituents
|
|
479
|
+
'@typescript-eslint/sort-type-constituents': 'off',
|
|
109
480
|
},
|
|
110
481
|
};
|
|
111
482
|
exports.default = typescriptEslintRules;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../utils");
|
|
4
|
+
const typescriptEslintStrictRules = {
|
|
5
|
+
name: 'airbnb/config/typescript/typescript-eslint/strict',
|
|
6
|
+
files: utils_1.tsFiles,
|
|
7
|
+
rules: {
|
|
8
|
+
// Require that function overload signatures be consecutive.
|
|
9
|
+
// https://typescript-eslint.io/rules/adjacent-overload-signatures
|
|
10
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
11
|
+
// Require consistently using either T[] or Array<T> for arrays.
|
|
12
|
+
// https://typescript-eslint.io/rules/array-type
|
|
13
|
+
'@typescript-eslint/array-type': [
|
|
14
|
+
'error',
|
|
15
|
+
{
|
|
16
|
+
default: 'array',
|
|
17
|
+
readonly: 'array',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
// Disallow awaiting a value that is not a Thenable.
|
|
21
|
+
// https://typescript-eslint.io/rules/await-thenable
|
|
22
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
23
|
+
// Disallow @ts-<directive> comments or require descriptions after directives.
|
|
24
|
+
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
25
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
minimumDescriptionLength: 3,
|
|
29
|
+
'ts-check': false,
|
|
30
|
+
'ts-expect-error': 'allow-with-description',
|
|
31
|
+
'ts-ignore': true,
|
|
32
|
+
'ts-nocheck': true,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
// Enforce that literals on classes are exposed in a consistent style.
|
|
36
|
+
// https://typescript-eslint.io/rules/class-literal-property-style
|
|
37
|
+
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
38
|
+
// Enforce specifying generic type arguments on type annotation or constructor name of a constructor call.
|
|
39
|
+
// https://typescript-eslint.io/rules/consistent-generic-constructors
|
|
40
|
+
'@typescript-eslint/consistent-generic-constructors': ['error', 'type-annotation'],
|
|
41
|
+
// Enforce consistent usage of type assertions.
|
|
42
|
+
// https://typescript-eslint.io/rules/consistent-type-assertions
|
|
43
|
+
'@typescript-eslint/consistent-type-assertions': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
arrayLiteralTypeAssertions: 'allow',
|
|
47
|
+
assertionStyle: 'as',
|
|
48
|
+
objectLiteralTypeAssertions: 'allow',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
// Enforce consistent usage of type exports.
|
|
52
|
+
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
53
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
54
|
+
'error',
|
|
55
|
+
{
|
|
56
|
+
fixMixedExportsWithInlineTypeSpecifier: false,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
// Enforce consistent usage of type imports.
|
|
60
|
+
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
61
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
62
|
+
'error',
|
|
63
|
+
{
|
|
64
|
+
disallowTypeAnnotations: true,
|
|
65
|
+
fixStyle: 'separate-type-imports',
|
|
66
|
+
prefer: 'type-imports',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
// Require explicit return and argument types on exported functions' and classes' public class methods.
|
|
70
|
+
// https://typescript-eslint.io/rules/explicit-module-boundary-types
|
|
71
|
+
'@typescript-eslint/explicit-module-boundary-types': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
allowArgumentsExplicitlyTypedAsAny: false,
|
|
75
|
+
allowDirectConstAssertionInArrowFunctions: true,
|
|
76
|
+
allowedNames: [],
|
|
77
|
+
allowHigherOrderFunctions: true,
|
|
78
|
+
allowOverloadFunctions: false,
|
|
79
|
+
allowTypedFunctionExpressions: true,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
// Enforce using a particular method signature syntax.
|
|
83
|
+
// https://typescript-eslint.io/rules/method-signature-style
|
|
84
|
+
'@typescript-eslint/method-signature-style': ['error', 'property'],
|
|
85
|
+
// Disallow using the delete operator on array values.
|
|
86
|
+
// https://typescript-eslint.io/rules/no-array-delete
|
|
87
|
+
'@typescript-eslint/no-array-delete': 'error',
|
|
88
|
+
// Disallow non-null assertion in locations that may be confusing.
|
|
89
|
+
// https://typescript-eslint.io/rules/no-confusing-non-null-assertion
|
|
90
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
|
91
|
+
// Require expressions of type void to appear in statement position.
|
|
92
|
+
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
93
|
+
'@typescript-eslint/no-confusing-void-expression': [
|
|
94
|
+
'error',
|
|
95
|
+
{
|
|
96
|
+
ignoreArrowShorthand: false,
|
|
97
|
+
ignoreVoidOperator: true,
|
|
98
|
+
ignoreVoidReturningFunctions: false,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
// Disallow duplicate constituents of union or intersection types.
|
|
102
|
+
// https://typescript-eslint.io/rules/no-duplicate-type-constituents
|
|
103
|
+
'@typescript-eslint/no-duplicate-type-constituents': [
|
|
104
|
+
'error',
|
|
105
|
+
{
|
|
106
|
+
ignoreIntersections: false,
|
|
107
|
+
ignoreUnions: false,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
// Disallow accidentally using the "empty object" type.
|
|
111
|
+
// https://typescript-eslint.io/rules/no-empty-object-type
|
|
112
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
113
|
+
'error',
|
|
114
|
+
{
|
|
115
|
+
allowInterfaces: 'never',
|
|
116
|
+
allowObjectTypes: 'never',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
// Disallow the any type.
|
|
120
|
+
// https://typescript-eslint.io/rules/no-explicit-any
|
|
121
|
+
'@typescript-eslint/no-explicit-any': [
|
|
122
|
+
'error',
|
|
123
|
+
{
|
|
124
|
+
fixToUnknown: false,
|
|
125
|
+
ignoreRestArgs: false,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers.
|
|
129
|
+
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
130
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
131
|
+
// Disallow void type outside of generic or return types.
|
|
132
|
+
// https://typescript-eslint.io/rules/no-invalid-void-type
|
|
133
|
+
'@typescript-eslint/no-invalid-void-type': [
|
|
134
|
+
'error',
|
|
135
|
+
{
|
|
136
|
+
allowAsThisParameter: false,
|
|
137
|
+
allowInGenericTypeArguments: true,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
// Disallow the void operator except when used to discard a value.
|
|
141
|
+
// https://typescript-eslint.io/rules/no-meaningless-void-operator
|
|
142
|
+
'@typescript-eslint/no-meaningless-void-operator': [
|
|
143
|
+
'error',
|
|
144
|
+
{
|
|
145
|
+
checkNever: false,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
// Disallow Promises in places not designed to handle them.
|
|
149
|
+
// https://typescript-eslint.io/rules/no-misused-promises
|
|
150
|
+
'@typescript-eslint/no-misused-promises': [
|
|
151
|
+
'error',
|
|
152
|
+
{
|
|
153
|
+
checksConditionals: true,
|
|
154
|
+
checksSpreads: true,
|
|
155
|
+
checksVoidReturn: true,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
// Disallow using the spread operator when it might cause unexpected behavior.
|
|
159
|
+
// https://typescript-eslint.io/rules/no-misused-spread
|
|
160
|
+
'@typescript-eslint/no-misused-spread': [
|
|
161
|
+
'error',
|
|
162
|
+
{
|
|
163
|
+
allow: [],
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
// Disallow non-null assertions in the left operand of a nullish coalescing operator.
|
|
167
|
+
// https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
|
|
168
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'warn',
|
|
169
|
+
// Disallow non-null assertions after an optional chain expression.
|
|
170
|
+
// https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
|
|
171
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
172
|
+
// Disallow non-null assertions using the ! postfix operator.
|
|
173
|
+
// https://typescript-eslint.io/rules/no-non-null-assertion
|
|
174
|
+
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
175
|
+
// Disallow members of unions and intersections that do nothing or override type information.
|
|
176
|
+
// https://typescript-eslint.io/rules/no-redundant-type-constituents
|
|
177
|
+
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
178
|
+
// Disallow unnecessary equality comparisons against boolean literals.
|
|
179
|
+
// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
180
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
181
|
+
// Disallow assigning a value with type any to variables and properties.
|
|
182
|
+
// https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
183
|
+
'@typescript-eslint/no-unsafe-assignment': 'error',
|
|
184
|
+
// Disallow calling a value with type any.
|
|
185
|
+
// https://typescript-eslint.io/rules/no-unsafe-call
|
|
186
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
187
|
+
// Disallow returning a value with type any from a function.
|
|
188
|
+
// https://typescript-eslint.io/rules/no-unsafe-return
|
|
189
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
190
|
+
// Disallow empty exports that don't change anything in a module file.
|
|
191
|
+
// https://typescript-eslint.io/rules/no-useless-empty-export
|
|
192
|
+
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
193
|
+
// Enforce the use of for-of loop over the standard for loop where possible.
|
|
194
|
+
// https://typescript-eslint.io/rules/prefer-for-of
|
|
195
|
+
'@typescript-eslint/prefer-for-of': 'off',
|
|
196
|
+
// Enforce includes method over indexOf method.
|
|
197
|
+
// https://typescript-eslint.io/rules/prefer-includes
|
|
198
|
+
'@typescript-eslint/prefer-includes': 'warn',
|
|
199
|
+
// Enforce using the nullish coalescing operator instead of logical assignments or chaining.
|
|
200
|
+
// https://typescript-eslint.io/rules/prefer-nullish-coalescing
|
|
201
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
202
|
+
// Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects.
|
|
203
|
+
// https://typescript-eslint.io/rules/prefer-optional-chain
|
|
204
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
205
|
+
// Enforce using type parameter when calling Array#reduce instead of using a type assertion.
|
|
206
|
+
// https://typescript-eslint.io/rules/prefer-reduce-type-parameter
|
|
207
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
208
|
+
// Enforce RegExp#exec over String#match if no global flag is provided.
|
|
209
|
+
// https://typescript-eslint.io/rules/prefer-regexp-exec
|
|
210
|
+
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
211
|
+
// Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings.
|
|
212
|
+
// https://typescript-eslint.io/rules/prefer-string-starts-ends-with
|
|
213
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
|
|
214
|
+
// Require any function or method that returns a Promise to be marked async.
|
|
215
|
+
// https://typescript-eslint.io/rules/promise-function-async
|
|
216
|
+
'@typescript-eslint/promise-function-async': 'error',
|
|
217
|
+
// Require Array#sort and Array#toSorted calls to always provide a compareFunction.
|
|
218
|
+
// https://typescript-eslint.io/rules/require-array-sort-compare
|
|
219
|
+
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
220
|
+
// Disallow two overloads that could be unified into one with a union or an optional/rest parameter.
|
|
221
|
+
// https://typescript-eslint.io/rules/unified-signatures
|
|
222
|
+
'@typescript-eslint/unified-signatures': [
|
|
223
|
+
'error',
|
|
224
|
+
{
|
|
225
|
+
ignoreDifferentlyNamedParameters: false,
|
|
226
|
+
ignoreOverloadsWithDifferentJSDoc: false,
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
exports.default = typescriptEslintStrictRules;
|
package/dist/rules/variables.js
CHANGED
|
@@ -43,11 +43,12 @@ const variablesRules = {
|
|
|
43
43
|
'no-undefined': 'off',
|
|
44
44
|
// disallow declaration of variables that are not used in the code
|
|
45
45
|
'no-unused-vars': [
|
|
46
|
-
'
|
|
46
|
+
'warn',
|
|
47
47
|
{
|
|
48
48
|
vars: 'all',
|
|
49
49
|
args: 'after-used',
|
|
50
50
|
ignoreRestSiblings: true,
|
|
51
|
+
argsIgnorePattern: '^_',
|
|
51
52
|
},
|
|
52
53
|
],
|
|
53
54
|
// disallow use of variables before they are defined
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tsExtensionsRule = exports.tsExtensionsResolver = exports.tsExtensionsWithReactDTS = exports.tsExtensionsWithReact = exports.tsExtensions = exports.jsExtensionsRule = exports.jsExtensionsResolver = exports.jsExtensionsWithReact = exports.jsExtensions = void 0;
|
|
3
|
+
exports.tsFiles = exports.tsExtensionsRule = exports.tsExtensionsResolver = exports.tsExtensionsWithReactDTS = exports.tsExtensionsWithReact = exports.tsExtensions = exports.jsExtensionsRule = exports.jsExtensionsResolver = exports.jsExtensionsWithReact = exports.jsExtensions = void 0;
|
|
4
4
|
exports.jsExtensions = ['.js', '.cjs', '.mjs'];
|
|
5
5
|
exports.jsExtensionsWithReact = [...exports.jsExtensions, '.jsx'];
|
|
6
6
|
exports.jsExtensionsResolver = [...exports.jsExtensions, '.json'];
|
|
@@ -10,3 +10,5 @@ exports.tsExtensionsWithReact = [...exports.tsExtensions, '.tsx'];
|
|
|
10
10
|
exports.tsExtensionsWithReactDTS = [...exports.tsExtensionsWithReact, '.d.ts'];
|
|
11
11
|
exports.tsExtensionsResolver = [exports.tsExtensions, '.d.ts'];
|
|
12
12
|
exports.tsExtensionsRule = Object.fromEntries(Object.values(exports.tsExtensionsWithReact).map((val) => [val.slice(1), 'never']));
|
|
13
|
+
// ESLINT CONFIG FILES
|
|
14
|
+
exports.tsFiles = exports.tsExtensionsWithReact.map((val) => `*${val}`);
|