-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
129 lines (121 loc) · 3.7 KB
/
Copy path.eslintrc.js
File metadata and controls
129 lines (121 loc) · 3.7 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
const OFF = "off"
const ERR = "error"
module.exports = {
root: true,
plugins: [
"@typescript-eslint",
"jest",
"no-relative-import-paths",
"react-hooks",
"react-native-a11y",
"simple-import-sort",
"testing-library",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:testing-library/react",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime",
"prettier", // "prettier" needs to be last!
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 6,
sourceType: "module",
},
settings: {
react: {
version: "detect",
},
},
rules: {
/**
* Errors
*/
"@typescript-eslint/no-unused-vars": [
ERR,
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
// Import ordering is handled by `simple-import-sort` (auto-fixable),
// so the `import/order` rule is disabled below to avoid the two fighting.
"simple-import-sort/imports": [
ERR,
{
groups: [
// Side-effect imports (e.g. `import "./setup"`).
["^\\u0000"],
// Node.js builtins.
["^node:"],
// External packages (npm modules, including scoped `@artsy/...`).
["^@?\\w"],
// Absolute imports from `src/` (module-resolver root). These start
// with a letter too, but win via longest-match over the packages
// group above.
[
"^(App|Navigation|Scenes|assets|helpers|relay|store|system|utils|__generated__|setupJest)(/.*|$)",
],
// Any other absolute imports not matched above.
["^"],
// Relative imports (same folder / parent).
["^\\."],
],
},
],
"simple-import-sort/exports": ERR,
"import/no-duplicates": ERR,
"react/jsx-curly-brace-presence": ERR,
"react-hooks/rules-of-hooks": ERR,
/**
* Warnings
*/
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{ allowSameFolder: true, rootDir: "src" },
],
// Accessibility guidance (react-native-a11y). Kept at "warn" so they guide
// authors of new/interactive components without hard-failing CI on the
// existing codebase. Add `accessibilityLabel`/`accessibilityRole` (and a
// hint where useful) to interactive elements to satisfy these.
"react-native-a11y/has-accessibility-hint": "warn",
"react-native-a11y/has-accessibility-props": "warn",
"react-native-a11y/has-valid-accessibility-role": "warn",
"react-native-a11y/has-valid-accessibility-state": "warn",
"react-native-a11y/no-nested-touchables": "warn",
/**
* Disabled
*/
// Superseded by `simple-import-sort/imports` above.
"import/order": OFF,
"@typescript-eslint/ban-ts-comment": OFF,
"@typescript-eslint/ban-types": OFF,
"@typescript-eslint/explicit-module-boundary-types": OFF,
"@typescript-eslint/no-empty-function": OFF,
"@typescript-eslint/no-explicit-any": OFF,
"@typescript-eslint/no-non-null-assertion": OFF,
"@typescript-eslint/no-var-requires": OFF,
"import/default": OFF,
"import/namespace": OFF,
"import/no-named-as-default-member": OFF,
"import/no-named-as-default": OFF,
"import/no-unresolved": OFF,
"no-control-regex": OFF,
"no-empty-pattern": OFF,
"no-extra-boolean-cast": OFF,
"no-redeclare": OFF,
"no-undef": OFF,
"no-useless-catch": OFF,
"no-useless-escape": OFF,
"react-hooks/exhaustive-deps": OFF,
"react/react-in-jsx-scope": OFF,
},
}