@voxpelli/eslint-config
TypeScript icon, indicating that this package has built-in type declarations

19.0.0 • Public • Published

@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?

  • 🛑 = changed to error level
  • ⚠️ = changed to warn level
  • 🔇 = deactivated
  • 🔧 = changed config
  • 😬 = will not pass vanilla standard linting

🔧 Changed standard rules

  • 🔧⚠️😬 comma-danglechanged – prefer dangling commas in everything but functions + is it set to warn rather than error as I gradually move to this setup
  • 🔇 dot-notationdeactivated – clashes with the noPropertyAccessFromIndexSignature check in TypeScript, which I use
  • 🔧😬 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)
  • 🔧 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
  • 🔧😬 semi and no-extra-semichanged – adopts the semicolons setup from semistandard (Incompatible with plain standard, compatible with semistandard)
  • 🔧⚠️ n/no-deprecated-apichanged – changed to warn instead of error as often it's not an urgent thing to fix

Added ESLint core rules

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

📦 Added ESLint rule package

🔧 Overrides of added ESLint rule packages

Additional standalone ESLint rules

Extended ESM config

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

🔧 Overrides of rules

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

Alternatives

See also

Readme

Keywords

none

Package Sidebar

Install

npm i @voxpelli/eslint-config

Weekly Downloads

279

Version

19.0.0

License

MIT

Unpacked Size

32.3 kB

Total Files

7

Last publish

Collaborators

  • voxpelli