-
Notifications
You must be signed in to change notification settings - Fork 0
/
import.js
123 lines (118 loc) · 3.13 KB
/
import.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
// @ts-check
/**
* @type {import('eslint').ESLint.ConfigData}
*/
module.exports = {
extends: [
// https://github.com/import-js/eslint-plugin-import/tree/main/config
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
plugins: ['import'],
/**
* NOTE:
* Add this if you're using Webpack aliases...
*/
// Specific settings used by different plugins
// settings: {
// // Support custom aliases
// // https://github.com/benmosher/eslint-plugin-import#resolvers
// 'import/resolver': {
// // https://www.npmjs.com/package/eslint-import-resolver-node
// node: {
// moduleDirectory: ['node_modules', __dirname, 'app'],
// },
// },
// // Or...
// 'import/resolver': {
// // https://github.com/import-js/eslint-import-resolver-typescript
// typescript: {
// alwaysTryTypes: true,
// project: `${__dirname}/tsconfig.json`,
// },
// },
// },
rules: {
/**
* eslint-plugin-import
*
* @see
* https://github.com/benmosher/eslint-plugin-import
*/
// Static analysis
'import/no-unresolved': 1,
'import/named': 1,
'import/default': 1,
'import/namespace': 1,
'import/no-restricted-paths': 0,
'import/no-absolute-path': 1,
'import/no-dynamic-require': 1,
'import/no-internal-modules': 0,
'import/no-webpack-loader-syntax': 1,
'import/no-self-import': 1,
'import/no-cycle': 1,
'import/no-useless-path-segments': 1,
'import/no-relative-parent-imports': 0,
// Helpful warnings
'import/export': 1,
'import/no-named-as-default': 1,
'import/no-named-as-default-member': 1,
'import/no-deprecated': 1,
'import/no-extraneous-dependencies': [
1,
{ packageDir: '.', devDependencies: false },
],
'import/no-mutable-exports': 1,
'import/no-unused-modules': 0,
// Module systems
'import/unambiguous': 0,
'import/no-commonjs': 0,
'import/no-amd': 1,
'import/no-nodejs-modules': 0,
// Style guide
'import/first': 1,
'import/exports-last': 0,
'import/no-duplicates': 1,
'import/no-namespace': 1,
'import/extensions': 0,
'import/order': [
1,
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'unknown',
],
// Force a specific order for internal imports
pathGroups: [
'lib',
'stores',
'styles',
'hooks',
'public',
'components',
].map((identifier) => ({
pattern: `${identifier}/**`,
group: 'internal',
position: 'after',
})),
'newlines-between': 'always',
},
],
'import/newline-after-import': 1,
'import/prefer-default-export': 0,
'import/max-dependencies': 0,
'import/no-unassigned-import': 1,
'import/no-named-default': 1,
'import/no-default-export': 1,
'import/no-named-export': 0,
'import/no-anonymous-default-export': 1,
'import/group-exports': 0,
'import/dynamic-import-chunkname': 0,
},
};