This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
155 lines (153 loc) · 4.47 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
module.exports = {
env: {
browser: true,
es6: true
},
parser: '@typescript-eslint/parser',
// Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020,
// Allows for the parsing of modern ECMAScript features
sourceType: 'module',
// Allows for the use of imports
ecmaFeatures: {
jsx: true // Allows for the parsing of JSX
}
},
plugins: ['prettier', 'react', '@typescript-eslint', 'react-hooks', 'jsx-a11y', 'import', 'unicorn', 'boundaries'],
settings: {
react: {
version: 'detect' // Tells eslint-plugin-react to automatically detect the version of React to use
},
'boundaries/include': ['src/**/*', 'static/*/**'],
'boundaries/ignore': ['src/tests/*/**'],
'boundaries/elements': [{
type: 'entry-point',
pattern: 'src/index.tsx',
mode: 'full'
}, {
type: 'global-declaration',
pattern: 'src/d.ts',
mode: 'full'
}, {
type: 'shared',
pattern: 'shared/*/*/**',
capture: ['package', 'segment', 'file'],
mode: 'file'
}, {
type: 'shared-api',
pattern: 'shared/*/*.(ts|tsx)',
capture: ['package', 'openAPI'],
mode: 'file'
}, {
type: 'shared',
pattern: 'shared/*.ts',
capture: ['declaration'],
mode: 'file'
}, {
type: 'entities',
pattern: 'entities/*/*/*',
capture: ['slice', 'segment', 'file'],
mode: 'file'
}, {
type: 'entities-api',
pattern: 'entities/*/*.(ts|tsx)',
capture: ['slice', 'openAPI'],
mode: 'file'
}, {
type: 'features',
pattern: 'features/*/*/*',
capture: ['slice', 'segment', 'file'],
mode: 'file'
}, {
type: 'features-api',
pattern: 'features/*/*.(ts|tsx)',
capture: ['slice', 'openAPI'],
mode: 'file'
}, {
type: 'pages',
pattern: 'pages/*/*/*.(ts|tsx)',
capture: ['slice', 'segment', 'file'],
baseCapture: ['openAPI'],
mode: 'file'
}, {
type: 'pages-api',
pattern: 'pages/*/*.(ts|tsx)',
capture: ['slice', 'openAPI'],
mode: 'file'
}, {
type: 'app',
pattern: 'app'
}, {
type: 'static',
pattern: 'static'
}],
'import/resolver': {
typescript: {
alwaysTryTypes: true
}
}
},
extends: ["eslint:recommended", "plugin:import/typescript", "plugin:react/recommended", "plugin:react-hooks/recommended", "plugin:jsx-a11y/recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:unicorn/recommended", "plugin:@typescript-eslint/recommended", "plugin:boundaries/strict", "prettier", "plugin:storybook/recommended"],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_'
}],
'react/prop-types': [0],
'import/order': [2, {
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
alphabetize: {
order: 'asc'
},
pathGroups: [{
pattern: '@/**',
group: 'internal'
}]
}],
'unicorn/filename-case': [0],
'boundaries/no-private': [2, {
allowUncles: false
}],
'boundaries/element-types': [2, {
// Allow or disallow any dependency by default
default: 'disallow',
// Define a custom message for this rule
message: '${file.type} is not allowed to import ${dependency.type}',
rules: [{
from: ['entry-point'],
allow: ['app']
}, {
from: ['shared', 'shared-api'],
allow: ['static', ['shared', {
package: '${package}'
}], ['shared', {
declaration: 'types'
}], ['shared-api']]
}, {
from: ['entities', 'entities-api'],
allow: ['static', 'shared-api', ['entities-api', {
slice: '${slice}'
}], ['entities', {
slice: '${slice}'
}]]
}, {
from: ['features', 'features-api'],
allow: ['static', 'shared-api', 'entities-api', ['features-api', {
slice: '${slice}'
}], ['features', {
slice: '${slice}'
}]]
}, {
from: ['pages', 'pages-api'],
allow: ['static', 'shared-api', 'entities-api', 'features-api', 'pages-api', ['pages', {
slice: '${slice}'
}]]
}, {
from: ['app'],
allow: ['entities-api', 'features-api', 'static', 'shared-api', 'pages-api']
}]
}]
}
};