forked from toptal/picasso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
72 lines (70 loc) · 1.84 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
const forbiddenImports = {
picasso: ['picasso', 'picasso-lab', 'picasso-forms', 'picasso-charts'],
'picasso-lab': ['picasso-lab'],
'picasso-charts': ['picasso-charts'],
'picasso-forms': ['picasso-forms'],
'picasso-provider': ['picasso-provider', 'picasso-shared']
}
const generateConfig = () =>
Object.entries(forbiddenImports).map(
([srcPackageName, forbiddenPackageNames]) => {
return {
files: [`packages/${srcPackageName}/src/**`],
excludedFiles: ['*.example.jsx', '*.example.tsx'],
rules: {
'no-restricted-imports': [
'error',
...forbiddenPackageNames.map(name => `@toptal/${name}`)
]
}
}
}
)
module.exports = {
extends: './node_modules/@toptal/davinci-syntax/src/configs/.eslintrc',
rules: {
'@toptal/davinci/no-private-package-imports': 'off'
},
overrides: [
{
files: ['*.example.jsx', '*.example.tsx'],
rules: {
'react/no-multi-comp': 'off',
'react/require-optimization': 'off',
'import/no-named-default': 'off',
'no-console': 'off',
'no-inline-styles/no-inline-styles': 'off',
'@toptal/davinci/no-private-package-imports': 'error'
}
},
// tests
{
files: ['test.ts', 'test.tsx', '*.spec.ts', '*.spec.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-inline-styles/no-inline-styles': 'off',
'max-lines': 'off'
}
},
// codemod fixtures
{
files: ['packages/picasso-codemod/src/**'],
rules: {
'id-length': [
'error',
{
exceptions: ['e', '_', 'j']
}
]
}
},
// Generated files
{
files: ['packages/picasso/src/Icon/index.ts'],
rules: {
'max-lines': 'off'
}
},
...generateConfig()
]
}