-
Notifications
You must be signed in to change notification settings - Fork 366
/
.eslintrc
96 lines (93 loc) · 2.77 KB
/
.eslintrc
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
{
"extends": [
// Create React App config
"react-app",
"eslint:recommended",
// eslint-recommended, but for TypeScript
"plugin:@typescript-eslint/eslint-recommended",
// TypeScript specific rules
"plugin:@typescript-eslint/recommended",
// Disable eslint rules that conflict with Prettier's formatting
"prettier",
"plugin:cypress/recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-console": ["error", { "allow": ["error", "warn"] }],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-empty-function": "error",
// Enforce return types on exported functions or public methods
"@typescript-eslint/explicit-module-boundary-types": "error",
// Enforce use of interfaces for object type definitions
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
// Enforce use of Record<string, string> instead of {[key: string]: string};
"@typescript-eslint/consistent-indexed-object-style": "error",
// Use "import type" for type imports
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports"
}
],
// Declare simple arrays as string[], declare complex ones as Array<string | number>
"@typescript-eslint/array-type": [
"error",
{
"default": "array-simple"
}
],
// Enforce PascalCase types and interfaces
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "typeLike", "format": ["PascalCase"] }
],
// Consistently sort props
"react/jsx-sort-props": [
"error",
{
"ignoreCase": true,
// key, ref must always come first
"reservedFirst": true,
// `true` shorthand props must always be last
"shorthandLast": true
}
],
// Always use shorthand for `true`
"react/jsx-boolean-value": "error",
// Group module and relative imports
"import/order": [
"error",
{
// Imports are grouped as follows:
"groups": [
// 1: built-in node modules (fs, path)
"builtin",
// 2: dependencies in node_modules
"external",
// 3. relative imports
"parent",
// 4. relative imports in the same directory
"sibling"
],
// Add an empty line between import groups.
"newlines-between": "always",
// Sort imports alphabetically
"alphabetize": {
"order": "asc"
}
}
]
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/explicit-function-return-type": ["error"]
}
}
],
"settings": {
"version": "detect"
}
}