Skip to content

Commit

Permalink
build: Replace Codelyzer and TSLint with Angular ESLint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rhopman authored and adamsaghy committed Nov 8, 2024
1 parent e910679 commit 9034ce2
Show file tree
Hide file tree
Showing 204 changed files with 2,246 additions and 1,235 deletions.
51 changes: 51 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"prefix": "mifosx",
"style": "kebab-case",
"type": "element"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"prefix": "mifosx",
"style": "camelCase",
"type": "attribute"
}
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- name: Npm install
run: npm install

- name: Run tslint
run : npx tslint src/**/*.ts
- name: Run eslint
run : npx ng lint

- name: Run build
run : npm run build:prod
Expand Down
27 changes: 12 additions & 15 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json",
"cypress/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
},
Expand Down Expand Up @@ -198,13 +194,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"e2e/cypress/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
]
}
},
Expand Down Expand Up @@ -232,6 +226,9 @@
}
},
"cli": {
"analytics": false
"analytics": false,
"schematicCollections": [
"@angular-eslint/schematics"
]
}
}
3 changes: 1 addition & 2 deletions docs/coding-guides/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ To manage type definitions, use standard `npm install|update|remove` commands.

## Enforcement

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

## Learn more

Expand Down
43 changes: 43 additions & 0 deletions e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"extends": "../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"e2e/tsconfig.app.json",
"e2e/tsconfig.spec.json",
"e2e/e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"style": "kebab-case"
}
]
}
},
{
"files": [
"*.html"
],
"rules": {}
}
]
}
Loading

0 comments on commit 9034ce2

Please sign in to comment.