forked from Tietokilta/ilmomasiina
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
83 lines (83 loc) · 2.69 KB
/
.eslintrc.js
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
module.exports = {
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"packages/ilmomasiina-models/tsconfig.json",
"packages/ilmomasiina-components/tsconfig.json",
"packages/ilmomasiina-frontend/tsconfig.json",
"packages/ilmomasiina-backend/tsconfig.json"
],
"tsconfigRootDir": __dirname,
// https://github.com/typescript-eslint/typescript-eslint/issues/2094
"EXPERIMENTAL_useSourceOfProjectReferenceRedirect": true
},
"settings": {
"react": {
"pragma": "React",
"version": "16.12"
},
},
"extends": [
"airbnb",
"airbnb/hooks",
"airbnb-typescript"
],
"plugins": [
"@typescript-eslint",
"promise",
"simple-import-sort",
"jest"
],
"env": {
"browser": true
},
"rules": {
"max-len": ["error", 120, 2],
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/quotes": ["error", "single"],
// To allow grouping of class members - especially for Models.
"@typescript-eslint/lines-between-class-members": "off",
// Doesn't increase code quality with redux.
"@typescript-eslint/default-param-last": "off",
// Allow i++ in for loops.
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
// We are targeting ES5 or higher.
"radix": ["error", "as-needed"],
// ...I know what I'm doing.
"no-control-regex": "off",
// Not usable with formik.
"react/jsx-props-no-spreading": "off",
// TypeScript validates prop types, no need for this.
"react/require-default-props": "off",
// Definitely a valid performance concern, but implementing this correctly is
// a giant PITA - the default config ignores arrow functions but they don't solve
// the problem at all, and useCallback is just plain ugly.
"react/jsx-no-bind": "off",
// Add any custom hooks here
"react-hooks/exhaustive-deps": ["error", {
additionalHooks: "useAbortableEffect|useAbortablePromise",
}],
// Prefer arrow functions to functions expressions, as that's what was done
// when this rule was introduced.
"react/function-component-definition": ["error", {
namedComponents: ["function-declaration", "arrow-function"],
unnamedComponents: "arrow-function",
}],
// Sort imports: React first, then npm packages, then local files, then CSS.
"simple-import-sort/imports": [
"error",
{
"groups": [
["^react$"],
["^@?\\w"],
// Anything that does not start with a dot.
["^[^.]"],
// Anything that starts with a dot, or is from one of our packages.
["^@tietokilta/", "^"],
// Css
["css$"]
]
}
]
}
};