-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.eslintrc.cjs
94 lines (88 loc) · 2.84 KB
/
vite.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
// Remove this:
// 'plugin:@typescript-eslint/recommended',
"plugin:react-hooks/recommended",
// Add these:
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:jsx-a11y/strict",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
// Add this:
parserOptions: {
project: true,
},
// Add this:
settings: {
react: {
version: "detect",
},
},
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
// Add all of these:
// Getting the eslint resolver working is left as an exercise to the reader.
"import/no-unresolved": "off",
// Uncomment these if you really need to.
// "@typescript-eslint/ban-ts-comment": "off",
// "@typescript-eslint/no-explicit-any": "off",
// "@typescript-eslint/no-non-null-assertion": "off",
// Avoid bugs.
"@typescript-eslint/no-shadow": ["error", { ignoreTypeValueShadow: true }],
"@typescript-eslint/no-unsafe-unary-minus": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/switch-exhaustiveness-check": "error",
"array-callback-return": "error",
eqeqeq: "error",
"no-await-in-loop": "error",
"no-constant-binary-expression": "error",
"no-constructor-return": "error",
"no-constant-condition": [
"error",
{
checkLoops: false,
},
],
"no-promise-executor-return": "error",
"no-self-compare": "error",
"no-template-curly-in-string": "error",
// Stylistic.
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-regexp-exec": "warn",
"object-shorthand": ["warn", "properties"],
"sort-imports": ["warn", { ignoreDeclarationSort: true }],
"import/consistent-type-specifier-style": ["warn", "prefer-top-level"],
"import/order": [
"warn",
{
alphabetize: { order: "asc" },
groups: ["builtin", "external", "parent", "sibling", "index", "object", "type"],
"newlines-between": "always",
},
],
// Disabled because of too many false positives.
"@typescript-eslint/no-unnecessary-condition": "off",
"react-hooks/exhaustive-deps": "off",
},
};