-
Notifications
You must be signed in to change notification settings - Fork 9
/
.eslintrc.js
102 lines (93 loc) · 3.27 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
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
env: {
browser: true,
es2020: true,
},
plugins: ['@typescript-eslint', 'unused-imports', 'file-progress'],
// global rules for all file types
rules: {
'file-progress/activate': 1,
},
overrides: [
{
files: ['*.js'],
extends: [
'eslint:recommended',
// has to be last entry to be able to override other rules
'prettier',
],
},
{
files: ['*.ts'],
parserOptions: {
project: ['tsconfig.json'],
// TODO activate only in case you run into the problem that some files are not in a Program (could happen with environment.xy.ts files)
createDefaultProgram: false,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
// TODO activate in addition
//'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
// has to be last entry to be able to override other rules
'prettier',
],
rules: {
'@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: '^_' },
],
'@angular-eslint/component-selector': [
'error',
{
prefix: 'app',
style: 'kebab-case',
type: 'element',
},
],
'@angular-eslint/directive-selector': [
'error',
{
prefix: 'app',
style: 'camelCase',
type: 'attribute',
},
],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-implicit-any-catch': ['error', { allowExplicitAny: true }],
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
//TODO activate again (remove line is included in recommended) once we use unknown instead of any (or even better proper types)
'@typescript-eslint/no-explicit-any': 'off',
// TODO these rules should be activated again and the problems fixed.
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
//requires type checking
// TODO activate in addition
// '@typescript-eslint/no-unnecessary-condition': 'error',
// '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
// '@typescript-eslint/prefer-readonly': 'error',
// '@typescript-eslint/prefer-readonly-parameter-types': 'error',
},
},
{
files: ['*.html'],
extends: [
'plugin:@angular-eslint/template/recommended',
// has to be last entry to be able to override other rules
'prettier',
],
rules: {},
},
],
};