-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
123 lines (116 loc) · 3.32 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
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
module.exports = {
parser: "@babel/eslint-parser",
extends: ["airbnb", "prettier"],
env: {
browser: true,
node: true,
jest: true,
es2021: true,
},
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
},
plugins: ["prettier", "react-hooks"],
rules: {
/**
* Prettier plugin errors will result in eslint errors
* Further info: [https://prettier.io/docs/en/eslint.html#use-eslint-to-run-prettier]
*/
"prettier/prettier": "error",
/**
* Forbid deps not listed in package.json.
* Further info: [https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md]
* Change: Allow import of devDeps.
*/
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
},
],
/**
* Forbid long lines of code.
* Further info: [https://eslint.org/docs/rules/max-len]
* Change: Warn, instead of error. Allow long comments.
*/
"max-len": [
"warn",
{
code: 120,
ignoreComments: true,
},
],
/**
* Forbid promise reject with non-error returns.
* Further info: [https://eslint.org/docs/rules/prefer-promise-reject-errors]
* Change: Warn, instead of error.
*/
"prefer-promise-reject-errors": "warn",
/**
* Require modules with a single export to use a default export.
* Further info: [https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md]
* Change: Don't require modules with a single export to use a default export.
*/
"import/prefer-default-export": "off",
/**
* Forbid default exports.
* Further info: [https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md]
* Change: Motivate to use named exports.
* Warn is used to be able to use react/lazy which works with default exports only
*/
"import/no-default-export": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
unnamedComponents: "arrow-function",
},
],
/**
* Disallow the use of console.
* Further info: https://eslint.org/docs/rules/no-console
* Change: Prevent accidental slips of console.{log,warn} messages.
*/
"no-console": [
"error",
{
allow: ["error"],
},
],
/**
* Order imports according to a set order
* Further info: https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
* Change: No need to manually order/tidy-up your imports
*/
"import/order": [
"error",
{
pathGroups: [
{
pattern: "@deliveryhero/**",
group: "internal",
position: "after",
},
],
pathGroupsExcludedImportTypes: ["builtin"],
groups: [
"builtin",
"external",
"internal",
"unknown",
"parent",
"sibling",
"index",
],
"newlines-between": "always",
alphabetize: { order: "asc" },
},
],
},
};