-
Notifications
You must be signed in to change notification settings - Fork 182
/
.eslintrc.json
87 lines (86 loc) · 2.72 KB
/
.eslintrc.json
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
{
"root": true,
"env": {
"es6": true, // Enable global es6 variables, like Set, Map, etc
"browser": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["import", "unicorn", "eslint-plugin-react-compiler"],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"ecmaFeatures": {
"jsx": true, // Allows for the parsing of JSX
"restParams": true,
"spread": true
}
},
"extends": [
"plugin:@vkontakte/eslint-plugin/react-typescript", // "Preset 1"
"prettier" // "Preset 2" (overrides "Preset 1")
],
"rules": {
"@typescript-eslint/method-signature-style": "error",
"@typescript-eslint/explicit-member-accessibility": "off", // [Reason] overrides "Preset 1"
"@typescript-eslint/no-unnecessary-condition": "off", // [Reason] overrides "Preset 1"
"@typescript-eslint/no-magic-numbers": "off", // [Reason] overrides "Preset 1"
"@typescript-eslint/no-non-null-assertion": "off", // [Reason] overrides "Preset 1"
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": {
"descriptionFormat": "^: TS\\d+ .+$"
}
}
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
"no-shadow": "off", // [Reason] need using @typescript-eslint/no-shadow
"no-restricted-globals": ["error", "window", "document"],
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"newlines-between": "never",
"alphabetize": {
"order": "asc"
},
"pathGroupsExcludedImportTypes": ["**/*.css", "react", "react-dom", "react-dom/**"],
"pathGroups": [
{
"pattern": "{react,react-dom,react-dom/**}",
"group": "external",
"position": "before"
},
{
"pattern": "*.css",
"group": "index",
"patternOptions": { "matchBase": true },
"position": "after"
}
]
}
],
"sort-imports": [
"error",
{
"ignoreCase": true,
"ignoreDeclarationSort": true,
"ignoreMemberSort": false,
"allowSeparatedGroups": true,
"memberSyntaxSortOrder": ["none", "single", "all", "multiple"]
}
],
"curly": "error", // Enforce consistent brace style
"eqeqeq": "error", // Only type-safe equality operators
"unicorn/expiring-todo-comments": ["error"],
"no-console": "error",
"react-compiler/react-compiler": 2
}
}