-
-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy patheslint.config.mjs
More file actions
125 lines (124 loc) · 3.39 KB
/
eslint.config.mjs
File metadata and controls
125 lines (124 loc) · 3.39 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
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
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
import eslintPluginImport from 'eslint-plugin-import';
import nx from '@nx/eslint-plugin';
import stylistic from '@stylistic/eslint-plugin';
export default [
stylistic.configs.recommended,
...nx.configs['flat/base'],
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
eslintPluginPrettierRecommended,
{
ignores: ['**/dist'],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
plugins: {
import: eslintPluginImport,
'unused-imports': eslintPluginUnusedImports,
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.base.json',
},
},
},
rules: {
'@nx/enforce-module-boundaries': [
'warn',
{
enforceBuildableLibDependency: true,
allow: [
String.raw`^.*/eslint(\.base)?\.config\.[cm]?js$`,
'^@doc/domain/.*$',
'^@doc/env/.*$',
'^@doc/shared/.*$',
'^@doc/widget/.*$',
'^@cli/.*$',
'^@zard/.*$',
],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
// Remove unused imports
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
// Import ordering and organization
'import/order': [
'error',
{
groups: [['builtin', 'external'], 'internal', ['parent', 'sibling', 'index']],
pathGroups: [
{
pattern: '@angular/**',
group: 'external',
position: 'before',
},
{
pattern: '@doc/**',
group: 'internal',
position: 'before',
},
{
pattern: '@zard/**',
group: 'internal',
position: 'before',
},
{
pattern: '@/**',
group: 'internal',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/no-unresolved': 'off',
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
// Override or add rules here
rules: {
'@stylistic/indent': ['error', 2],
'@stylistic/max-len': [
'error',
{ code: 120, ignoreStrings: true, ignoreUrls: true, ignoreTemplateLiterals: true },
],
},
},
{
files: ['**/*.html'],
languageOptions: {
parser: (await import('@angular-eslint/template-parser')).default,
},
rules: {
'@stylistic/spaced-comment': 'off',
'prettier/prettier': ['error', { parser: 'angular' }],
},
},
];