/
jsenvEslintRulesForImport.js
47 lines (46 loc) · 1.51 KB
/
jsenvEslintRulesForImport.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
/*
* Contains configuration of ESLint rules when using eslint-plugin-import.
*
* Check ./jsenvEslintRules.js to see the mindset used to configure these rules
*/
export const jsenvEslintRulesForImport = {
"import/default": ["error"],
"import/no-unresolved": [
"error",
{
commonjs: true,
amd: false,
caseSensitive: false,
},
],
"import/named": ["error"],
"import/namespace": ["error", { allowComputed: true }],
"import/no-absolute-path": ["off"],
"import/no-dynamic-require": ["error"],
"import/export": ["error"],
"import/no-named-as-default": ["warn"],
"import/first": ["warn"],
"import/no-duplicates": ["warn"],
"import/newline-after-import": ["warn"],
// "import/max-dependencies" is not super useful
// Either you will disable the eslint rule because it's "normal"
// to have a lot of dependencies or feel compelled to reduce the number of imports.
// It's already visible that a file has many imports and that ideally they should be
// less imports, no need for ESLint, let's keep ESLint for more valuable things.
"import/max-dependencies": ["off", { max: 10 }],
"import/no-anonymous-default-export": [
"off",
{
allowArray: true,
allowArrowFunction: false,
allowAnonymousClass: false,
allowAnonymousFunction: false,
allowLiteral: true,
allowObject: true,
},
],
"import/no-self-import": ["error"],
"import/no-cycle": ["error"],
"import/no-useless-path-segments": ["error"],
"import/no-default-export": ["error"],
};