-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
179 lines (160 loc) · 5.58 KB
/
eslint.config.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// eslint.config.js
const angularEslintRecommended = require('@angular-eslint/eslint-plugin').configs.recommended;
const angularTemplateProcessInlineTemplates = require('@angular-eslint/eslint-plugin-template').configs['process-inline-templates'];
const prettierConfig = require('eslint-config-prettier');
// eslint.config.js
module.exports = [
{
ignores: ["projects/**/*"], // Optional: ignore specific folders
},
{
files: ["src/**/*.ts"], // Specify the source folder explicitly
languageOptions: {
parser: require("@typescript-eslint/parser"), // Correct parser import
parserOptions: {
project: ['tsconfig.json'],
createDefaultProgram: true,
},
},
plugins: {
"@typescript-eslint": require("@typescript-eslint/eslint-plugin"),
"import": require("eslint-plugin-import"),
"@angular-eslint": require("@angular-eslint/eslint-plugin"),
},
rules: {
...angularEslintRecommended.rules,
...angularTemplateProcessInlineTemplates.rules,
...prettierConfig.rules,
'@angular-eslint/component-class-suffix': [
'warn',
{
suffixes: ['Page', 'Component','Container'],
},
],
// '@angular-eslint/component-selector': [
// 'warn',
// {
// type: 'element',
// prefix: 'app',
// style: 'kebab-case',
// },
// ],
// '@angular-eslint/directive-selector': [
// 'warn',
// {
// type: 'attribute',
// prefix: 'app',
// style: 'camelCase',
// },
// ],
// TO EXPENSIVE
// '@typescript-eslint/member-ordering': [
// 'warn',
// {
// default: [
// 'signature',
// 'call-signature',
// 'public-static-field',
// 'protected-static-field',
// 'private-static-field',
// '#private-static-field',
// 'public-decorated-field',
// 'protected-decorated-field',
// 'private-decorated-field',
// 'public-instance-field',
// 'protected-instance-field',
// 'private-instance-field',
// '#private-instance-field',
// 'public-abstract-field',
// 'protected-abstract-field',
// 'public-field',
// 'protected-field',
// 'private-field',
// '#private-field',
// 'static-field',
// 'instance-field',
// 'abstract-field',
// 'decorated-field',
// 'field',
// 'static-initialization',
// 'public-constructor',
// 'protected-constructor',
// 'private-constructor',
// 'constructor',
// 'public-static-method',
// 'protected-static-method',
// 'private-static-method',
// '#private-static-method',
// 'public-decorated-method',
// 'protected-decorated-method',
// 'private-decorated-method',
// 'public-instance-method',
// 'protected-instance-method',
// 'private-instance-method',
// '#private-instance-method',
// 'public-abstract-method',
// 'protected-abstract-method',
// 'public-method',
// 'protected-method',
// 'private-method',
// '#private-method',
// 'static-method',
// 'instance-method',
// 'abstract-method',
// 'decorated-method',
// 'method',
// ],
// },
// ],
// '@typescript-eslint/explicit-function-return-type': 0,
// 'no-void': 'error',
"no-unused-vars": "warn",
"import/order": [
"warn",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true, // Allow function expressions (like anonymous functions) without return type
allowTypedFunctionExpressions: true, // Allow functions in type declarations (like in interfaces)
allowDirectConstAssertionInArrowFunctions: true, // Allow direct assertions
allowHigherOrderFunctions: true, // Allow higher-order functions without explicit return type
allowedNames: [], // List of getter names that are allowed to not have a return type
// enforceForGetters: true, // Enforce return type for getters
// enforceForSetters: false, // No need to enforce return type for setters (setters don't have return types)
},
],
// '@typescript-eslint/typedef': [
// 'warn',
// {
// memberVariableDeclaration: true,
// parameter: true,
// propertyDeclaration: true,
// },
// ],
},
},
// NOTE: WE ARE NOT APPLYING PRETTIER IN THIS OVERRIDE, ONLY @ANGULAR-ESLINT/TEMPLATE
{
files: ['*.html'],
extends: ['plugin:@angular-eslint/template/recommended'],
rules: {},
},
// NOTE: WE ARE NOT APPLYING @ANGULAR-ESLINT/TEMPLATE IN THIS OVERRIDE, ONLY PRETTIER
{
files: ['*.html'],
excludedFiles: ['*inline-template-*.component.html'],
extends: ['plugin:prettier/recommended'],
rules: {
// NOTE: WE ARE OVERRIDING THE DEFAULT CONFIG TO ALWAYS SET THE PARSER TO ANGULAR (SEE BELOW)
'prettier/prettier': ['error', { parser: 'angular' }],
},
},
];