@s-libs/eslint-config-ng
v18.0.0
Published
This library provides some default config you can use for ESLint in an Angular project.
Downloads
37
Readme
This library provides some default config you can use for ESLint in an Angular project.
"Recommended" Config
Follow these instructions to get all the community-recommended config from ESLint
,
@typescript-eslint
, and @angular-eslint
.
First install Angular ESLint, following their instructions for your situation. Make sure it is working with their default config.
npm install --save-dev @s-libs/eslint-config-ng
Change
.eslintrc.json
in your root directory to this, and make adjustments to suit your needs:{ "extends": "@s-libs/eslint-config-ng", "overrides": [ { "files": ["*.ts"], "rules": { "@angular-eslint/directive-selector": ["error", { "type": "attribute", "prefix": "app", "style": "camelCase" }], "@angular-eslint/component-selector": ["error", { "type": "element", "prefix": "app", "style": "kebab-case" }] } } ] }
Strict Config
Use these instructions for much stricter linting, start with the instructions above then continue with these. It starts with all rules from the libraries above, then turns off or modifies rules that Simonton Software subjectively thinks makes the config better.
Follow the instructions above for recommended config and ensure it works.
npm install --save-dev eslint-config-prettier
Change
extends
in.eslintrc.json
to@s-libs/eslint-config-ng/strict
Add the
parserOptions
to the.eslintrc.json
file you created, so it looks like this:{ "extends": "@s-libs/eslint-config-ng/strict", "overrides": [ { "files": ["*.ts"], "parserOptions": { "project": ["tsconfig.(app|spec).json"] }, "rules": { "@angular-eslint/directive-selector": ["error", { "type": "attribute", "prefix": "app", "style": "camelCase" }], "@angular-eslint/component-selector": ["error", { "type": "element", "prefix": "app", "style": "kebab-case" }] } } ] }
Warning: the configs from underlying libraries is not as stable as the ones used for their "recommended" configs. It can change with minor version updates to the underlying libraries.