-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
eslint.config.mjs
126 lines (125 loc) · 3.49 KB
/
eslint.config.mjs
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
121
122
123
124
125
126
import antfu from "@antfu/eslint-config";
import command from "eslint-plugin-command/config";
export default antfu(
{
react: true,
unocss: true,
},
{
files: ["**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}"],
rules: {
"antfu/if-newline": "off",
"prefer-object-has-own": "error",
"logical-assignment-operators": [
"error",
"always",
{ enforceForIfStatements: true },
],
"no-else-return": ["error", { allowElseIf: false }],
"no-lonely-if": "error",
"prefer-destructuring": [
"error",
{ VariableDeclarator: { object: true } },
],
"import/no-self-import": "error",
"import/no-duplicates": "error",
"import/first": "error",
"import/order": [
"warn",
{
groups: [
"object",
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
"newlines-between": "always",
},
],
"import/newline-after-import": "error",
"no-negated-condition": "off",
"unicorn/no-negated-condition": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
args: "after-used",
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
vars: "all",
varsIgnorePattern: "^_",
},
],
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
"object-shorthand": ["error", "always"],
"unicorn/prefer-regexp-test": "error",
"unicorn/no-array-for-each": "error",
"unicorn/prefer-string-replace-all": "error",
"ts/prefer-for-of": "error",
"ts/no-explicit-any": "off",
"ts/no-non-null-assertion": "off",
"ts/no-unsafe-assignment": "off",
"ts/no-unused-vars": "error",
"ts/no-var-requires": "off",
"ts/ban-ts-comment": "off",
"ts/no-unsafe-call": "off",
"ts/no-unsafe-member-access": "off",
"ts/no-inferrable-types": [
"error",
{
ignoreParameters: true,
ignoreProperties: true,
},
],
"jsonc/sort-keys": "error",
"style/semi": ["error", "always"],
"style/quotes": ["error", "double"],
"style/function-paren-newline": "off",
"style/quote-props": "off",
"style/arrow-parens": ["error", "always"],
"style/brace-style": "off",
"node/prefer-global/process": "off",
"node/prefer-global/buffer": "off",
"command/command": "error",
"perfectionist/sort-imports": "off",
"no-dupe-keys": "error",
},
},
{
files: ["**/*.{jsx,tsx}"],
rules: {
"react-hooks/exhaustive-deps": "error",
"no-restricted-syntax": [
"error",
{
selector:
"CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
message:
"`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead.",
},
{
selector: "JSXIdentifier[name=\"React\"]",
message:
"Avoid using React directly. Consider using JSX without import.",
},
],
},
settings: {
react: { version: "detect" },
},
},
{
files: ["**/*.d.ts"],
rules: {
"no-var": "off",
},
},
command(),
);