Skip to content

Commit

Permalink
Whip ESLint config into shape & cleanup unused things with Knip #561
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf committed Oct 25, 2023
1 parent 98b136a commit 4d96034
Show file tree
Hide file tree
Showing 138 changed files with 1,073 additions and 1,769 deletions.
35 changes: 22 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"prettier"
],
"plugins": ["deprecation"],
"rules": {
Expand All @@ -25,9 +28,17 @@
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "erz",
"style": "camelCase",
"type": "attribute"
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "erz",
"style": "kebab-case"
}
],
"no-restricted-globals": [
Expand All @@ -43,21 +54,19 @@
"patterns": ["fp-ts/lib/*"]
}
],
"deprecation/deprecation": "warn"
"deprecation/deprecation": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "_.*"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"extends": ["plugin:@angular-eslint/template/recommended", "prettier"],
"rules": {}
},
{
"files": ["*.html"],
"excludedFiles": ["*inline-template-*.component.html"],
"extends": ["plugin:prettier/recommended"],
"rules": {
"prettier/prettier": ["error", { "parser": "angular" }]
}
}
]
}
12 changes: 0 additions & 12 deletions .htmlvalidate.json

This file was deleted.

38 changes: 38 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"entry": [
"src/main.ts",
"src/spec-builders.ts",
"src/spec-helpers.ts",
"src/specs/expectations.ts",
"src/specs/utils.ts",
"src/polyfills.ts"
],
"project": ["src/**/*.{ts,js}"],
"ignore": [
"src/**/*.spec.ts",
"src/environments/environment.prod.ts",
"src/karma.conf.js",
"src/settings.example.js"
],
"ignoreDependencies": [
"@angular-eslint/schematics",
"@angular-eslint/template-parser",
"@angular/language-service",
"@typescript-eslint/parser",
"bootstrap",
"jasmine-core",
"karma-brief-reporter",
"karma-chrome-launcher",
"karma-coverage-istanbul-reporter",
"karma-jasmine",
"karma-jasmine-html-reporter",
"karma-spec-reporter"
],
"ignoreBinaries": ["knip", "webpack-bundle-analyzer"],
"rules": {
"exports": "warn",
"types": "warn",
"classMembers": "off",
"enumMembers": "off"
}
}
10 changes: 5 additions & 5 deletions doc/prettier.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

We use Prettier to automatically format the source code.

The module is integrated threefold:
The module is integrated as follows:

- Format on save in the editor, see https://prettier.io/docs/en/editors.html
- Pre-commit hook in Git
- Linting step in the CI pipeline: The build fails when a (TypeScript) file is not properly formatted (part of `npm run lint`)

## Update Prettier version

Automatic Prettier updates are disabled, because the formatting rules can change in newer versions. Therefore an exact version of the Prettier module is installed.

You can update it manually:
You can update it manually (will also reformat source with new Prettier version):

```
npm install --save-exact prettier@latest
npm run format:upgrade
git commit -a -m "Reformat sources after Prettier update"
```

To reformat the code base afterwards:
Or to just reformat the code:

```
npm run format
Expand Down
8 changes: 7 additions & 1 deletion doc/setup-dev-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[back](../README.md)

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.8.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli).

## Preparation

Expand All @@ -28,6 +28,12 @@ Run `npm run build` to build the project. The build artifacts will be stored in

Run `npm test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Linting & checks

Run `npm run lint` to check source files with [ESLint](https://eslint.org/). For the configuration, see [.eslintrc.json](./.eslintrc.json).

Run `npm run unused` to print a report of unused dependencies, files & exports using [Knip](https://github.com/webpro/knip). For the configuration, see [.knip.json](./.knip.json).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
Loading

0 comments on commit 4d96034

Please sign in to comment.