-
Notifications
You must be signed in to change notification settings - Fork 30
/
.eslintrc
146 lines (143 loc) · 5.18 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["@typescript-eslint", "prefer-arrow", "simple-import-sort"],
"extends": [
"react-app",
"eslint:recommended",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended"
// "plugin:@typescript-eslint/recommended-requiring-type-checking", // @debt enable this + fix the issues in a standalone PR
],
"rules": {
// @debt uncomment one by one and fix them in separate PRs
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-array-constructor": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-extra-non-null-assertion": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-redeclare": "warn",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"no-case-declarations": "off",
"no-prototype-builtins": "off",
// these base rules can report incorrect errors when using TypeScript, see the corresponding @typescript-eslint versions
"no-redeclare": "off",
"no-use-before-define": "off",
"prefer-arrow/prefer-arrow-functions": [
"warn",
{
"disallowPrototype": true,
"singleReturnOnly": false,
"classPropertiesAllowed": false
}
],
"prefer-arrow-callback": ["error", { "allowNamedFunctions": true }],
"func-style": ["error", "expression", { "allowArrowFunctions": true }],
"no-restricted-imports": [
"error",
{
"name": "react-redux",
"importNames": ["useSelector", "useDispatch"],
"message": "Import typed version from hooks/{useSelector|useDispatch}"
},
{
"name": "react-redux-firebase",
"importNames": ["useFirestoreConnect"],
"message": "Import typed version from hooks/useSparkleFirestoreConnect"
},
{
"name": "firebase",
"message": "Use firebase/app instead"
},
{
"name": "lodash",
"importNames": ["default"],
"message": "Avoid importing all of lodash; import only what you need"
},
{
"name": "mixpanel-browser",
"message": "Import safe version from hooks/useAnalytics instead"
}
],
"react/prop-types": "off",
"react/display-name": "warn",
// @see https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks#advanced-configuration
"react-hooks/exhaustive-deps": [
"warn",
{
"additionalHooks": "(useAsync)"
}
],
// "simple-import-sort/imports": "error"
"simple-import-sort/imports": [
"error",
{
"groups": [
// Node.js builtins. You could also generate this regex if you use a `.js` config.
// For example: `^(${require("module").builtinModules.join("|")})(/|$)`
[
"^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
],
// Packages. `react` related packages come first.
["^react", "^@?\\w"],
["secrets"],
["settings"],
// Internal packages.
["^(api)(/.*|$)"],
["^(store)(/.*|$)"],
["^(types)(/.*|$)"],
["^(utils)(/.*|$)"],
["^(forms)(/.*|$)"],
["^(hooks)(/.*|$)"],
["^(pages)(/.*|$)"],
["^(components/templates)(/.*|$)"],
["^(components/organisms)(/.*|$)"],
["^(components/molecules)(/.*|$)"],
["^(components/atoms)(/.*|$)"],
// Side effect imports.
["^\\u0000"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Theme
["^(theme)(/.*|$)"],
// Assets
["^(assets)(/.*|$)"],
// Style imports.
["^.+\\.s?css$"]
]
}
]
},
"globals": {
"React": true,
"JSX": true
}
}