-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
121 lines (121 loc) · 3.13 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
},
// ! NB: empty object is intentional, mitigates module alias issue
"import/resolver": {
"typescript": {}
}
},
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
"plugin:testing-library/react",
"prettier"
],
"plugins": [
"@typescript-eslint",
"react",
"import",
"typescript-sort-keys",
"unused-imports",
"prefer-arrow",
"react-hooks",
"testing-library"
],
"rules": {
// allow non-null assertion operators
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": [
"error",
{
// allow `@ts-ignore` if a description is specified
"ts-ignore": "allow-with-description"
}
],
// disallow unused variables
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
// suppress errors for missing React import (prefer modern JSX transform)
"react/react-in-jsx-scope": "off",
// enforce arrow functions for React components
"react/function-component-definition": [
"error",
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
// enforce array type syntax (e.g. `string[]` instead of `Array<string>`)
"@typescript-eslint/array-type": [
"error",
{
"default": "array",
"readonly": "array"
}
],
// warn on use of type `any`
"@typescript-eslint/no-explicit-any": "warn",
// explicitly handle promises (e.g. `await`, `void`)
"@typescript-eslint/no-floating-promises": "error",
// enforce type imports
"@typescript-eslint/consistent-type-imports": "error",
// prevent cyclic dependencies
"import/no-cycle": "error",
// prevent duplicate imports
"import/no-duplicates": "error",
// remove unused imports
"unused-imports/no-unused-imports": "warn",
// enforce import group order
"import/order": [
"error",
{
"alphabetize": {
"caseInsensitive": true,
"order": "asc"
},
// separate import groups (e.g. external dependencies from internal dependencies)
"groups": [
"builtin",
"external",
[
"internal",
// NB: TS aliased paths fall into `unknown` category. See https://github.com/import-js/eslint-plugin-import/issues/1379
"unknown",
"parent",
"sibling",
"index",
"object"
],
"type"
],
"newlines-between": "always"
}
]
}
}