Skip to content

Commit f074cb3

Browse files
committed
build: Replace Codelyzer and TSLint with Angular ESLint
Migrate from the deprecated TSLint to Angluar ESLint. Also fix current linting issues in the code, in particular: - Use strict equals operators (=== and !==) - Remove empty lifecycle methods (mostly ngOnInit) - Output bindings including aliases should not be named as standard dom events (submit) - Async pipe results should not be negated
1 parent e910679 commit f074cb3

File tree

204 files changed

+2245
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+2245
-1234
lines changed

.eslintrc.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": [
4+
"projects/**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"tsconfig.json",
14+
"e2e/tsconfig.json"
15+
],
16+
"createDefaultProgram": true
17+
},
18+
"extends": [
19+
"plugin:@angular-eslint/recommended",
20+
"plugin:@angular-eslint/template/process-inline-templates"
21+
],
22+
"rules": {
23+
"@angular-eslint/component-selector": [
24+
"error",
25+
{
26+
"prefix": "mifosx",
27+
"style": "kebab-case",
28+
"type": "element"
29+
}
30+
],
31+
"@angular-eslint/directive-selector": [
32+
"error",
33+
{
34+
"prefix": "mifosx",
35+
"style": "camelCase",
36+
"type": "attribute"
37+
}
38+
]
39+
}
40+
},
41+
{
42+
"files": [
43+
"*.html"
44+
],
45+
"extends": [
46+
"plugin:@angular-eslint/template/recommended"
47+
],
48+
"rules": {}
49+
}
50+
]
51+
}

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- name: Npm install
3535
run: npm install
3636

37-
- name: Run tslint
38-
run : npx tslint src/**/*.ts
37+
- name: Run eslint
38+
run : npx ng lint
3939

4040
- name: Run build
4141
run : npm run build:prod

angular.json

+12-15
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,11 @@
135135
}
136136
},
137137
"lint": {
138-
"builder": "@angular-devkit/build-angular:tslint",
138+
"builder": "@angular-eslint/builder:lint",
139139
"options": {
140-
"tsConfig": [
141-
"src/tsconfig.app.json",
142-
"src/tsconfig.spec.json",
143-
"cypress/tsconfig.json"
144-
],
145-
"exclude": [
146-
"**/node_modules/**"
140+
"lintFilePatterns": [
141+
"src/**/*.ts",
142+
"src/**/*.html"
147143
]
148144
}
149145
},
@@ -198,13 +194,11 @@
198194
}
199195
},
200196
"lint": {
201-
"builder": "@angular-devkit/build-angular:tslint",
197+
"builder": "@angular-eslint/builder:lint",
202198
"options": {
203-
"tsConfig": [
204-
"e2e/cypress/tsconfig.json"
205-
],
206-
"exclude": [
207-
"**/node_modules/**"
199+
"lintFilePatterns": [
200+
"e2e/**/*.ts",
201+
"e2e/**/*.html"
208202
]
209203
}
210204
},
@@ -232,6 +226,9 @@
232226
}
233227
},
234228
"cli": {
235-
"analytics": false
229+
"analytics": false,
230+
"schematicCollections": [
231+
"@angular-eslint/schematics"
232+
]
236233
}
237234
}

docs/coding-guides/typescript.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ To manage type definitions, use standard `npm install|update|remove` commands.
5454

5555
## Enforcement
5656

57-
Coding rules are enforced in this project via [TSLint](https://github.com/palantir/tslint).
58-
Angular-specific rules are also enforced via the [Codelyzer](https://github.com/mgechev/codelyzer) rule extensions.
57+
Coding rules are enforced in this project via [Angular ESLint](https://github.com/angular-eslint/angular-eslint).
5958

6059
## Learn more
6160

e2e/.eslintrc.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"extends": "../.eslintrc.json",
3+
"ignorePatterns": [
4+
"!**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"e2e/tsconfig.app.json",
14+
"e2e/tsconfig.spec.json",
15+
"e2e/e2e/tsconfig.json"
16+
],
17+
"createDefaultProgram": true
18+
},
19+
"rules": {
20+
"@angular-eslint/directive-selector": [
21+
"error",
22+
{
23+
"type": "attribute",
24+
"style": "camelCase"
25+
}
26+
],
27+
"@angular-eslint/component-selector": [
28+
"error",
29+
{
30+
"type": "element",
31+
"style": "kebab-case"
32+
}
33+
]
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.html"
39+
],
40+
"rules": {}
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)