Skip to content

Commit 34c144d

Browse files
authored
Reorganize eslint config rule ordering (#55106)
1 parent 01b1821 commit 34c144d

File tree

1 file changed

+65
-55
lines changed

1 file changed

+65
-55
lines changed

.eslintrc.json

Lines changed: 65 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,34 @@
3030
"/coverage/**"
3131
],
3232
"rules": {
33-
"max-statements-per-line": ["error", { "max": 1 }],
34-
"simple-import-sort/imports": "error",
35-
"simple-import-sort/exports": "error",
33+
// eslint
34+
"dot-notation": "error",
35+
"eqeqeq": "error",
36+
"no-caller": "error",
37+
"no-eval": "error",
38+
"no-extra-bind": "error",
39+
"no-new-func": "error",
40+
"no-new-wrappers": "error",
41+
"no-return-await": "error",
42+
"no-restricted-globals": [
43+
"error",
44+
{ "name": "setTimeout" },
45+
{ "name": "clearTimeout" },
46+
{ "name": "setInterval" },
47+
{ "name": "clearInterval" },
48+
{ "name": "setImmediate" },
49+
{ "name": "clearImmediate" }
50+
],
51+
"no-template-curly-in-string": "error",
52+
"no-throw-literal": "error",
53+
"no-undef-init": "error",
54+
"no-var": "error",
55+
"object-shorthand": "error",
56+
"prefer-const": "error",
57+
"prefer-object-spread": "error",
58+
"unicode-bom": ["error", "never"],
3659

60+
// @typescript-eslint/eslint-plugin
3761
"@typescript-eslint/naming-convention": [
3862
"error",
3963
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
@@ -47,15 +71,14 @@
4771
{ "selector": "property", "format": null }
4872
],
4973

50-
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
51-
"@typescript-eslint/no-extra-semi": "error",
52-
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
53-
"@typescript-eslint/semi": "error",
54-
"@typescript-eslint/space-before-function-paren": ["error", {
55-
"asyncArrow": "always",
56-
"anonymous": "always",
57-
"named": "never"
58-
}],
74+
// Rules enabled in typescript-eslint configs that are not applicable here
75+
"@typescript-eslint/ban-ts-comment": "off",
76+
"@typescript-eslint/class-literal-property-style": "off",
77+
"@typescript-eslint/consistent-indexed-object-style": "off",
78+
"@typescript-eslint/no-duplicate-enum-values": "off",
79+
"@typescript-eslint/no-namespace": "off",
80+
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
81+
"@typescript-eslint/no-var-requires": "off",
5982

6083
// Todo: For each of these, investigate whether we want to enable them ✨
6184
"@typescript-eslint/ban-types": "off",
@@ -77,65 +100,52 @@
77100
// Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820
78101
"@typescript-eslint/prefer-optional-chain": "off",
79102

80-
// Rules enabled in typescript-eslint configs that are not applicable here
81-
"@typescript-eslint/ban-ts-comment": "off",
82-
"@typescript-eslint/class-literal-property-style": "off",
83-
"@typescript-eslint/consistent-indexed-object-style": "off",
84-
"@typescript-eslint/no-duplicate-enum-values": "off",
85-
"@typescript-eslint/no-namespace": "off",
86-
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
87-
"@typescript-eslint/no-var-requires": "off",
88-
89103
// scripts/eslint/rules
90-
"local/object-literal-surrounding-space": "error",
91-
"local/no-type-assertion-whitespace": "error",
92-
"local/type-operator-spacing": "error",
93-
"local/only-arrow-functions": ["error", {
94-
"allowNamedFunctions": true ,
95-
"allowDeclarations": true
96-
}],
97-
"local/no-double-space": "error",
104+
"local/only-arrow-functions": [
105+
"error",
106+
{
107+
"allowNamedFunctions": true ,
108+
"allowDeclarations": true
109+
}
110+
],
98111
"local/argument-trivia": "error",
99112
"local/no-in-operator": "error",
100-
"local/simple-indent": "error",
101113
"local/debug-assert": "error",
102114
"local/no-keywords": "error",
103115
"local/jsdoc-format": "error",
104116

105117
// eslint-plugin-no-null
106118
"no-null/no-null": "error",
107119

108-
// eslint
120+
// eslint-plugin-simple-import-sort
121+
"simple-import-sort/imports": "error",
122+
"simple-import-sort/exports": "error",
123+
124+
// Formatting rules; remove once a formatter enforces these.
109125
"curly": ["error", "multi-line"],
110-
"dot-notation": "error",
111-
"eqeqeq": "error",
112126
"linebreak-style": ["error", "windows"],
127+
"max-statements-per-line": ["error", { "max": 1 }],
113128
"new-parens": "error",
114-
"no-caller": "error",
115-
"no-eval": "error",
116-
"no-extra-bind": "error",
117-
"no-new-func": "error",
118-
"no-new-wrappers": "error",
119-
"no-return-await": "error",
120-
"no-restricted-globals": ["error",
121-
{ "name": "setTimeout" },
122-
{ "name": "clearTimeout" },
123-
{ "name": "setInterval" },
124-
{ "name": "clearInterval" },
125-
{ "name": "setImmediate" },
126-
{ "name": "clearImmediate" }
127-
],
128-
"no-template-curly-in-string": "error",
129-
"no-throw-literal": "error",
130129
"no-trailing-spaces": "error",
131-
"no-undef-init": "error",
132-
"no-var": "error",
133-
"object-shorthand": "error",
134-
"prefer-const": "error",
135-
"prefer-object-spread": "error",
136130
"quote-props": ["error", "consistent-as-needed"],
137131
"space-in-parens": "error",
138-
"unicode-bom": ["error", "never"]
132+
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
133+
"@typescript-eslint/no-extra-semi": "error",
134+
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
135+
"@typescript-eslint/semi": "error",
136+
"@typescript-eslint/space-before-function-paren": [
137+
"error",
138+
{
139+
"asyncArrow": "always",
140+
"anonymous": "always",
141+
"named": "never"
142+
}
143+
],
144+
"local/object-literal-surrounding-space": "error",
145+
"local/no-type-assertion-whitespace": "error",
146+
"local/type-operator-spacing": "error",
147+
"local/no-double-space": "error",
148+
"local/simple-indent": "error"
139149
},
140150
"overrides": [
141151
// By default, the ESLint CLI only looks at .js files. But, it will also look at

0 commit comments

Comments
 (0)