Skip to content

Commit 5230978

Browse files
committed
invert eslint config overrides, separate JS and TS rules and plugins
it's very difficult to disable TS plugins in the overrides, so omit them from the root and enable them in overrides instead.
1 parent aa5d92d commit 5230978

File tree

1 file changed

+59
-71
lines changed

1 file changed

+59
-71
lines changed

.eslintrc.js

Lines changed: 59 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,10 @@ module.exports = {
1010
node: true,
1111
worker: true,
1212
},
13-
parser: "@typescript-eslint/parser",
14-
parserOptions: {
15-
ecmaVersion: 2022,
16-
project: true,
17-
},
18-
plugins: ["@typescript-eslint", "prettier", "simple-import-sort", "import"],
19-
extends: [
20-
"eslint:recommended",
21-
"plugin:@typescript-eslint/recommended",
22-
"prettier",
23-
"plugin:prettier/recommended",
24-
"plugin:import/recommended",
25-
"plugin:import/typescript",
26-
],
13+
parser: "espree",
14+
parserOptions: { ecmaVersion: 2022 },
15+
plugins: ["prettier", "simple-import-sort", "import"],
16+
extends: ["eslint:recommended", "prettier", "plugin:prettier/recommended", "plugin:import/recommended"],
2717
rules: {
2818
curly: ["warn", "multi-line", "consistent"],
2919
"no-bitwise": "warn",
@@ -37,67 +27,65 @@ module.exports = {
3727
"import/no-cycle": "warn",
3828
"simple-import-sort/imports": "warn",
3929
"simple-import-sort/exports": "warn",
40-
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
41-
"@typescript-eslint/consistent-type-exports": "error",
42-
"@typescript-eslint/explicit-function-return-type": ["warn", { allowExpressions: true }],
43-
"@typescript-eslint/explicit-member-accessibility": "warn",
44-
"@typescript-eslint/naming-convention": [
45-
"warn",
46-
{
47-
selector: "default",
48-
format: ["strictCamelCase"],
49-
},
50-
{
51-
selector: "typeLike",
52-
format: ["StrictPascalCase"],
53-
},
54-
{
55-
selector: "enumMember",
56-
format: ["StrictPascalCase"],
57-
},
58-
{
59-
selector: "variable",
60-
format: ["strictCamelCase"],
61-
leadingUnderscore: "allow",
62-
},
63-
{
64-
selector: "parameter",
65-
format: ["strictCamelCase"],
66-
leadingUnderscore: "allow",
67-
},
68-
{
69-
// For object literal keys we want to allow things like numbers (e.g. 35),
70-
// type URLs (e.g. "/cosmos.feegrant.v1beta1.MsgGrantAllowance") or test data (e.g. "0.14ucoin2")
71-
selector: "objectLiteralProperty",
72-
format: null,
73-
},
74-
],
75-
"@typescript-eslint/no-dynamic-delete": "warn",
76-
"@typescript-eslint/no-empty-function": "off",
77-
"@typescript-eslint/no-empty-interface": "off",
78-
"@typescript-eslint/no-explicit-any": "off",
79-
"@typescript-eslint/parameter-properties": "warn",
80-
"@typescript-eslint/no-shadow": "warn",
81-
"@typescript-eslint/no-unused-vars": [
82-
"warn",
83-
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
84-
],
85-
"@typescript-eslint/no-use-before-define": "warn",
86-
"@typescript-eslint/prefer-readonly": "warn",
8730
},
8831
overrides: [
8932
{
90-
files: "**/*.cjs",
91-
parser: "espree",
92-
parserOptions: { ecmaVersion: 2022 },
33+
files: "**/*.ts",
34+
parser: "@typescript-eslint/parser",
35+
parserOptions: {
36+
ecmaVersion: 2022,
37+
project: true,
38+
},
39+
plugins: ["@typescript-eslint"],
40+
extends: ["plugin:@typescript-eslint/recommended", "plugin:import/typescript"],
9341
rules: {
94-
"@typescript-eslint/no-var-requires": "off",
95-
"@typescript-eslint/consistent-type-exports": "off",
96-
"@typescript-eslint/explicit-function-return-type": "off",
97-
"@typescript-eslint/explicit-member-accessibility": "off",
98-
"@typescript-eslint/explicit-module-boundary-types": "off",
99-
"@typescript-eslint/naming-convention": "off",
100-
"@typescript-eslint/prefer-readonly": "off",
42+
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
43+
"@typescript-eslint/consistent-type-exports": "error",
44+
"@typescript-eslint/explicit-function-return-type": ["warn", { allowExpressions: true }],
45+
"@typescript-eslint/explicit-member-accessibility": "warn",
46+
"@typescript-eslint/naming-convention": [
47+
"warn",
48+
{
49+
selector: "default",
50+
format: ["strictCamelCase"],
51+
},
52+
{
53+
selector: "typeLike",
54+
format: ["StrictPascalCase"],
55+
},
56+
{
57+
selector: "enumMember",
58+
format: ["StrictPascalCase"],
59+
},
60+
{
61+
selector: "variable",
62+
format: ["strictCamelCase"],
63+
leadingUnderscore: "allow",
64+
},
65+
{
66+
selector: "parameter",
67+
format: ["strictCamelCase"],
68+
leadingUnderscore: "allow",
69+
},
70+
{
71+
// For object literal keys we want to allow things like numbers (e.g. 35),
72+
// type URLs (e.g. "/cosmos.feegrant.v1beta1.MsgGrantAllowance") or test data (e.g. "0.14ucoin2")
73+
selector: "objectLiteralProperty",
74+
format: null,
75+
},
76+
],
77+
"@typescript-eslint/no-dynamic-delete": "warn",
78+
"@typescript-eslint/no-empty-function": "off",
79+
"@typescript-eslint/no-empty-interface": "off",
80+
"@typescript-eslint/no-explicit-any": "off",
81+
"@typescript-eslint/parameter-properties": "warn",
82+
"@typescript-eslint/no-shadow": "warn",
83+
"@typescript-eslint/no-unused-vars": [
84+
"warn",
85+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
86+
],
87+
"@typescript-eslint/no-use-before-define": "warn",
88+
"@typescript-eslint/prefer-readonly": "warn",
10189
},
10290
},
10391
{

0 commit comments

Comments
 (0)