19.0.0 • Published 10 months ago

@voxpelli/eslint-config v19.0.0

Weekly downloads
1,078
License
MIT
Repository
github
Last release
10 months ago

@voxpelli/eslint-config

npm version npm downloads `js-semistandard-style` Follow @voxpelli@mastodon.social

My personal ESLint config which extends standard / semistandard with a couple of extra checks that I find helpful in my projects.

Includes the semistandard rules directly rather than relying on eslint-config-semistandard, as that package isn't always trailing the main eslint-config-standard package.

This package follows semantic versioning. Tightening of any checks is a breaking change, therefore that will only happen in major releases. Minor and patch releases will only include relaxation of rules or fixing of minor obvious oversights.

Can I use this in my own project?

Absolutely, go ahead! I maintain this project as if multiple people are using it. Be sure to give me feedback and if you like it, give me a ping and say so, would make my day 😄

Usage

Install

Be sure to install the correct versions of peer dependencies that this module requires, else you will likely get an incorrect rule setup.

To easily install all correct peer dependencies, you can use install-peerdeps:

install-peerdeps --dev @voxpelli/eslint-config

Configure

Add an .eslintrc, or other ESLint configuration, that extends this config:

{
  "extends": "@voxpelli",
  "root": true
}

Configure, ESM

Instead of simply extending @voxpelli you can extend @voxpelli/eslint-config/esm and get a version of the rules that enforces ESM best practices as well.

How does this differ from pure standard?

  • :stop_sign: = changed to error level
  • :warning: = changed to warn level
  • :mute: = deactivated
  • :wrench: = changed config
  • :grimacing: = will not pass vanilla standard linting

:wrench: Changed standard rules

  • :wrench::warning::grimacing: comma-danglechanged – prefer dangling commas in everything but functions + is it set to warn rather than error as I gradually move to this setup
  • :mute: dot-notationdeactivated – clashes with the noPropertyAccessFromIndexSignature check in TypeScript, which I use
  • :wrench::grimacing: no-multi-spaceschanged – sets ignoreEOLComments to true, can be useful for more readable comments across multiple lines and I see no real downsides to it (Incompatible with standard)
  • :wrench: no-unused-varschanged – sets "args": "all", "argsIgnorePattern": "^_", because I personally don't feel limited by Express error handlers + wants to stay in sync with TypeScript noUnusedParameters
  • :wrench::grimacing: semi and no-extra-semichanged – adopts the semicolons setup from semistandard (Incompatible with plain standard, compatible with semistandard)
  • :wrench::warning: n/no-deprecated-apichanged – changed to warn instead of error as often it's not an urgent thing to fix

:heavy_plus_sign: Added ESLint core rules

  • :warning: func-style – disallows function declarations, good to be consistent with how functions are declared
  • :warning: no-console – warns on existence of console.log and similar, as they are mostly used for debugging and should not be committed
  • :stop_sign: no-constant-binary-expression – errors when binary expressions are detected to constantly evaluate a specific way
  • :stop_sign: no-nonoctal-decimal-escape – there's no reason not to ban it
  • :stop_sign: no-unsafe-optional-chaining – enforces one to be careful with .? and not use it in ways that can inadvertently cause errors or NaN results
  • :warning: no-warning-comments – warns of the existence of FIXME comments, as they should always be fixed before pushing
  • :stop_sign: object-shorthand – requires the use of object shorthands for properties, more tidy
  • :stop_sign: quote-props – requires properties to be quoted when needed but otherwise disallows it

:package: Added ESLint rule package

:wrench: Overrides of added ESLint rule packages

:heavy_plus_sign: Additional standalone ESLint rules

  • :warning: es-x/no-exponential-operators – disallows the use of the ** operator, as that's in most cases a mistake and one really meant to write *

  • :warning: import/no-deprecated – disallows the use of explicitly deprecated code (code marked with @deprecated)

  • :stop_sign: import/no-order – enforces a specific ordering of imports

Extended ESM config

By extending @voxpelli/eslint-config/esm instead of @voxpelli you will get these differences:

:wrench: Overrides of rules

  • :warning: func-style – enforces function declarations whenever an arrow function isn't used. Better to do export function foo () { than export const foo = function () {
  • :stop_sign: unicorn/prefer-modulechanged – restored to its plugin:unicorn/recommended value of error

Alternatives

See also

19.0.0

10 months ago

18.0.0

12 months ago

17.0.3

12 months ago

17.0.2

1 year ago

17.0.1

1 year ago

17.0.0

1 year ago

16.0.7

1 year ago

16.0.5

1 year ago

16.0.4

1 year ago

16.0.3

1 year ago

15.2.0

2 years ago

15.1.0

2 years ago

15.0.0

2 years ago

14.1.0

2 years ago

14.0.0

2 years ago

14.0.1

2 years ago

14.0.2

2 years ago

14.0.3

2 years ago

14.0.4

2 years ago

14.0.0-1

2 years ago

14.0.0-0

2 years ago

14.0.0-3

2 years ago

14.0.0-2

2 years ago

13.0.2

2 years ago

13.0.3

2 years ago

13.0.0

2 years ago

13.0.1

2 years ago

12.0.2

3 years ago

12.0.0

3 years ago

12.0.1

3 years ago

11.0.1

3 years ago

11.0.0

3 years ago

10.0.0

3 years ago

9.0.0

3 years ago

8.0.1

3 years ago

8.0.0

3 years ago

8.0.0-1

3 years ago

8.0.0-0

3 years ago

7.0.0-0

4 years ago

7.0.0

4 years ago

6.0.0

4 years ago

6.0.0-0

4 years ago

5.0.0

4 years ago

5.0.0-0

4 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago