-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
79 lines (78 loc) · 2.5 KB
/
eslint.config.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
import { config } from "@susisu/eslint-config";
import globals from "globals";
export default config(
{
tsconfigRootDir: import.meta.dirname,
},
{
files: ["src/**/*.ts"],
rules: {
"@typescript-eslint/naming-convention": [
"warn",
// base (from @susisu/eslint-config)
{
selector: "variableLike",
// allow PascalCase as it is commonly used for classes and React components
format: ["camelCase", "PascalCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "variable",
// allow UPPER_CASE as it is commonly used for constants
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "memberLike",
format: ["camelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
// classProperty and classMethod are excluded because they will not be affected by external systems or packages
selector: ["objectLiteralProperty", "typeProperty", "objectLiteralMethod", "typeMethod"],
// allow any common format because property and method names could be defined by external systems or packages
format: ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: ["objectLiteralProperty", "typeProperty", "objectLiteralMethod", "typeMethod"],
modifiers: ["requiresQuotes"],
format: null,
},
{
selector: "import",
// allow any common format because import names could be defined by external packages
format: ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
// extension
{
selector: ["typeProperty"],
filter: { match: true, regex: "^__rec$" },
format: null,
},
],
"@typescript-eslint/no-unused-vars": ["error", { varsIgnorePattern: "^_" }],
},
},
{
files: ["*.js"],
languageOptions: {
globals: {
...globals.es2024,
...globals.node,
},
},
},
);