-
-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathimportConfig.mjs
74 lines (70 loc) · 2.72 KB
/
importConfig.mjs
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
import path from 'path';
import { fileURLToPath } from 'url';
import pluginImport from 'eslint-plugin-import';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const importConfig = [
pluginImport.flatConfigs.recommended,
{
settings: {
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
'import/resolver': {
node: {
paths: [path.resolve(__dirname, 'eslint-rules')],
},
},
},
rules: {
// Additional
'import/no-default-export': 'error', // We don't want to use default exports, always use named exports
'import/no-anonymous-default-export': [
'error',
{
allowArray: true,
allowLiteral: true,
allowObject: true,
},
],
'import/order': [
1,
{
groups: [['builtin', 'external'], 'internal', ['sibling', 'parent']],
pathGroups: [
{
pattern: 'react*',
group: 'external',
position: 'before',
},
{ pattern: '@trezor/**', group: 'internal' }, // Translates to /packages/** */
{ pattern: '@suite-native/**', group: 'internal' },
{ pattern: '@suite-common/**', group: 'internal' },
{ pattern: 'src/**', group: 'internal', position: 'after' },
],
pathGroupsExcludedImportTypes: ['internal', 'react'],
'newlines-between': 'always',
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*fixtures*/**',
'**/*.test.{tsx,ts,js}',
'**/blockchain-link/tests/**',
'**/blockchain-link/webpack/**',
'**/suite-desktop-core/**',
'**/*e2e/**',
'**/suite/src/support/tests/**',
'**/suite-data/**',
'**/*.stories.*',
'**/*webpack.config*',
'**/webpack/**',
],
includeTypes: true,
},
],
// Offs
'import/no-unresolved': 'off', // Does not work with Babel react-native to react-native-web
},
},
];