-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
77 lines (77 loc) · 2.45 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
{
"env": {
"browser": true,
"es2021": true
},
// inserts plugins installed via npm and make them available in this file -> you can use them in "rules" section
"plugins": ["react", "@typescript-eslint", "unused-imports", "import"],
// extend configuration with predefined rules
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:import/typescript",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
// "plugin:prettier/recommended" // prettier should be at the end
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"tsconfigRootDir": "./", // connection to TypeScript config file
"sourceType": "module"
},
// rules: https://eslint.org/docs/latest/rules/
"rules": {
"no-unused-vars": "off", // base rule must be disabled as it can report incorrect errors
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports"
}
], // automatically detects if imported module is type or not and formats if needed
"unused-imports/no-unused-imports": "warn",
"react/jsx-props-no-spreading": "warn",
"react/self-closing-comp": [
"error",
{
"component": true,
"html": true
}
],
"accessor-pairs": "warn",
"capitalized-comments": "off",
"default-case": "warn",
"default-case-last": "error",
"dot-notation": "warn",
"eqeqeq": "error",
"func-style": ["error", "expression"],
"import/no-duplicates": "error",
"max-depth": ["warn", 3],
"max-nested-callbacks": ["warn", 3],
"multiline-comment-style": ["warn", "separate-lines"],
"no-console": "warn",
"no-else-return": ["error", { "allowElseIf": false }],
"no-eq-null": "error",
"no-lonely-if": "warn",
"no-nested-ternary": "warn",
"no-shadow": "off",
"no-template-curly-in-string": "warn",
"no-unreachable-loop": "warn",
"no-use-before-define": "warn",
"no-useless-rename": "error",
"no-var": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
"prefer-rest-params": "error",
"prefer-template": "error",
"require-await": "error"
}
}