eslint-config-good-code
v1.1.0
Published
A strict eslint configuration for typescript projects promoting good and maintainable coding practices.
Downloads
19
Maintainers
Readme
eslint-config-good-code ✨
A shared strict eslint configuration for typescript (>=3.8) projects.
This package defines a strict eslint config to prevent code smells and promote maintainable coding practices.
It combines recommend settings from eslint, typescript-eslint, unicorn, sonarjs and further enables more rules.
Installation
Before installation make sure your project has eslint (>=7) and typescript (>=3.8) available.
Step 1: Install the required packages
npm i -D eslint-config-good-code @typescript-eslint/eslint-plugin eslint-plugin-sonarjs eslint-plugin-unicorn
Step 2: Extend the config in your app package.json
"eslintConfig": {
"extends": [
"eslint-config-good-code"
]
}
Principles
- Typescript only (with tsx) - No react, jest, a11y etc. rules. Use in any kind of project.
- No stylistic rules.
- No conflicting or double enforced rules.
- No enforcing of rules which typescript can already prevent.
- (future) Multiple configurations - Allow a developer to choose what's required.
- (future) Modular config - Allow customization per project.
Dealing with difficult rules
Readonly Parameters
Mutating objects passed as parameters can lead to unintended bugs. It is highly recommended that this rule should be kept enabled. But typescript does not ship with anything to make an object deeply immutable (aka readonly). Therefore, you can add type-fest, which includes ReadonlyDeep type to mark any object as readonly.
Acknowledgment
This project was made possible due to the incredible work done on the following projects:
License
This project is licensed under the MIT License - see the LICENSE file for details.