eslint-config-good-code

1.1.0 • Public • Published

eslint-config-good-code npm version GitHub Workflow Status

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    33
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    33
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i eslint-config-good-code

Weekly Downloads

33

Version

1.1.0

License

MIT

Unpacked Size

14 kB

Total Files

11

Last publish

Collaborators

  • anantoghosh