-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.base.config.cjs
95 lines (94 loc) · 2.59 KB
/
eslint.base.config.cjs
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
const eslint = require('@eslint/js');
// eslint-disable-next-line no-restricted-modules
const nx = require('@nx/eslint-plugin');
const perfectionist = require('eslint-plugin-perfectionist');
module.exports = [
...nx.configs['flat/base'],
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'],
depConstraints: [
{
onlyDependOnLibsWithTags: ['scope:main', 'scope:state'],
sourceTag: 'scope:testing',
},
{
onlyDependOnLibsWithTags: [
'scope:state',
'scope:generated',
'scope:components',
],
sourceTag: 'scope:main',
},
{
onlyDependOnLibsWithTags: [
'scope:generated',
'scope:state',
'scope:components',
],
sourceTag: 'scope:design',
},
{
onlyDependOnLibsWithTags: ['scope:generated', 'scope:state'],
sourceTag: 'scope:state',
},
{
onlyDependOnLibsWithTags: ['scope:generated'],
sourceTag: 'scope:components',
},
{
notDependOnLibsWithTags: ['*'],
sourceTag: 'scope:generated',
},
{
onlyDependOnLibsWithTags: ['utility'],
sourceTag: 'plugin',
},
],
enforceBuildableLibDependency: true,
},
],
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.mjs'],
plugins: { perfectionist },
rules: {
curly: 'error',
'no-duplicate-imports': 'error',
'object-shorthand': 'error',
'perfectionist/sort-imports': 'error',
},
},
{
files: ['**/*.js', '**/*.jsx', '**/*.mjs'],
rules: {
...eslint.configs.recommended.rules,
},
},
{
files: ['**/*.config.{js,ts,cjs,mjs}', '**/*-rules.{js,ts,cjs,mjs}'],
plugins: { perfectionist },
rules: {
'no-restricted-modules': [
'error',
{
paths: [
{
message:
'Import from `util/angular-rules` and `util/typescript-rules` instead.',
name: '@nx/eslint-plugin',
},
],
},
],
'perfectionist/sort-objects': ['error', { type: 'natural' }],
},
},
];