Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eslint-config-good-code

anantoghosh68MIT1.1.0

A strict eslint configuration for typescript projects promoting good and maintainable coding practices.

eslint, config, strict, code, good, smell, maintainable, typescript

readme

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.

changelog

1.1.0 (2021-09-21)

Bug Fixes

  • change tsconfig path (ac3f38a)
  • correct tsconfig location for mit file (54da07f)

Features

  • add err to abbreviation ignore (9f09356)
  • unicorn: add custom error definition rule (33fab59)
  • add 2 to ignored numbers (ae133f0)
  • add consistency rules (5b13340)
  • turn of prefer query selector (458ec8e)

1.0.2 (2021-02-23)

Bug Fixes

  • disable redundant constant Boolean check (7a1e5a8)

1.0.1 (2021-02-22)

Features

  • Add release management
  • Add changelog generation

1.0.0 (2021-02-22)

Features