-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.eslintrc.cjs
78 lines (75 loc) · 2.46 KB
/
.eslintrc.cjs
1
2
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
71
72
73
74
75
76
77
78
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true
},
extends: [
"eslint:recommended",
],
rules: {
"semi": ["warn", "always"],
"quotes": ["warn", "double"],
"no-constant-condition": ["warn", { checkLoops: false }],
"arrow-parens": ["warn", "as-needed"],
"curly": ["warn", "multi-line", "consistent"],
"indent": ["warn", 2, { SwitchCase: 1 }],
"no-console": ["warn", { allow: ["error", "warn"] }],
"object-shorthand": ["warn", "always", { avoidQuotes: true }],
"quote-props": ["warn", "consistent-as-needed"],
"no-useless-rename": "warn",
"sort-imports": ["warn", {
ignoreDeclarationSort: true
}],
},
overrides: [
{
files: ["rollup.config.js"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2018,
},
},
// The default TS config.
{
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: true,
},
plugins: [
"@typescript-eslint",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
rules: {
// Aesthetics
"@typescript-eslint/member-delimiter-style": ["warn", {
multiline: { delimiter: "comma" },
singleline: { delimiter: "comma" },
overrides: {
interface: { multiline: { delimiter: "semi" } },
},
}],
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-indexed-object-style": "warn", // Useful, but not always!
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties : true } ],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
// Semantics
"@typescript-eslint/explicit-function-return-type": ["warn", { allowExpressions: true }],
// "@typescript-eslint/no-non-null-assertion": "off", // TODO: Audit these.
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
},
},
]
};