@peerigon/configs 3.1.0 → 3.2.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/eslint/presets/javascript-browser.js +9 -1
- package/eslint/presets/javascript-node.js +9 -1
- package/eslint/presets/javascript.js +4 -1
- package/eslint/presets/typescript-node.js +4 -1
- package/eslint/presets/typescript-react.js +4 -1
- package/eslint/presets/typescript.js +9 -1
- package/eslint/presets/typescript.test/main.ts +7 -0
- package/eslint/rules/javascript.js +2 -0
- package/eslint/rules/typescript.js +193 -193
- package/package.json +1 -1
- package/types/eslint/presets/javascript-browser.d.ts +3 -3
- package/types/eslint/presets/javascript-browser.d.ts.map +1 -1
- package/types/eslint/presets/javascript-node.d.ts +3 -3
- package/types/eslint/presets/javascript-node.d.ts.map +1 -1
- package/types/eslint/presets/javascript.d.ts +3 -3
- package/types/eslint/presets/javascript.d.ts.map +1 -1
- package/types/eslint/presets/typescript-node.d.ts +3 -3
- package/types/eslint/presets/typescript-node.d.ts.map +1 -1
- package/types/eslint/presets/typescript-react.d.ts +3 -3
- package/types/eslint/presets/typescript-react.d.ts.map +1 -1
- package/types/eslint/presets/typescript.d.ts +3 -3
- package/types/eslint/presets/typescript.d.ts.map +1 -1
- package/types/eslint/rules/javascript.d.ts.map +1 -1
- package/types/eslint/rules/typescript.d.ts +2 -1
- package/types/eslint/rules/typescript.d.ts.map +1 -1
- package/types/eslint/styles/no-default-export.test/eslint.config.d.ts +1 -1
- package/types/eslint/styles/no-null.test/eslint.config.d.ts +1 -1
- package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts +1 -1
- package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts +1 -1
- package/typescript/base.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [3.2.0](https://github.com/peerigon/configs/compare/v3.1.0...v3.2.0) (2025-03-06)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- Incorrect types returned by presets ([5744961](https://github.com/peerigon/configs/commit/5744961bb760c48738a4a74e8ae0d4f2bfe0abe5))
|
|
6
|
+
- Turn off consistent-return rule in TypeScript files ([0830152](https://github.com/peerigon/configs/commit/08301524f081fc2223c2ad72bf6cb630735ac712))
|
|
7
|
+
- Turn off no-new for tests ([26bc778](https://github.com/peerigon/configs/commit/26bc778ff2239cc61acb21825b72ca15ee3c1ef3))
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- Improve base tsconfig ([392b0ff](https://github.com/peerigon/configs/commit/392b0ff6b552e926c3ff77867952627e63f6a496))
|
|
12
|
+
|
|
1
13
|
# [3.1.0](https://github.com/peerigon/configs/compare/v3.0.0...v3.1.0) (2025-03-03)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/README.md
CHANGED
|
@@ -3,4 +3,12 @@ import { base } from "../rules/base.js";
|
|
|
3
3
|
import { browser } from "../rules/browser.js";
|
|
4
4
|
import { javascript } from "../rules/javascript.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
7
|
+
export const javascriptBrowserPreset = [
|
|
8
|
+
...base,
|
|
9
|
+
...javascript,
|
|
10
|
+
...browser,
|
|
11
|
+
eslintConfigPrettier,
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default javascriptBrowserPreset;
|
|
@@ -3,4 +3,12 @@ import { base } from "../rules/base.js";
|
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
4
|
import { node } from "../rules/node.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
7
|
+
export const javascriptNodePreset = [
|
|
8
|
+
...base,
|
|
9
|
+
...javascript,
|
|
10
|
+
...node,
|
|
11
|
+
eslintConfigPrettier,
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default javascriptNodePreset;
|
|
@@ -2,4 +2,7 @@ import eslintConfigPrettier from "eslint-config-prettier";
|
|
|
2
2
|
import { base } from "../rules/base.js";
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
6
|
+
export const javascriptPreset = [...base, ...javascript, eslintConfigPrettier];
|
|
7
|
+
|
|
8
|
+
export default javascriptPreset;
|
|
@@ -4,10 +4,13 @@ import { javascript } from "../rules/javascript.js";
|
|
|
4
4
|
import { node } from "../rules/node.js";
|
|
5
5
|
import { typescript } from "../rules/typescript.js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
8
|
+
export const typescriptNodePreset = [
|
|
8
9
|
...base,
|
|
9
10
|
...javascript,
|
|
10
11
|
...typescript,
|
|
11
12
|
...node,
|
|
12
13
|
eslintConfigPrettier,
|
|
13
14
|
];
|
|
15
|
+
|
|
16
|
+
export default typescriptNodePreset;
|
|
@@ -5,7 +5,8 @@ import { javascript } from "../rules/javascript.js";
|
|
|
5
5
|
import { react } from "../rules/react.js";
|
|
6
6
|
import { typescript } from "../rules/typescript.js";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
9
|
+
export const typescriptReactPreset = [
|
|
9
10
|
...base,
|
|
10
11
|
...javascript,
|
|
11
12
|
...typescript,
|
|
@@ -13,3 +14,5 @@ export default [
|
|
|
13
14
|
...browser,
|
|
14
15
|
eslintConfigPrettier,
|
|
15
16
|
];
|
|
17
|
+
|
|
18
|
+
export default typescriptReactPreset;
|
|
@@ -3,4 +3,12 @@ import { base } from "../rules/base.js";
|
|
|
3
3
|
import { javascript } from "../rules/javascript.js";
|
|
4
4
|
import { typescript } from "../rules/typescript.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
7
|
+
export const typescriptPreset = [
|
|
8
|
+
...base,
|
|
9
|
+
...javascript,
|
|
10
|
+
...typescript,
|
|
11
|
+
eslintConfigPrettier,
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default typescriptPreset;
|
|
@@ -148,6 +148,8 @@ export const javascript = [
|
|
|
148
148
|
"unicorn/prefer-top-level-await": "off",
|
|
149
149
|
// Nesting is pretty common in tests when you group tests
|
|
150
150
|
"max-nested-callbacks": "off",
|
|
151
|
+
// In case you want to test errors thrown by a constructor
|
|
152
|
+
"no-new": "off",
|
|
151
153
|
},
|
|
152
154
|
},
|
|
153
155
|
];
|
|
@@ -3,204 +3,204 @@ import tsEslint from "typescript-eslint";
|
|
|
3
3
|
import { globPatterns } from "../lib/glob-patterns.js";
|
|
4
4
|
import { ruleOptions } from "../lib/rule-options.js";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
/** @type {import("eslint").Linter.Config} */
|
|
23
|
-
{
|
|
24
|
-
files: [
|
|
25
|
-
globPatterns.typescript,
|
|
26
|
-
globPatterns.typescriptAmbient,
|
|
27
|
-
globPatterns.typescriptJsx,
|
|
28
|
-
],
|
|
29
|
-
plugins: {
|
|
30
|
-
["prefer-arrow"]: preferArrow,
|
|
31
|
-
},
|
|
32
|
-
rules: {
|
|
33
|
-
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
|
|
34
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
35
|
-
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
36
|
-
"warn",
|
|
37
|
-
{
|
|
38
|
-
"ts-expect-error": "allow-with-description",
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
"@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
|
|
42
|
-
"@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
43
|
-
"@typescript-eslint/explicit-member-accessibility": [
|
|
44
|
-
// https://typescript-eslint.io/rules/explicit-member-accessibility
|
|
45
|
-
"warn",
|
|
46
|
-
{
|
|
47
|
-
accessibility: "no-public",
|
|
48
|
-
overrides: {
|
|
49
|
-
parameterProperties: "explicit",
|
|
6
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
7
|
+
export const typescript =
|
|
8
|
+
// We need to do a type assertion here because tsEslint.config() returns
|
|
9
|
+
// something that is not assignable to import("eslint").Linter.Config[].
|
|
10
|
+
// This seems to be a type inconsistency between eslint and typescript-eslint.
|
|
11
|
+
/** @type {import("eslint").Linter.Config[]} */ (
|
|
12
|
+
tsEslint.config(
|
|
13
|
+
...tsEslint.configs.strictTypeChecked,
|
|
14
|
+
...tsEslint.configs.stylisticTypeChecked,
|
|
15
|
+
{
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parserOptions: {
|
|
18
|
+
projectService: true,
|
|
50
19
|
},
|
|
51
20
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
62
|
-
"off",
|
|
63
|
-
{
|
|
64
|
-
ignoreArrowShorthand: true,
|
|
65
|
-
ignoreVoidOperator: true,
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
"@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
|
|
69
|
-
"@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
|
|
70
|
-
// `any` is sometimes useful for small and abstract functions.
|
|
71
|
-
// Should only be used in isolated parts of the codebase.
|
|
72
|
-
// Appropriate usage can only be checked in a PR review.
|
|
73
|
-
"@typescript-eslint/no-explicit-any": [
|
|
74
|
-
// https://typescript-eslint.io/rules/no-explicit-any
|
|
75
|
-
"off",
|
|
76
|
-
{
|
|
77
|
-
fixToUnknown: false,
|
|
78
|
-
ignoreRestArgs: true,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
"@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
|
|
82
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
83
|
-
"@typescript-eslint/no-unnecessary-condition": [
|
|
84
|
-
"warn",
|
|
85
|
-
{
|
|
86
|
-
allowConstantLoopConditions: true,
|
|
87
|
-
},
|
|
88
|
-
], // https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
89
|
-
"@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
90
|
-
"@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
|
|
91
|
-
"@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
92
|
-
"@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
|
|
93
|
-
"@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
94
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
95
|
-
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
96
|
-
"warn",
|
|
97
|
-
{
|
|
98
|
-
allowShortCircuit: true,
|
|
99
|
-
allowTernary: true,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
"@typescript-eslint/no-unused-vars": [
|
|
103
|
-
// https://typescript-eslint.io/rules/no-unused-vars
|
|
104
|
-
"error",
|
|
105
|
-
ruleOptions["no-unused-vars"],
|
|
106
|
-
],
|
|
107
|
-
"@typescript-eslint/promise-function-async": [
|
|
108
|
-
// https://typescript-eslint.io/rules/promise-function-async
|
|
109
|
-
"warn",
|
|
110
|
-
{
|
|
111
|
-
allowAny: true,
|
|
112
|
-
allowedPromiseNames: [],
|
|
113
|
-
checkArrowFunctions: true,
|
|
114
|
-
checkFunctionDeclarations: true,
|
|
115
|
-
checkFunctionExpressions: true,
|
|
116
|
-
checkMethodDeclarations: true,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
"@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
|
|
120
|
-
"@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
|
|
121
|
-
"@typescript-eslint/restrict-template-expressions": [
|
|
122
|
-
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
123
|
-
"off",
|
|
124
|
-
{
|
|
125
|
-
allowBoolean: false,
|
|
126
|
-
allowNullable: false,
|
|
127
|
-
allowNumber: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
files: [
|
|
24
|
+
globPatterns.typescript,
|
|
25
|
+
globPatterns.typescriptAmbient,
|
|
26
|
+
globPatterns.typescriptJsx,
|
|
27
|
+
],
|
|
28
|
+
plugins: {
|
|
29
|
+
["prefer-arrow"]: preferArrow,
|
|
128
30
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
31
|
+
rules: {
|
|
32
|
+
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
|
|
33
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
34
|
+
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
35
|
+
"warn",
|
|
36
|
+
{
|
|
37
|
+
"ts-expect-error": "allow-with-description",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
"@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
|
|
41
|
+
"@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
42
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
43
|
+
// https://typescript-eslint.io/rules/explicit-member-accessibility
|
|
44
|
+
"warn",
|
|
45
|
+
{
|
|
46
|
+
accessibility: "no-public",
|
|
47
|
+
overrides: {
|
|
48
|
+
parameterProperties: "explicit",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
"@typescript-eslint/method-signature-style": ["warn", "property"], // https://typescript-eslint.io/rules/method-signature-style
|
|
53
|
+
"@typescript-eslint/naming-convention": [
|
|
54
|
+
// https://typescript-eslint.io/rules/naming-convention
|
|
55
|
+
"warn",
|
|
56
|
+
...ruleOptions["@typescript-eslint/naming-convention"].defaultRules,
|
|
57
|
+
],
|
|
58
|
+
"@typescript-eslint/no-base-to-string": "off", // https://typescript-eslint.io/rules/no-base-to-string
|
|
59
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
60
|
+
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
61
|
+
"off",
|
|
62
|
+
{
|
|
63
|
+
ignoreArrowShorthand: true,
|
|
64
|
+
ignoreVoidOperator: true,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
"@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
|
|
68
|
+
"@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
|
|
69
|
+
// `any` is sometimes useful for small and abstract functions.
|
|
70
|
+
// Should only be used in isolated parts of the codebase.
|
|
71
|
+
// Appropriate usage can only be checked in a PR review.
|
|
72
|
+
"@typescript-eslint/no-explicit-any": [
|
|
73
|
+
// https://typescript-eslint.io/rules/no-explicit-any
|
|
74
|
+
"off",
|
|
75
|
+
{
|
|
76
|
+
fixToUnknown: false,
|
|
77
|
+
ignoreRestArgs: true,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
"@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
|
|
81
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
82
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
83
|
+
"warn",
|
|
84
|
+
{
|
|
85
|
+
allowConstantLoopConditions: true,
|
|
86
|
+
},
|
|
87
|
+
], // https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
88
|
+
"@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
89
|
+
"@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
|
|
90
|
+
"@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
91
|
+
"@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
|
|
92
|
+
"@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
93
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
94
|
+
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
95
|
+
"warn",
|
|
96
|
+
{
|
|
97
|
+
allowShortCircuit: true,
|
|
98
|
+
allowTernary: true,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
"@typescript-eslint/no-unused-vars": [
|
|
102
|
+
// https://typescript-eslint.io/rules/no-unused-vars
|
|
103
|
+
"error",
|
|
104
|
+
ruleOptions["no-unused-vars"],
|
|
105
|
+
],
|
|
106
|
+
"@typescript-eslint/promise-function-async": [
|
|
107
|
+
// https://typescript-eslint.io/rules/promise-function-async
|
|
108
|
+
"warn",
|
|
109
|
+
{
|
|
110
|
+
allowAny: true,
|
|
111
|
+
allowedPromiseNames: [],
|
|
112
|
+
checkArrowFunctions: true,
|
|
113
|
+
checkFunctionDeclarations: true,
|
|
114
|
+
checkFunctionExpressions: true,
|
|
115
|
+
checkMethodDeclarations: true,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
"@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
|
|
119
|
+
"@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
|
|
120
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
121
|
+
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
122
|
+
"off",
|
|
123
|
+
{
|
|
124
|
+
allowBoolean: false,
|
|
125
|
+
allowNullable: false,
|
|
126
|
+
allowNumber: true,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
// TS' noImplicitReturns catches this already more effectively
|
|
130
|
+
"consistent-return": "off",
|
|
131
|
+
"no-return-await": "off",
|
|
132
|
+
"@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://typescript-eslint.io/rules/return-await
|
|
133
|
+
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
134
|
+
"warn",
|
|
135
|
+
{
|
|
136
|
+
// It should not be necessary to list all possible values for a union type
|
|
137
|
+
// explicitly in a switch statement. E.g. if the types are generated, we don't
|
|
138
|
+
// want to adjust all switch statements every time the types are changed.
|
|
139
|
+
considerDefaultExhaustiveForUnions: true,
|
|
140
|
+
},
|
|
141
|
+
], // https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
142
|
+
camelcase: "off",
|
|
143
|
+
"max-lines": [
|
|
144
|
+
"warn",
|
|
145
|
+
{
|
|
146
|
+
max: 1400,
|
|
147
|
+
skipBlankLines: true,
|
|
148
|
+
skipComments: true,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
"func-style": ["warn", "expression"], // https://eslint.org/docs/latest/rules/func-style
|
|
152
|
+
"prefer-arrow/prefer-arrow-functions": [
|
|
153
|
+
// https://github.com/TristonJ/eslint-plugin-prefer-arrow
|
|
154
|
+
"warn",
|
|
155
|
+
{
|
|
156
|
+
disallowPrototype: false,
|
|
157
|
+
singleReturnOnly: false,
|
|
158
|
+
// We used to enforce arrow functions also for class methods (as class properties)
|
|
159
|
+
// but arrow functions in sub-classes can't call their overridden counterpart
|
|
160
|
+
// in their super-class, see https://stackoverflow.com/a/52823577
|
|
161
|
+
classPropertiesAllowed: false,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
139
165
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
files: globPatterns.typescriptAmbient,
|
|
169
|
+
rules: {
|
|
170
|
+
// In d.ts files it might be necessary to merge an existing interface
|
|
171
|
+
"@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
172
|
+
// In d.ts files it's sometimes necessary to overload existing methods
|
|
173
|
+
"@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
|
|
174
|
+
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
175
|
+
// Unused vars can be common in d.ts files when declaration merging is used
|
|
176
|
+
"@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
|
|
177
|
+
// Since d.ts files are used to type external modules, we can't control the coding style
|
|
178
|
+
"import/no-default-export": "off",
|
|
179
|
+
// When someone wants to extend the typings of a third-party module, it might
|
|
180
|
+
// be necessary to import the module so that TypeScript finds the typings that should be extended.
|
|
181
|
+
// This is a better alternative to the triple-slash directive
|
|
182
|
+
"import/no-unassigned-import": "off",
|
|
148
183
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// We
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
files: globPatterns.tests,
|
|
187
|
+
rules: {
|
|
188
|
+
// Type assertions are quite common in tests
|
|
189
|
+
"@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
|
|
190
|
+
// Mocking often requires to mock objects with a different naming convention
|
|
191
|
+
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
192
|
+
// We allow any to be used in tests, so returning it is ok
|
|
193
|
+
"@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
|
|
194
|
+
// chai uses these as assertions
|
|
195
|
+
"@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
|
|
196
|
+
// It's uncommon to use async/await in Cypress tests
|
|
197
|
+
// https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
|
|
198
|
+
"@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
|
|
199
|
+
// Passing functions around like this can be common with mocking
|
|
200
|
+
"@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
|
|
161
201
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
/** @type {import("eslint").Linter.Config} */
|
|
167
|
-
{
|
|
168
|
-
files: globPatterns.typescriptAmbient,
|
|
169
|
-
rules: {
|
|
170
|
-
// In d.ts files it might be necessary to merge an existing interface
|
|
171
|
-
"@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
172
|
-
// In d.ts files it's sometimes necessary to overload existing methods
|
|
173
|
-
"@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
|
|
174
|
-
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
175
|
-
// Unused vars can be common in d.ts files when declaration merging is used
|
|
176
|
-
"@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
|
|
177
|
-
// Since d.ts files are used to type external modules, we can't control the coding style
|
|
178
|
-
"import/no-default-export": "off",
|
|
179
|
-
// When someone wants to extend the typings of a third-party module, it might
|
|
180
|
-
// be necessary to import the module so that TypeScript finds the typings that should be extended.
|
|
181
|
-
// This is a better alternative to the triple-slash directive
|
|
182
|
-
"import/no-unassigned-import": "off",
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
/** @type {import("eslint").Linter.Config} */
|
|
186
|
-
{
|
|
187
|
-
files: globPatterns.tests,
|
|
188
|
-
rules: {
|
|
189
|
-
// Type assertions are quite common in tests
|
|
190
|
-
"@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
|
|
191
|
-
// Mocking often requires to mock objects with a different naming convention
|
|
192
|
-
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
193
|
-
// We allow any to be used in tests, so returning it is ok
|
|
194
|
-
"@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
|
|
195
|
-
// chai uses these as assertions
|
|
196
|
-
"@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
|
|
197
|
-
// It's uncommon to use async/await in Cypress tests
|
|
198
|
-
// https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
|
|
199
|
-
"@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
|
|
200
|
-
// Passing functions around like this can be common with mocking
|
|
201
|
-
"@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
);
|
|
202
|
+
},
|
|
203
|
+
)
|
|
204
|
+
);
|
|
205
205
|
|
|
206
206
|
export default typescript;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const javascriptBrowserPreset: import("eslint").Linter.Config[];
|
|
3
|
+
export default javascriptBrowserPreset;
|
|
4
4
|
//# sourceMappingURL=javascript-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript-browser.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-browser.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"javascript-browser.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-browser.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,sCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAMzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const javascriptNodePreset: import("eslint").Linter.Config[];
|
|
3
|
+
export default javascriptNodePreset;
|
|
4
4
|
//# sourceMappingURL=javascript-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-node.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"javascript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-node.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,mCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAMzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const javascriptPreset: import("eslint").Linter.Config[];
|
|
3
|
+
export default javascriptPreset;
|
|
4
4
|
//# sourceMappingURL=javascript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript.js"],"names":[],"mappings":"AAIA,+CAA+C;AAC/C,+BADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CACoC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const typescriptNodePreset: import("eslint").Linter.Config[];
|
|
3
|
+
export default typescriptNodePreset;
|
|
4
4
|
//# sourceMappingURL=typescript-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-node.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-node.js"],"names":[],"mappings":"AAMA,+CAA+C;AAC/C,mCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAOzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const typescriptReactPreset: import("eslint").Linter.Config[];
|
|
3
|
+
export default typescriptReactPreset;
|
|
4
4
|
//# sourceMappingURL=typescript-react.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-react.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-react.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript-react.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-react.js"],"names":[],"mappings":"AAOA,+CAA+C;AAC/C,oCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAQzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const typescriptPreset: import("eslint").Linter.Config[];
|
|
3
|
+
export default typescriptPreset;
|
|
4
4
|
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,+BADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAMzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/javascript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,yBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/javascript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,yBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAqJzC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const typescript: import("eslint").Linter.Config[];
|
|
2
3
|
export default typescript;
|
|
3
4
|
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/typescript.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/typescript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,yBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAsMvC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=eslint.config.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=eslint.config.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=eslint.config.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=eslint.config.d.ts.map
|
package/typescript/base.json
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
// == Strictness settings ==
|
|
13
13
|
"strict": true,
|
|
14
14
|
"noImplicitOverride": true,
|
|
15
|
+
// Warns about functions with implicit returns where other code paths return a value.
|
|
16
|
+
// This option is basically the same as ESLint's `consistent-return` rule.
|
|
15
17
|
"noImplicitReturns": true,
|
|
16
18
|
"noUncheckedIndexedAccess": true,
|
|
17
19
|
"noUncheckedSideEffectImports": true,
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
"allowImportingTsExtensions": true,
|
|
27
29
|
|
|
28
30
|
// == Other settings ==
|
|
31
|
+
"allowJs": true,
|
|
29
32
|
"checkJs": true,
|
|
30
33
|
"forceConsistentCasingInFileNames": true,
|
|
31
34
|
// Using noEmit true here because you should have a separate build config anyway
|
|
@@ -36,5 +39,6 @@
|
|
|
36
39
|
"skipLibCheck": false,
|
|
37
40
|
"verbatimModuleSyntax": true
|
|
38
41
|
},
|
|
42
|
+
"exclude": ["dist"],
|
|
39
43
|
"$schema": "https://json.schemastore.org/tsconfig"
|
|
40
44
|
}
|