forked from mui/toolpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
59 lines (58 loc) · 2.44 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
const baseline = require('@mui/monorepo/.eslintrc');
module.exports = {
...baseline,
plugins: [...baseline.plugins, 'jsdoc'],
/**
* Sorted alphanumerically within each group. built-in and each plugin form
* their own groups.
*/
rules: {
...baseline.rules,
'import/prefer-default-export': ['off'],
// TODO move rule into the main repo once it has upgraded
'@typescript-eslint/return-await': ['off'],
// TODO move rule into main repo to allow deep @mui/monorepo imports
'no-restricted-imports': ['off'],
'jsdoc/require-param': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-param-type': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-param-name': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-param-description': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-returns': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-returns-type': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-returns-description': ['error', { contexts: ['TSFunctionType'] }],
},
overrides: baseline.overrides.map((override) => {
return {
...override,
rules: {
...override.rules,
'no-restricted-imports': ['off'],
'no-restricted-syntax': [
'error',
// From https://github.com/airbnb/javascript/blob/d8cb404da74c302506f91e5928f30cc75109e74d/packages/eslint-config-airbnb-base/rules/style.js#L333
{
selector: 'ForInStatement',
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
// Too opinionated
// {
// selector: 'ForOfStatement',
// message:
// 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
// },
{
selector: 'LabeledStatement',
message:
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message:
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
},
};
}),
};