@pob/eslint-config 67.14.0 → 68.0.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/lib/_base.js +21 -31
- package/lib/eslint-rules.test.js +1 -3
- package/lib/index.js +77 -343
- package/lib/index.test.js +76 -40
- package/lib/node.js +60 -0
- package/lib/overrides/dev-only.js +10 -0
- package/lib/overrides/scripts.js +1 -1
- package/lib/overrides/test.js +7 -45
- package/lib/overrides/tools-project.js +4 -10
- package/lib/oxlint-js-plugins-rules.test.js +62 -0
- package/lib/oxlint-rules.test.js +2 -4
- package/lib/oxlint.test.js +58 -46
- package/lib/plugins/import.js +69 -0
- package/lib/typescript.js +27 -0
- package/oxlint/base.json +4 -0
- package/oxlint/commonjs.json +17 -0
- package/package.json +6 -13
- package/lib/base/commonjs.js +0 -12
- package/lib/base/module.js +0 -29
- package/lib/node/_base.js +0 -35
- package/lib/node/commonjs.js +0 -25
- package/lib/node/module.js +0 -35
- package/lib/node/typescript.js +0 -15
- package/lib/overrides/allow-implicit-return-type.js +0 -7
- package/lib/overrides/allow-unsafe-as-warn.js +0 -10
- package/lib/overrides/allow-unsafe.js +0 -10
- package/lib/overrides/app.js +0 -8
- package/lib/plugins/import/import-base.js +0 -136
- package/lib/plugins/import/import-commonjs.js +0 -7
- package/lib/plugins/import/import-module.js +0 -7
- package/lib/plugins/node.js +0 -17
- package/lib/plugins/regexp.js +0 -12
- package/lib/plugins/typescript-eslint/typescript-eslint-replace-eslint.js +0 -126
- package/lib/plugins/typescript-eslint/typescript-eslint-replace-unicorn.js +0 -13
- package/lib/plugins/typescript-eslint/typescript-eslint-rules.js +0 -213
- package/lib/plugins/unicorn.js +0 -392
- package/lib/rules/best-practices.js +0 -470
- package/lib/rules/code-quality.js +0 -10
- package/lib/rules/dev-only.js +0 -15
- package/lib/rules/errors.js +0 -128
- package/lib/rules/node.js +0 -26
- package/lib/rules/style.js +0 -26
- package/lib/rules/typescript.js +0 -61
- package/lib/utils/oxlint.js +0 -136
- package/lib/utils/oxlint.test.js +0 -197
package/lib/node/commonjs.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import pobPlugin from "@pob/eslint-plugin";
|
|
2
|
-
import { createNodeResolver } from "eslint-plugin-import-x";
|
|
3
|
-
import nodePlugin from "eslint-plugin-n";
|
|
4
|
-
import { overrideRules } from "./_base.js";
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
nodePlugin.configs["flat/recommended-script"],
|
|
8
|
-
pobPlugin.configs.node,
|
|
9
|
-
{
|
|
10
|
-
name: "@pob/eslint-config/node/commonjs",
|
|
11
|
-
settings: {
|
|
12
|
-
"import-x/resolver-next": [
|
|
13
|
-
createNodeResolver({
|
|
14
|
-
conditionNames: ["require", "default", "node"],
|
|
15
|
-
}),
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
rules: {
|
|
19
|
-
...overrideRules,
|
|
20
|
-
// "unicorn/prefer-module": "off",
|
|
21
|
-
"n/no-new-require": "error",
|
|
22
|
-
"n/no-path-concat": "error",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
];
|
package/lib/node/module.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import pobPlugin from "@pob/eslint-plugin";
|
|
2
|
-
import { createNodeResolver } from "eslint-plugin-import-x";
|
|
3
|
-
import nodePlugin from "eslint-plugin-n";
|
|
4
|
-
import { overrideRules } from "./_base.js";
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
nodePlugin.configs["flat/recommended-module"],
|
|
8
|
-
pobPlugin.configs.node,
|
|
9
|
-
{
|
|
10
|
-
name: "@pob/eslint-config/node/module",
|
|
11
|
-
settings: {
|
|
12
|
-
"import-x/resolver-next": [
|
|
13
|
-
createNodeResolver({
|
|
14
|
-
conditionNames: ["node", "import"],
|
|
15
|
-
}),
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
rules: {
|
|
19
|
-
...overrideRules,
|
|
20
|
-
"unicorn/prefer-module": "error",
|
|
21
|
-
"unicorn/import-index": "off",
|
|
22
|
-
|
|
23
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/import/extensions.md
|
|
24
|
-
"import-x/extensions": [
|
|
25
|
-
"error",
|
|
26
|
-
"ignorePackages",
|
|
27
|
-
{
|
|
28
|
-
mjs: "always",
|
|
29
|
-
cjs: "always",
|
|
30
|
-
js: "always",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
];
|
package/lib/node/typescript.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createNodeResolver } from "eslint-plugin-import-x";
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
{
|
|
5
|
-
name: "@pob/eslint-config/node/typescript",
|
|
6
|
-
settings: {
|
|
7
|
-
"import-x/resolver-next": [
|
|
8
|
-
createNodeResolver({
|
|
9
|
-
extensions: [".mjs", ".js", ".json", ".ts"],
|
|
10
|
-
conditionNames: ["node", "import"],
|
|
11
|
-
}),
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/overrides/allow-unsafe-as-warn",
|
|
3
|
-
rules: {
|
|
4
|
-
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
5
|
-
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
6
|
-
"@typescript-eslint/no-unsafe-call": "warn",
|
|
7
|
-
"@typescript-eslint/no-unsafe-member-access": "warn",
|
|
8
|
-
"@typescript-eslint/no-unsafe-return": "warn",
|
|
9
|
-
},
|
|
10
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/overrides/allow-unsafe",
|
|
3
|
-
rules: {
|
|
4
|
-
"@typescript-eslint/no-unsafe-argument": "off",
|
|
5
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
6
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
7
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
8
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
9
|
-
},
|
|
10
|
-
};
|
package/lib/overrides/app.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { createNodeResolver, flatConfigs } from "eslint-plugin-import-x";
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
flatConfigs.recommended,
|
|
5
|
-
{
|
|
6
|
-
name: "@pob/eslint-config/import/base",
|
|
7
|
-
// override recommended language options
|
|
8
|
-
languageOptions: {
|
|
9
|
-
ecmaVersion: "latest",
|
|
10
|
-
sourceType: "module",
|
|
11
|
-
},
|
|
12
|
-
settings: {
|
|
13
|
-
"import-x/extensions": [".js", ".mjs"],
|
|
14
|
-
"import-x/ignore": ["node_modules"],
|
|
15
|
-
"import-x/parsers": {
|
|
16
|
-
// https://github.com/un-ts/eslint-plugin-import-x/issues/2556#issuecomment-1419518561
|
|
17
|
-
espree: [".js", ".cjs", ".mjs"],
|
|
18
|
-
"@typescript-eslint/parser": [".ts"],
|
|
19
|
-
},
|
|
20
|
-
"import-x/resolver-next": [createNodeResolver()],
|
|
21
|
-
},
|
|
22
|
-
rules: {
|
|
23
|
-
// disable in recommended
|
|
24
|
-
"import-x/default": "off",
|
|
25
|
-
|
|
26
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
|
|
27
|
-
"import-x/no-unresolved": [
|
|
28
|
-
"error",
|
|
29
|
-
{ commonjs: true, caseSensitive: true },
|
|
30
|
-
],
|
|
31
|
-
|
|
32
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/named.md
|
|
33
|
-
"import-x/named": "error",
|
|
34
|
-
|
|
35
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/export.md
|
|
36
|
-
"import-x/export": "error",
|
|
37
|
-
|
|
38
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default.md
|
|
39
|
-
"import-x/no-named-as-default": "error",
|
|
40
|
-
|
|
41
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default-member.md
|
|
42
|
-
"import-x/no-named-as-default-member": "error",
|
|
43
|
-
|
|
44
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-deprecated.md
|
|
45
|
-
"import-x/no-deprecated": "off",
|
|
46
|
-
|
|
47
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
48
|
-
"import-x/no-extraneous-dependencies": "error",
|
|
49
|
-
|
|
50
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-mutable-exports.md
|
|
51
|
-
"import-x/no-mutable-exports": "error",
|
|
52
|
-
|
|
53
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-amd.md
|
|
54
|
-
"import-x/no-amd": "error",
|
|
55
|
-
|
|
56
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
|
|
57
|
-
"import-x/first": "error",
|
|
58
|
-
|
|
59
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
|
|
60
|
-
"import-x/no-duplicates": "error",
|
|
61
|
-
|
|
62
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
|
|
63
|
-
"import-x/newline-after-import": "error",
|
|
64
|
-
|
|
65
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
|
|
66
|
-
"import-x/prefer-default-export": "off",
|
|
67
|
-
|
|
68
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-absolute-path.md
|
|
69
|
-
"import-x/no-absolute-path": "error",
|
|
70
|
-
|
|
71
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-dynamic-require.md
|
|
72
|
-
"import-x/no-dynamic-require": "error",
|
|
73
|
-
|
|
74
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
75
|
-
"import-x/no-webpack-loader-syntax": "error",
|
|
76
|
-
|
|
77
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-default.md
|
|
78
|
-
"import-x/no-named-default": "error",
|
|
79
|
-
|
|
80
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
|
|
81
|
-
"import-x/no-self-import": "error",
|
|
82
|
-
|
|
83
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
|
|
84
|
-
"import-x/no-cycle": ["error", { maxDepth: "∞" }],
|
|
85
|
-
|
|
86
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
|
|
87
|
-
"import-x/no-useless-path-segments": ["error", { commonjs: true }],
|
|
88
|
-
|
|
89
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-import-module-exports.md
|
|
90
|
-
"import-x/no-import-module-exports": "error",
|
|
91
|
-
|
|
92
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
|
|
93
|
-
"import-x/no-relative-packages": "error",
|
|
94
|
-
|
|
95
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
|
|
96
|
-
"import-x/no-empty-named-blocks": "error",
|
|
97
|
-
|
|
98
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
|
|
99
|
-
"import-x/order": [
|
|
100
|
-
"error",
|
|
101
|
-
{
|
|
102
|
-
groups: [
|
|
103
|
-
"builtin",
|
|
104
|
-
"external",
|
|
105
|
-
"internal",
|
|
106
|
-
"parent",
|
|
107
|
-
"sibling",
|
|
108
|
-
"index",
|
|
109
|
-
],
|
|
110
|
-
alphabetize: { order: "asc", caseInsensitive: false },
|
|
111
|
-
"newlines-between": "never",
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "@pob/eslint-config/import/rollup-config",
|
|
118
|
-
files: ["rollup.config.js", "rollup.config.mjs"],
|
|
119
|
-
rules: {
|
|
120
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
|
|
121
|
-
"import-x/no-relative-packages": "off",
|
|
122
|
-
|
|
123
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
|
|
124
|
-
"import-x/order": "off",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
name: "@pob/eslint-config/import/typescript",
|
|
130
|
-
files: ["*.ts"],
|
|
131
|
-
rules: {
|
|
132
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md
|
|
133
|
-
"import-x/consistent-type-specifier-style": "error",
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
];
|
package/lib/plugins/node.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/plugins/node",
|
|
3
|
-
|
|
4
|
-
rules: {
|
|
5
|
-
// Disable rules already checked by import plugin
|
|
6
|
-
"n/no-unpublished-require": "off",
|
|
7
|
-
"n/no-extraneous-require": "off",
|
|
8
|
-
"n/no-unpublished-import": "off",
|
|
9
|
-
"n/no-extraneous-import": "off",
|
|
10
|
-
"n/no-missing-require": "off",
|
|
11
|
-
"n/no-missing-import": "off",
|
|
12
|
-
|
|
13
|
-
// disable no-unsupported-features when using babel
|
|
14
|
-
"n/no-unsupported-features/es-builtins": "off",
|
|
15
|
-
"n/no-unsupported-features/es-syntax": "off",
|
|
16
|
-
},
|
|
17
|
-
};
|
package/lib/plugins/regexp.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import pobBestPracticesConfig from "@pob/eslint-config/lib/rules/best-practices";
|
|
2
|
-
import pobCodeQualityConfig from "@pob/eslint-config/lib/rules/code-quality";
|
|
3
|
-
import pobErrorsConfig from "@pob/eslint-config/lib/rules/errors";
|
|
4
|
-
import pobStyleConfig from "@pob/eslint-config/lib/rules/style";
|
|
5
|
-
|
|
6
|
-
const getRuleValue = (config, ruleName) => {
|
|
7
|
-
const value = config[ruleName];
|
|
8
|
-
if (value == null) {
|
|
9
|
-
throw new Error(`getRuleValue: missing value for rule "${ruleName}"`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return value;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const replaceRules = (config, ruleNames) => {
|
|
16
|
-
return Object.fromEntries(
|
|
17
|
-
ruleNames.flatMap((ruleName) => [
|
|
18
|
-
[ruleName, "off"],
|
|
19
|
-
[`@typescript-eslint/${ruleName}`, getRuleValue(config, ruleName)],
|
|
20
|
-
]),
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const disabledRules = (ruleNames) => {
|
|
25
|
-
return Object.fromEntries(
|
|
26
|
-
ruleNames.map((ruleName) => {
|
|
27
|
-
[
|
|
28
|
-
pobBestPracticesConfig.rules,
|
|
29
|
-
pobCodeQualityConfig.rules,
|
|
30
|
-
pobErrorsConfig.rules,
|
|
31
|
-
pobStyleConfig.rules,
|
|
32
|
-
].forEach((config) => {
|
|
33
|
-
const value = config[ruleName];
|
|
34
|
-
if (value != null && value !== "off") {
|
|
35
|
-
throw new Error(`disabledRules: value for rule "${ruleName}" exists`);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return [ruleName, "off"];
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const disableRules = (ruleNames) => {
|
|
44
|
-
return Object.fromEntries(ruleNames.map((ruleName) => [ruleName, "off"]));
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default {
|
|
48
|
-
name: "@pob/eslint-config/typescript-eslint/replace-eslint",
|
|
49
|
-
/* Replace enabled rules in Airbnb by typescript-eslint rules */
|
|
50
|
-
rules: {
|
|
51
|
-
...replaceRules(pobBestPracticesConfig.rules, [
|
|
52
|
-
// https://typescript-eslint.io/rules/default-param-last
|
|
53
|
-
"default-param-last",
|
|
54
|
-
// https://typescript-eslint.io/rules/dot-notation
|
|
55
|
-
"dot-notation",
|
|
56
|
-
// https://typescript-eslint.io/rules/no-array-constructor
|
|
57
|
-
"no-array-constructor",
|
|
58
|
-
// https://typescript-eslint.io/rules/no-dupe-class-members
|
|
59
|
-
"no-dupe-class-members",
|
|
60
|
-
// https://typescript-eslint.io/rules/no-empty-function
|
|
61
|
-
"no-empty-function",
|
|
62
|
-
// https://typescript-eslint.io/rules/no-implied-eval
|
|
63
|
-
"no-implied-eval",
|
|
64
|
-
// https://typescript-eslint.io/rules/no-loop-func
|
|
65
|
-
"no-loop-func",
|
|
66
|
-
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
67
|
-
"no-unused-expressions",
|
|
68
|
-
// https://typescript-eslint.io/rules/no-unused-vars
|
|
69
|
-
"no-unused-vars",
|
|
70
|
-
// https://typescript-eslint.io/rules/no-use-before-define
|
|
71
|
-
"no-use-before-define",
|
|
72
|
-
// https://typescript-eslint.io/rules/no-useless-constructor
|
|
73
|
-
"no-useless-constructor",
|
|
74
|
-
// https://typescript-eslint.io/rules/require-await
|
|
75
|
-
"require-await",
|
|
76
|
-
// https://typescript-eslint.io/rules/consistent-return
|
|
77
|
-
"consistent-return",
|
|
78
|
-
// https://typescript-eslint.io/rules/class-methods-use-this
|
|
79
|
-
"class-methods-use-this",
|
|
80
|
-
// https://typescript-eslint.io/rules/max-params
|
|
81
|
-
"max-params",
|
|
82
|
-
]),
|
|
83
|
-
|
|
84
|
-
...disabledRules([
|
|
85
|
-
// https://typescript-eslint.io/rules/brace-style
|
|
86
|
-
"brace-style",
|
|
87
|
-
// https://typescript-eslint.io/rules/comma-dangle
|
|
88
|
-
"comma-dangle",
|
|
89
|
-
// https://typescript-eslint.io/rules/comma-spacing
|
|
90
|
-
"comma-spacing",
|
|
91
|
-
// https://typescript-eslint.io/rules/func-call-spacing
|
|
92
|
-
"func-call-spacing",
|
|
93
|
-
// https://typescript-eslint.io/rules/indent
|
|
94
|
-
"indent",
|
|
95
|
-
// https://typescript-eslint.io/rules/init-declarations
|
|
96
|
-
"init-declarations",
|
|
97
|
-
// https://typescript-eslint.io/rules/keyword-spacing
|
|
98
|
-
"keyword-spacing",
|
|
99
|
-
// https://typescript-eslint.io/rules/lines-between-class-members
|
|
100
|
-
"lines-between-class-members",
|
|
101
|
-
// https://typescript-eslint.io/rules/no-magic-numbers
|
|
102
|
-
"no-magic-numbers",
|
|
103
|
-
// https://typescript-eslint.io/rules/no-restricted-imports
|
|
104
|
-
"no-restricted-imports",
|
|
105
|
-
// https://typescript-eslint.io/rules/no-shadow
|
|
106
|
-
"no-shadow",
|
|
107
|
-
// https://typescript-eslint.io/rules/object-curly-spacing
|
|
108
|
-
"object-curly-spacing",
|
|
109
|
-
// https://typescript-eslint.io/rules/padding-line-between-statements
|
|
110
|
-
"padding-line-between-statements",
|
|
111
|
-
// https://typescript-eslint.io/rules/semi
|
|
112
|
-
"semi",
|
|
113
|
-
// https://typescript-eslint.io/rules/prefer-destructuring
|
|
114
|
-
"prefer-destructuring",
|
|
115
|
-
]),
|
|
116
|
-
|
|
117
|
-
/* covered by tsc */
|
|
118
|
-
|
|
119
|
-
...disableRules([
|
|
120
|
-
// https://typescript-eslint.io/rules/no-invalid-this
|
|
121
|
-
"no-invalid-this",
|
|
122
|
-
// https://typescript-eslint.io/rules/no-redeclare
|
|
123
|
-
"no-redeclare",
|
|
124
|
-
]),
|
|
125
|
-
},
|
|
126
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/typescript-eslint/replace-unicorn",
|
|
3
|
-
|
|
4
|
-
/* Replace unicorn rules by better type-aware typescript-eslint rules */
|
|
5
|
-
rules: {
|
|
6
|
-
"unicorn/prefer-string-starts-ends-with": "off",
|
|
7
|
-
"unicorn/prefer-string-slice": "off",
|
|
8
|
-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
9
|
-
|
|
10
|
-
"unicorn/prefer-array-find": "off",
|
|
11
|
-
"@typescript-eslint/prefer-find": "error",
|
|
12
|
-
},
|
|
13
|
-
};
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { enableIfVSCode } from "@pob/eslint-config/utils";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
name: "@pob/eslint-config/typescript-eslint/rules",
|
|
5
|
-
|
|
6
|
-
rules: {
|
|
7
|
-
// https://typescript-eslint.io/rules/adjacent-overload-signatures/
|
|
8
|
-
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
9
|
-
|
|
10
|
-
// https://typescript-eslint.io/rules/array-type/
|
|
11
|
-
"@typescript-eslint/array-type": "error",
|
|
12
|
-
|
|
13
|
-
// https://typescript-eslint.io/rules/ban-tslint-comment/
|
|
14
|
-
"@typescript-eslint/ban-tslint-comment": "error",
|
|
15
|
-
|
|
16
|
-
// https://typescript-eslint.io/rules/class-literal-property-style/
|
|
17
|
-
"@typescript-eslint/class-literal-property-style": "error",
|
|
18
|
-
|
|
19
|
-
// https://typescript-eslint.io/rules/consistent-generic-constructors/
|
|
20
|
-
"@typescript-eslint/consistent-generic-constructors": "error",
|
|
21
|
-
|
|
22
|
-
// https://typescript-eslint.io/rules/consistent-indexed-object-style/
|
|
23
|
-
"@typescript-eslint/consistent-indexed-object-style": "error",
|
|
24
|
-
|
|
25
|
-
// https://typescript-eslint.io/rules/consistent-type-assertions/
|
|
26
|
-
"@typescript-eslint/consistent-type-assertions": [
|
|
27
|
-
"error",
|
|
28
|
-
{
|
|
29
|
-
assertionStyle: "as",
|
|
30
|
-
objectLiteralTypeAssertions: "allow-as-parameter",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
// https://typescript-eslint.io/rules/consistent-type-definitions/
|
|
35
|
-
"@typescript-eslint/consistent-type-definitions": "error",
|
|
36
|
-
|
|
37
|
-
// https://typescript-eslint.io/rules/consistent-type-exports/
|
|
38
|
-
"@typescript-eslint/consistent-type-exports": "error",
|
|
39
|
-
|
|
40
|
-
// https://typescript-eslint.io/rules/consistent-type-imports/
|
|
41
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
42
|
-
|
|
43
|
-
// https://typescript-eslint.io/rules/explicit-function-return-type/
|
|
44
|
-
"@typescript-eslint/explicit-function-return-type": [
|
|
45
|
-
"error",
|
|
46
|
-
{
|
|
47
|
-
allowExpressions: true,
|
|
48
|
-
allowTypedFunctionExpressions: true,
|
|
49
|
-
allowHigherOrderFunctions: true,
|
|
50
|
-
allowDirectConstAssertionInArrowFunctions: true,
|
|
51
|
-
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
|
|
52
|
-
allowFunctionsWithoutTypeParameters: false,
|
|
53
|
-
allowedNames: [],
|
|
54
|
-
allowIIFEs: false,
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
|
|
58
|
-
// https://typescript-eslint.io/rules/explicit-member-accessibility/
|
|
59
|
-
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
60
|
-
|
|
61
|
-
// https://typescript-eslint.io/rules/explicit-module-boundary-types/
|
|
62
|
-
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
63
|
-
|
|
64
|
-
// https://typescript-eslint.io/rules/method-signature-style/
|
|
65
|
-
"@typescript-eslint/method-signature-style": "error",
|
|
66
|
-
|
|
67
|
-
// https://typescript-eslint.io/rules/naming-convention/
|
|
68
|
-
"@typescript-eslint/naming-convention": [
|
|
69
|
-
enableIfVSCode("warn"),
|
|
70
|
-
// Enforce that interface names do not begin with an I
|
|
71
|
-
{
|
|
72
|
-
selector: "interface",
|
|
73
|
-
format: ["PascalCase"],
|
|
74
|
-
custom: {
|
|
75
|
-
regex: "^I[A-Z]",
|
|
76
|
-
match: false,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
// Enforce that type is in PascalCase
|
|
80
|
-
{
|
|
81
|
-
selector: "typeLike",
|
|
82
|
-
format: ["PascalCase"],
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
|
|
86
|
-
// https://typescript-eslint.io/rules/no-confusing-non-null-assertion/
|
|
87
|
-
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
88
|
-
|
|
89
|
-
// https://typescript-eslint.io/rules/no-floating-promises/
|
|
90
|
-
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: false }],
|
|
91
|
-
|
|
92
|
-
// https://typescript-eslint.io/rules/no-import-type-side-effects/
|
|
93
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
94
|
-
|
|
95
|
-
// https://typescript-eslint.io/rules/no-inferrable-types/
|
|
96
|
-
"@typescript-eslint/no-inferrable-types": "error",
|
|
97
|
-
|
|
98
|
-
// https://typescript-eslint.io/rules/no-require-imports/
|
|
99
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
100
|
-
|
|
101
|
-
// https://typescript-eslint.io/rules/no-unnecessary-qualifier/
|
|
102
|
-
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
103
|
-
|
|
104
|
-
// https://typescript-eslint.io/rules/no-unsafe-unary-minus/
|
|
105
|
-
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
106
|
-
|
|
107
|
-
// https://typescript-eslint.io/rules/no-useless-empty-export/
|
|
108
|
-
"@typescript-eslint/no-useless-empty-export": "error",
|
|
109
|
-
|
|
110
|
-
// https://typescript-eslint.io/rules/non-nullable-type-assertion-style/
|
|
111
|
-
"@typescript-eslint/non-nullable-type-assertion-style": "error",
|
|
112
|
-
|
|
113
|
-
// https://typescript-eslint.io/rules/parameter-properties/
|
|
114
|
-
"@typescript-eslint/parameter-properties": "error",
|
|
115
|
-
|
|
116
|
-
// https://typescript-eslint.io/rules/prefer-enum-initializers/
|
|
117
|
-
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
118
|
-
|
|
119
|
-
// https://typescript-eslint.io/rules/prefer-find/
|
|
120
|
-
"@typescript-eslint/prefer-find": "error",
|
|
121
|
-
|
|
122
|
-
// https://typescript-eslint.io/rules/prefer-for-of/
|
|
123
|
-
"@typescript-eslint/prefer-for-of": "off",
|
|
124
|
-
|
|
125
|
-
// https://typescript-eslint.io/rules/prefer-function-type/
|
|
126
|
-
"@typescript-eslint/prefer-function-type": "error",
|
|
127
|
-
|
|
128
|
-
// https://typescript-eslint.io/rules/prefer-namespace-keyword/
|
|
129
|
-
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
130
|
-
|
|
131
|
-
// https://typescript-eslint.io/rules/prefer-nullish-coalescing/
|
|
132
|
-
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
133
|
-
|
|
134
|
-
// https://typescript-eslint.io/rules/prefer-optional-chain/
|
|
135
|
-
"@typescript-eslint/prefer-optional-chain": "error",
|
|
136
|
-
|
|
137
|
-
// https://typescript-eslint.io/rules/prefer-readonly/
|
|
138
|
-
"@typescript-eslint/prefer-readonly": "off",
|
|
139
|
-
|
|
140
|
-
// https://typescript-eslint.io/rules/prefer-readonly-parameter-types/
|
|
141
|
-
// too verbose and eslint already makes sure we don't modify parameters
|
|
142
|
-
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
143
|
-
|
|
144
|
-
// https://typescript-eslint.io/rules/prefer-regexp-exec/
|
|
145
|
-
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
146
|
-
|
|
147
|
-
// https://typescript-eslint.io/rules/prefer-string-starts-ends-with/
|
|
148
|
-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
149
|
-
|
|
150
|
-
// https://typescript-eslint.io/rules/promise-function-async/
|
|
151
|
-
"@typescript-eslint/promise-function-async": "off",
|
|
152
|
-
|
|
153
|
-
// https://typescript-eslint.io/rules/require-array-sort-compare/
|
|
154
|
-
"@typescript-eslint/require-array-sort-compare": "off",
|
|
155
|
-
|
|
156
|
-
// https://typescript-eslint.io/rules/restrict-template-expressions/
|
|
157
|
-
"@typescript-eslint/restrict-template-expressions": [
|
|
158
|
-
"error",
|
|
159
|
-
{
|
|
160
|
-
allowAny: false,
|
|
161
|
-
allowBoolean: true,
|
|
162
|
-
allowNullish: false,
|
|
163
|
-
allowNumber: true,
|
|
164
|
-
allowRegExp: false,
|
|
165
|
-
allowNever: false,
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
|
|
169
|
-
// https://typescript-eslint.io/rules/strict-boolean-expressions/
|
|
170
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
171
|
-
|
|
172
|
-
// https://typescript-eslint.io/rules/switch-exhaustiveness-check/
|
|
173
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
174
|
-
|
|
175
|
-
// https://typescript-eslint.io/rules/ban-ts-comment/
|
|
176
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
177
|
-
"error",
|
|
178
|
-
{
|
|
179
|
-
minimumDescriptionLength: 3,
|
|
180
|
-
"ts-check": true, // default is false. We don't want to use ts-check like ts-nocheck and prefer instead ts-expect-error
|
|
181
|
-
"ts-expect-error": "allow-with-description",
|
|
182
|
-
"ts-ignore": true,
|
|
183
|
-
"ts-nocheck": true,
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
// https://typescript-eslint.io/rules/typedef/
|
|
188
|
-
"@typescript-eslint/typedef": "off",
|
|
189
|
-
|
|
190
|
-
/* warnings: not required to be fixed, but should require attention */
|
|
191
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
192
|
-
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
193
|
-
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
|
194
|
-
|
|
195
|
-
/* Disabled */
|
|
196
|
-
|
|
197
|
-
// too much errors on existing code
|
|
198
|
-
"@typescript-eslint/unbound-method": "off",
|
|
199
|
-
|
|
200
|
-
// most of the time it's sorted by the developer as it is easier to read
|
|
201
|
-
"@typescript-eslint/sort-type-union-intersection-members": "off",
|
|
202
|
-
|
|
203
|
-
"@typescript-eslint/member-ordering": "off",
|
|
204
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
205
|
-
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
206
|
-
|
|
207
|
-
// Testing rules as warn
|
|
208
|
-
"@typescript-eslint/unified-signatures": "warn",
|
|
209
|
-
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
210
|
-
"@typescript-eslint/no-confusing-void-expression": "warn",
|
|
211
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "warn",
|
|
212
|
-
},
|
|
213
|
-
};
|