-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathimports.js
More file actions
80 lines (75 loc) · 1.8 KB
/
Copy pathimports.js
File metadata and controls
80 lines (75 loc) · 1.8 KB
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
// https://github.com/import-js/eslint-plugin-import/issues/2948#issuecomment-2119214365
import importX from 'eslint-plugin-import-x';
export default [
{
name: '@guardian/imports',
plugins: {
import: importX,
},
rules: {
// recommended defaults
'import/no-unresolved': 'error',
'import/named': 'error',
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
// encourages consistent token use across code bases
// (you have to deliberately rename an import) and
// makes the location of errors easier to discover:
// https://twitter.com/addyosmani/status/1411233253948747777
'import/no-default-export': 'error',
'import/prefer-default-export': 'off',
// less diff noise (they're hoisted anyway)
'import/first': 'error',
// fixable import formatting, designed to minimise diff noise
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
},
],
'import/newline-after-import': 'error',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'unknown',
],
'newlines-between': 'never',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
// prevent circular dependencies
'import/no-cycle': ['error', { ignoreExternal: true }],
},
},
{
name: '@guardian/imports-default-exceptions',
files: [
'**/.lintstagedrc.*',
'**/astro.config.*',
'**/eslint.config.*',
'**/jest.config.*',
'**/rollup.config.*',
'**/svelte.config.*',
'**/*.stories.*',
'**/.storybook/main.*',
],
rules: {
'import/no-default-export': 'off',
'import/prefer-default-export': 'error',
},
},
];