https://github.com/dsi-hug/eslint-config
✨ ESLint shareable configuration with great defaults
https://github.com/dsi-hug/eslint-config
angular code cypress es6 eslint eslintconfig javascript jslint lint linter quality rxjs style typescript
Last synced: about 1 year ago
JSON representation
✨ ESLint shareable configuration with great defaults
- Host: GitHub
- URL: https://github.com/dsi-hug/eslint-config
- Owner: DSI-HUG
- License: gpl-3.0
- Created: 2021-04-14T16:27:16.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-03T15:01:11.000Z (about 1 year ago)
- Last Synced: 2025-04-03T15:44:08.170Z (about 1 year ago)
- Topics: angular, code, cypress, es6, eslint, eslintconfig, javascript, jslint, lint, linter, quality, rxjs, style, typescript
- Language: JavaScript
- Homepage:
- Size: 1.42 MB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
@hug/eslint-config
ESLint shareable configuration with great defaults
## Installation
```sh
npm install @hug/eslint-config --save-dev
```
```sh
yarn add eslint@8.x @hug/eslint-config --dev
```
Prior to version 20.2.0
>
>
> Create a `tsconfig.eslint.json` file at the root of your project
>
> ```jsonc
> {
> "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"]
> }
> ```
For Angular >= 10.x <= 11.x
>
>
> ```sh
> npm install @hug/eslint-config@2.x --save-dev
> ```
>
> ```sh
> yarn add eslint@7.x @hug/eslint-config@2.x --dev
> ```
Migrating from tslint
>
>
> 1. Remove `tslint` and `codelyzer` from your dependencies
> 2. Remove any `tslint.json` configuration files
> 3. Add `eslint` as a dev dependency
> 4. Have a look at our [Angular project example][ng-example] and modify all your `tsconfig` files accordingly
## 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
## Usage
1. Create an `.eslintrc.json` file at the root of your project
```jsonc
{
"root": true,
"extends": [
/**
* Possible values: 'recommended (strict) | moderate (less stricter)'
*/
"@hug/eslint-config/recommended"
]
}
```
2. Modify your existing `angular.json`
```json
"architect": {
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"**/*.js",
"**/*.json",
"**/*.ts",
"**/*.html"
]
}
}
}
```
3. Run `ng lint`
_You can also skip steps `2` and `3` and simply run:_
```
eslint *.{js,json,ts,html}
```
## 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][dsi-hug].
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] |
## Development
See the [developer docs][developer].
## 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][contributing], and learn about submission process, coding rules and more.
#### > Code of Conduct
Please read and follow the [Code of Conduct][codeofconduct], and help us keep this project open and inclusive.
## Credits
Copyright (C) 2021 [HUG - Hôpitaux Universitaires Genève][dsi-hug]
[][dsi-hug]
[angular-eslint]: https://github.com/angular-eslint/angular-eslint
[ng-example]: https://github.com/dsi-hug/eslint-config/blob/main/examples/angular
[cypress]: https://www.cypress.io/
[developer]: https://github.com/dsi-hug/eslint-config/blob/main/DEVELOPER.md
[contributing]: https://github.com/dsi-hug/eslint-config/blob/main/CONTRIBUTING.md
[codeofconduct]: https://github.com/dsi-hug/eslint-config/blob/main/CODE_OF_CONDUCT.md
[dsi-hug]: https://github.com/dsi-hug