Repository navigation
Expand file tree
/
Copy path.eslintrc.js
More file actions
110 lines (109 loc) · 3.37 KB
/
Copy path.eslintrc.js
File metadata and controls
110 lines (109 loc) · 3.37 KB
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
const isCommit = process.env.COMMIT;
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
project: "./tsconfig.json",
sourceType: "module",
createDefaultProgram: true,
},
extends: [
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react/recommended",
],
plugins: ["react-hooks"],
rules: {
"no-console": [isCommit ? "error" : "warn", { allow: ["warn", "error"] }],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-interface": "off",
"react/prop-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"react/display-name": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"no-var": "error",
"prefer-const": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "error", // Checks effect dependencies
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/camelcase": "off",
"prettier/prettier": [
"off",
{
endOfLine: "auto",
},
],
camelcase: "off",
...(isCommit
? {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
],
"@typescript-eslint/no-non-null-assertion": "error",
}
: {
"@typescript-eslint/naming-convention": [
"error",
// {
// selector: 'default',
// format: ['camelCase'],
// },
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
filter: {
// you can expand this regex to add more allowed names
regex: "^([_]+[A-Z]+[_]+)$",
match: false,
},
},
{
selector: "variable",
types: ["boolean"],
format: ["PascalCase", "UPPER_CASE"],
prefix: ["is", "should", "has", "can", "did", "will"],
filter: {
// you can expand this regex to add more allowed names
regex: "^[_]+.*$",
match: false,
},
},
{
selector: "function",
format: ["camelCase", "PascalCase"],
leadingUnderscore: "allow",
},
// {
// selector: 'parameter',
// format: ['strictCamelCase'],
// leadingUnderscore: 'allow',
// },
// {
// selector: 'memberLike',
// format: ['strictCamelCase'],
// leadingUnderscore: 'allow',
// },
{
selector: "typeLike",
format: ["PascalCase"],
},
],
}),
},
};