@haltcase/style 6.2.1 → 7.0.0-canary.10
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/eslint/configs/browser.js +27 -0
- package/eslint/configs/cjs.js +13 -0
- package/eslint/configs/internal/base.js +178 -0
- package/eslint/configs/internal/commonjs.js +22 -0
- package/eslint/{rules → configs/internal}/es2015.js +17 -16
- package/eslint/configs/internal/simple-import-sort.js +27 -0
- package/eslint/configs/internal/tsdoc.js +20 -0
- package/eslint/{rules → configs/internal}/unicorn.js +118 -126
- package/eslint/configs/next.js +50 -0
- package/eslint/configs/node.js +27 -0
- package/eslint/configs/playwright-test.js +21 -0
- package/eslint/configs/react.js +109 -0
- package/eslint/configs/typescript.js +106 -0
- package/eslint/constants.js +23 -28
- package/eslint/index.js +33 -0
- package/eslint/rules/best-practice.js +250 -245
- package/eslint/rules/imports.js +94 -0
- package/eslint/rules/jsx-a11y.js +11 -10
- package/eslint/rules/playwright-test.js +25 -26
- package/eslint/rules/possible-errors.js +38 -45
- package/eslint/rules/react-x.js +78 -0
- package/eslint/rules/react.js +20 -113
- package/eslint/rules/stylistic-jsx.js +17 -0
- package/eslint/rules/stylistic.js +83 -84
- package/eslint/rules/typescript/extension.js +68 -39
- package/eslint/rules/typescript/import.js +16 -15
- package/eslint/rules/typescript/index.js +110 -121
- package/eslint/rules/typescript/naming-convention.js +121 -0
- package/eslint/rules/variables.js +34 -34
- package/eslint/withFiles.js +15 -0
- package/package.json +53 -59
- package/prettier/index.js +4 -11
- package/readme.md +183 -98
- package/stylelint/_base.js +2 -4
- package/stylelint/index.js +6 -7
- package/stylelint/modules.js +7 -8
- package/stylelint/standard.js +2 -5
- package/typescript/tsconfig.base.json +2 -1
- package/typescript/tsconfig.bundler.json +7 -3
- package/typescript/tsconfig.next.json +14 -6
- package/typescript/tsconfig.node.json +1 -1
- package/typescript/tsconfig.node18.json +4 -7
- package/typescript/tsconfig.node20.json +4 -7
- package/typescript/tsconfig.node22.json +10 -0
- package/typescript/tsconfig.web.json +1 -1
- package/eslint/_base.js +0 -82
- package/eslint/astro.js +0 -40
- package/eslint/browser.js +0 -8
- package/eslint/cjs.js +0 -12
- package/eslint/jest.js +0 -28
- package/eslint/next.js +0 -38
- package/eslint/node.js +0 -8
- package/eslint/playwright-test.js +0 -8
- package/eslint/react.js +0 -18
- package/eslint/rules/import.js +0 -92
- package/eslint/rules/jest.js +0 -28
- package/eslint/rules/simple-import-sort.js +0 -23
- package/eslint/rules/tsdoc.js +0 -17
- package/eslint/rules/typescript/strict.js +0 -18
- package/eslint/typescript.js +0 -26
- package/eslint/utils/require-package.js +0 -44
|
@@ -1,45 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
levels: { error }
|
|
5
|
-
} = require("../../constants");
|
|
5
|
+
import { variablesRules } from "../variables.js";
|
|
6
6
|
|
|
7
7
|
// These share identical configuration options, so we want to keep them in sync.
|
|
8
8
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
9
|
-
const
|
|
9
|
+
const noUnusedVarsOptions = variablesRules["no-unused-vars"];
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @type {Linter.RulesRecord}
|
|
13
|
+
*/
|
|
14
|
+
export const typescriptExtensionRules = {
|
|
15
|
+
/**
|
|
16
|
+
* Require default parameters to be last.
|
|
17
|
+
*
|
|
18
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/default-param-last/
|
|
19
|
+
*/
|
|
20
|
+
"@typescript-eslint/default-param-last": "error",
|
|
21
|
+
/**
|
|
22
|
+
* Disallow accidentally using the "empty object" type (`{}`).
|
|
23
|
+
*
|
|
24
|
+
* 🔧 Partially fixable - https://typescript-eslint.io/rules/no-empty-object-type/
|
|
25
|
+
*/
|
|
26
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
// allow "single-extends" interfaces as they are often useful for
|
|
30
|
+
// documentation purposes and future extensibility
|
|
31
|
+
allowInterfaces: "with-single-extends",
|
|
32
|
+
// allow React-like props types
|
|
33
|
+
allowWithName: "Props$"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
/**
|
|
37
|
+
* Disallow creation of functions within loops.
|
|
38
|
+
*
|
|
39
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-loop-func/
|
|
40
|
+
*/
|
|
41
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
42
|
+
/**
|
|
43
|
+
* Disallow variable declarations from shadowing variables declared in the
|
|
44
|
+
* outer scope.
|
|
45
|
+
*
|
|
46
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-shadow/
|
|
47
|
+
*/
|
|
48
|
+
"@typescript-eslint/no-shadow": "error",
|
|
49
|
+
/**
|
|
50
|
+
* Disallow unused variables.
|
|
51
|
+
*
|
|
52
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-unused-vars/
|
|
53
|
+
*/
|
|
54
|
+
"@typescript-eslint/no-unused-vars": noUnusedVarsOptions,
|
|
55
|
+
/**
|
|
56
|
+
* Disallow unnecessary constructors.
|
|
57
|
+
*
|
|
58
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-useless-constructor/
|
|
59
|
+
*/
|
|
60
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
61
|
+
/**
|
|
62
|
+
* Enforce template literal expressions to be of string type.
|
|
63
|
+
*
|
|
64
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/restrict-template-expressions/
|
|
65
|
+
*/
|
|
66
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
67
|
+
"error",
|
|
68
|
+
{
|
|
69
|
+
allow: [{ from: "lib", name: ["Error", "URL", "URLSearchParams"] }],
|
|
70
|
+
allowBoolean: true,
|
|
71
|
+
allowNumber: true
|
|
72
|
+
}
|
|
73
|
+
]
|
|
45
74
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
levels: { off }
|
|
5
|
-
} = require("../../constants");
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
* These are enabled by `import/recommended`, but are better handled by
|
|
9
|
-
* TypeScript and
|
|
6
|
+
* These are enabled by `import-x/recommended`, but are better handled by
|
|
7
|
+
* TypeScript and `typescript-eslint`.
|
|
8
|
+
*
|
|
9
|
+
* @type {Linter.RulesRecord}
|
|
10
10
|
*/
|
|
11
11
|
const disabledRules = {
|
|
12
|
-
"import/default": off,
|
|
13
|
-
"import/export": off,
|
|
14
|
-
"import/namespace": off,
|
|
15
|
-
"import/no-unresolved": off
|
|
12
|
+
"import-x/default": "off",
|
|
13
|
+
"import-x/export": "off",
|
|
14
|
+
"import-x/namespace": "off",
|
|
15
|
+
"import-x/no-unresolved": "off"
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @type {Linter.RulesRecord}
|
|
20
|
+
*/
|
|
21
|
+
export const typescriptImportRules = {
|
|
22
|
+
...disabledRules
|
|
22
23
|
};
|
|
@@ -1,125 +1,114 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Prevent `void` type expressions from being used in misleading locations
|
|
71
|
-
* such as being assigned to a variable, provided as a function argument,
|
|
72
|
-
* or returned from a function (except concise arrow functions).
|
|
73
|
-
*
|
|
74
|
-
* 🔧 Fixable - https://typescript-eslint.io/rules/no-confusing-void-expression/
|
|
75
|
-
*/
|
|
76
|
-
"@typescript-eslint/no-confusing-void-expression": [
|
|
77
|
-
error,
|
|
78
|
-
{
|
|
79
|
-
ignoreArrowShorthand: true
|
|
5
|
+
/**
|
|
6
|
+
* @type {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
export const typescriptBaseRules = {
|
|
9
|
+
/**
|
|
10
|
+
* Require consistent usage of type exports.
|
|
11
|
+
*
|
|
12
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-exports/
|
|
13
|
+
*/
|
|
14
|
+
"@typescript-eslint/consistent-type-exports": [
|
|
15
|
+
"warn",
|
|
16
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true }
|
|
17
|
+
],
|
|
18
|
+
/**
|
|
19
|
+
* Require consistent usage of type imports.
|
|
20
|
+
*
|
|
21
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-imports/
|
|
22
|
+
*/
|
|
23
|
+
"@typescript-eslint/consistent-type-imports": "warn",
|
|
24
|
+
/**
|
|
25
|
+
* Require explicit return types on functions and class methods.
|
|
26
|
+
*
|
|
27
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/explicit-function-return-type/
|
|
28
|
+
*/
|
|
29
|
+
"@typescript-eslint/explicit-function-return-type": [
|
|
30
|
+
"warn",
|
|
31
|
+
{
|
|
32
|
+
allowExpressions: true,
|
|
33
|
+
allowFunctionsWithoutTypeParameters: true,
|
|
34
|
+
allowTypedFunctionExpressions: true
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
/**
|
|
38
|
+
* Require using function property types in method signatures.
|
|
39
|
+
*
|
|
40
|
+
* These have enhanced typechecking, whereas method signatures do not.
|
|
41
|
+
*
|
|
42
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/method-signature-style/
|
|
43
|
+
*/
|
|
44
|
+
"@typescript-eslint/method-signature-style": "warn",
|
|
45
|
+
/**
|
|
46
|
+
* Prevent `void` type expressions from being used in misleading locations
|
|
47
|
+
* such as being assigned to a variable, provided as a function argument,
|
|
48
|
+
* or returned from a function (except concise arrow functions).
|
|
49
|
+
*
|
|
50
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/no-confusing-void-expression/
|
|
51
|
+
*/
|
|
52
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
53
|
+
"error",
|
|
54
|
+
{
|
|
55
|
+
ignoreArrowShorthand: true
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
/**
|
|
59
|
+
* Disallow Promises in places not designed to handle them.
|
|
60
|
+
*
|
|
61
|
+
* Function arguments and JSX attributes are allowed.
|
|
62
|
+
*
|
|
63
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-misused-promises
|
|
64
|
+
*/
|
|
65
|
+
"@typescript-eslint/no-misused-promises": [
|
|
66
|
+
"error",
|
|
67
|
+
{
|
|
68
|
+
checksVoidReturn: {
|
|
69
|
+
arguments: false,
|
|
70
|
+
attributes: false
|
|
80
71
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
/**
|
|
75
|
+
* Disallow members of unions and intersections that do nothing or override type information.
|
|
76
|
+
*
|
|
77
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-redundant-type-constituents/
|
|
78
|
+
*/
|
|
79
|
+
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
|
80
|
+
/**
|
|
81
|
+
* Disallow unnecessary namespace qualifiers.
|
|
82
|
+
*
|
|
83
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/no-unnecessary-qualifier/
|
|
84
|
+
*/
|
|
85
|
+
"@typescript-eslint/no-unnecessary-qualifier": "warn",
|
|
86
|
+
/**
|
|
87
|
+
* Enforce using the nullish coalescing operator instead of logical assignments or chaining.
|
|
88
|
+
*
|
|
89
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/prefer-nullish-coalescing/
|
|
90
|
+
*/
|
|
91
|
+
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
92
|
+
"error",
|
|
93
|
+
{
|
|
94
|
+
ignorePrimitives: {
|
|
95
|
+
number: true,
|
|
96
|
+
string: true
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* 🔧 Fixable - https://typescript-eslint.io/rules/prefer-regexp-exec/
|
|
114
|
-
*/
|
|
115
|
-
"@typescript-eslint/prefer-regexp-exec": warn,
|
|
116
|
-
/**
|
|
117
|
-
* Require exhaustive checks when using union types in switch statements.
|
|
118
|
-
*
|
|
119
|
-
* This ensures cases are considered when items are later added to a union.
|
|
120
|
-
*
|
|
121
|
-
* 🚫 Not fixable - https://typescript-eslint.io/rules/switch-exhaustiveness-check/
|
|
122
|
-
*/
|
|
123
|
-
"@typescript-eslint/switch-exhaustiveness-check": error
|
|
124
|
-
}
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
/**
|
|
101
|
+
* Require using `RegExp.exec()` over `String.match()` for consistency.
|
|
102
|
+
*
|
|
103
|
+
* 🔧 Fixable - https://typescript-eslint.io/rules/prefer-regexp-exec/
|
|
104
|
+
*/
|
|
105
|
+
"@typescript-eslint/prefer-regexp-exec": "warn",
|
|
106
|
+
/**
|
|
107
|
+
* Require exhaustive checks when using union types in switch statements.
|
|
108
|
+
*
|
|
109
|
+
* This ensures cases are considered when items are later added to a union.
|
|
110
|
+
*
|
|
111
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/switch-exhaustiveness-check/
|
|
112
|
+
*/
|
|
113
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error"
|
|
125
114
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {object} [options]
|
|
7
|
+
* @param {boolean} [options.isComponentLike = false] - Whether to treat as component-like (e.g., themed components without TSX/JSX).
|
|
8
|
+
* @param {boolean} [options.isTsx = false] - Whether to lint as TSX (JSX).
|
|
9
|
+
* @returns {Linter.RulesRecord}
|
|
10
|
+
*/
|
|
11
|
+
export const getTypescriptNamingConventionRule = ({
|
|
12
|
+
isComponentLike = false,
|
|
13
|
+
isTsx = false
|
|
14
|
+
} = {}) => ({
|
|
15
|
+
/**
|
|
16
|
+
* Require consistent naming conventions.
|
|
17
|
+
*
|
|
18
|
+
* Improves IntelliSense suggestions and avoids name collisions.
|
|
19
|
+
*
|
|
20
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/naming-convention/
|
|
21
|
+
*/
|
|
22
|
+
"@typescript-eslint/naming-convention": [
|
|
23
|
+
"error",
|
|
24
|
+
// enforce that unused variable-likes are prefixed with `_`
|
|
25
|
+
{
|
|
26
|
+
format: [
|
|
27
|
+
"camelCase",
|
|
28
|
+
(isComponentLike || isTsx) && "StrictPascalCase"
|
|
29
|
+
].filter(Boolean),
|
|
30
|
+
leadingUnderscore: "require",
|
|
31
|
+
modifiers: ["unused"],
|
|
32
|
+
selector: "variableLike",
|
|
33
|
+
trailingUnderscore: "forbid"
|
|
34
|
+
},
|
|
35
|
+
// enforce that everything is camelCase by default
|
|
36
|
+
{
|
|
37
|
+
format: [
|
|
38
|
+
"camelCase",
|
|
39
|
+
(isComponentLike || isTsx) && "StrictPascalCase"
|
|
40
|
+
].filter(Boolean),
|
|
41
|
+
leadingUnderscore: "forbid",
|
|
42
|
+
selector: "default",
|
|
43
|
+
trailingUnderscore: "forbid"
|
|
44
|
+
},
|
|
45
|
+
// allow HTTP methods in UPPER_CASE
|
|
46
|
+
{
|
|
47
|
+
filter: {
|
|
48
|
+
match: true,
|
|
49
|
+
regex: "^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)$"
|
|
50
|
+
},
|
|
51
|
+
format: null,
|
|
52
|
+
selector: ["variableLike"]
|
|
53
|
+
},
|
|
54
|
+
// allow variable-likes called exactly "_"
|
|
55
|
+
{
|
|
56
|
+
filter: {
|
|
57
|
+
match: true,
|
|
58
|
+
regex: "^_$"
|
|
59
|
+
},
|
|
60
|
+
format: null,
|
|
61
|
+
selector: ["variableLike", "typeProperty"]
|
|
62
|
+
},
|
|
63
|
+
// anything type-like must be written in PascalCase
|
|
64
|
+
{
|
|
65
|
+
format: ["PascalCase"],
|
|
66
|
+
leadingUnderscore: "forbid",
|
|
67
|
+
selector: ["typeLike", "enumMember"],
|
|
68
|
+
trailingUnderscore: "forbid"
|
|
69
|
+
},
|
|
70
|
+
// interfaces must not be prefixed with `I` or have restricted names
|
|
71
|
+
{
|
|
72
|
+
custom: {
|
|
73
|
+
match: false,
|
|
74
|
+
regex: "^I[A-Z]|^(Interface|Props|State)$"
|
|
75
|
+
},
|
|
76
|
+
format: ["PascalCase"],
|
|
77
|
+
selector: "interface"
|
|
78
|
+
},
|
|
79
|
+
// allow leading underscore(s) in object properties for things like brand identifiers
|
|
80
|
+
{
|
|
81
|
+
format: null,
|
|
82
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
83
|
+
selector: "objectLiteralProperty",
|
|
84
|
+
trailingUnderscore: "forbid"
|
|
85
|
+
},
|
|
86
|
+
// booleans must be prefixed with an allowed verb
|
|
87
|
+
// https://typescript-eslint.io/rules/naming-convention/#enforce-that-boolean-variables-are-prefixed-with-an-allowed-verb
|
|
88
|
+
{
|
|
89
|
+
format: ["PascalCase"],
|
|
90
|
+
leadingUnderscore: "forbid",
|
|
91
|
+
prefix: ["is", "has", "should", "can", "did", "will"],
|
|
92
|
+
selector: "variable",
|
|
93
|
+
trailingUnderscore: "forbid",
|
|
94
|
+
types: ["boolean"]
|
|
95
|
+
},
|
|
96
|
+
// ignore destructured properties (which are often out of our control)
|
|
97
|
+
{
|
|
98
|
+
format: null,
|
|
99
|
+
modifiers: ["destructured"],
|
|
100
|
+
prefix: [],
|
|
101
|
+
selector: ["variable", "parameter"]
|
|
102
|
+
},
|
|
103
|
+
// ignore destructured booleans; requires enough specificity to override
|
|
104
|
+
// the above rule enforcing prefixes
|
|
105
|
+
{
|
|
106
|
+
format: null,
|
|
107
|
+
leadingUnderscore: "forbid",
|
|
108
|
+
modifiers: ["destructured"],
|
|
109
|
+
prefix: [],
|
|
110
|
+
selector: "variable",
|
|
111
|
+
trailingUnderscore: "forbid",
|
|
112
|
+
types: ["boolean"]
|
|
113
|
+
},
|
|
114
|
+
// enforce that all type parameters begin with `T`
|
|
115
|
+
{
|
|
116
|
+
format: ["PascalCase"],
|
|
117
|
+
prefix: ["T"],
|
|
118
|
+
selector: "typeParameter"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
});
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]
|
|
35
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* @type {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
export const variablesRules = {
|
|
9
|
+
/**
|
|
10
|
+
* Disallow labels that share a name with a variable.
|
|
11
|
+
*
|
|
12
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-label-var
|
|
13
|
+
*/
|
|
14
|
+
"no-label-var": "error",
|
|
15
|
+
/**
|
|
16
|
+
* Disallow initializing variables to `undefined`.
|
|
17
|
+
*
|
|
18
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-undef-init
|
|
19
|
+
*/
|
|
20
|
+
"no-undef-init": "warn",
|
|
21
|
+
/**
|
|
22
|
+
* Disallow unused variables.
|
|
23
|
+
*
|
|
24
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unused-vars
|
|
25
|
+
*/
|
|
26
|
+
"no-unused-vars": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
args: "after-used",
|
|
30
|
+
argsIgnorePattern: "^_",
|
|
31
|
+
ignoreRestSiblings: true,
|
|
32
|
+
vars: "all",
|
|
33
|
+
varsIgnorePattern: "^_"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
36
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {Linter.Config[]} configArray
|
|
8
|
+
* @param {string[]} files
|
|
9
|
+
* @returns {Linter.Config[]}
|
|
10
|
+
*/
|
|
11
|
+
export const withFiles = (configArray, files) =>
|
|
12
|
+
configArray.map((config) => ({
|
|
13
|
+
...config,
|
|
14
|
+
files
|
|
15
|
+
}));
|