@hug/eslint-config v17.0.2
Installation
# Angular >= 12.x
$ npm install @hug/eslint-config --save-dev
$ yarn add eslint@8.x @hug/eslint-config --dev
# Angular >= 10.x <= 11.x
$ npm install @hug/eslint-config@2.x --save-dev
$ yarn add eslint@7.x @hug/eslint-config@2.x --dev
Requirements
As of now this configuration is intented to work with Angular projects only.
Projects running under
Angular 10.x
can safely ignore@angular-eslint
warnings during installation.
- an Angular >= 10.x project (see the migration guide for projects that are still using
tslint
)
Usage
- Create a
tsconfig.eslint.json
file at the root of your project
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": [
"node",
"jasmine",
//
// In case you are using WebdriverIO
// "@wdio/globals/types"
//
// In case you are using Cypress
// "cypress"
//
// Any other types that are required by your tests
// ...
]
},
"include": [
"src/**/*.ts",
"e2e/**/*.ts"
]
}
- Create a
.eslintrc.json
file at the root of your project
{
"root": true,
"extends": [
/**
* Possible values: 'recommended (strict) | moderate (less stricter)'
*/
"@hug/eslint-config/recommended"
]
}
- Modify your existing
angular.json
"architect": {
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"**/*.js",
"**/*.json",
"**/*.ts",
"**/*.html"
]
}
}
}
- Run
ng lint
Rules
This configuration exports a recommended set of rules that enforces good practices.
They may or may not served you well as they are mainly designed to be used by the HUG organization's team.
The rules applies as follow:
Files | Rules |
---|---|
*/.ts | es6 , typescript , angular , rxjs , no-secrets |
*/.js | es6 , no-secrets |
*/.mjs | es6 , no-secrets |
*/.html | angular-template |
*/.json | no-secrets |
e2e/*/.ts | es6 , typescript , no-secrets , cypress , chai-friendly - in case you are using Cypress |
Migrating from tslint
Remove
tslint
andcodelyzer
from your dependenciesRemove any
tslint.json
configuration filesAdd
eslint
as a dev dependencyHave a look at our Angular project example and modify all your
tsconfig
files accordingly
Development
See the developer docs.
Contributing
> Want to Help?
Want to file a bug, contribute some code or improve documentation? Excellent!
But please read up first on the guidelines for contributing, and learn about submission process, coding rules and more.
> Code of Conduct
Please read and follow the Code of Conduct, and help us keep this project open and inclusive.
Credits
Copyright (C) 2021 HUG - Hôpitaux Universitaires Genève
6 days ago
2 months ago
3 months ago
3 months ago
9 months ago
9 months ago
9 months ago
8 months ago
6 months ago
8 months ago
10 months ago
11 months ago
11 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago