-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
120 lines (110 loc) · 3.47 KB
/
.eslintrc.js
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
],
plugins: [
"import",
],
settings: {
react: { version: "detect" },
},
rules: {
// Formatting
"comma-dangle": ["error", "only-multiline"],
"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 }],
"object-shorthand": ["warn", "always", { avoidQuotes: true }],
"quote-props": ["warn", "consistent-as-needed"],
"no-useless-rename": "warn",
"sort-imports": ["warn", {
ignoreDeclarationSort: true,
}],
"prefer-arrow-callback": ["warn", { allowNamedFunctions: true }],
"prefer-const": "warn",
"prefer-object-spread": "warn",
"prefer-template": "warn",
// Semantics
"array-callback-return": "warn",
"consistent-return": "warn",
"eqeqeq": "warn",
"no-unused-vars": ["error", { varsIgnorePattern: "^_.*$" }],
"@typescript-eslint/no-unused-vars": ["error", { varsIgnorePattern: "^_.*$" }],
"react/button-has-type": "error",
"import/no-extraneous-dependencies": ["error", { devDependencies: false, optionalDependencies: false, peerDependencies: false }],
"import/order": ["warn", {
"groups": [
["builtin", "external"],
["sibling", "parent", "index"],
],
"newlines-between": "always",
}],
},
overrides: [
{
files: ["rollup.config.js"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2018,
},
},
{
files: [
"rollup.config.js",
"*.test.ts", "*.test.tsx",
],
rules: {
"import/no-extraneous-dependencies": ["error", { devDependencies: true, optionalDependencies: false, peerDependencies: false }],
},
},
{
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",
"plugin:import/typescript",
],
rules: {
// Aesthetics
"@typescript-eslint/member-delimiter-style": ["warn", {
multiline: { delimiter: "comma" },
singleline: { delimiter: "comma" },
}],
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-indexed-object-style": "warn", // Useful, but not always!
// 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",
"@typescript-eslint/ban-ts-comment": ["error", {
"ts-ignore": "allow-with-description",
}],
}
}
]
};