README
@voxpelli/eslint-config
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 😄
Installation
Be sure to install versions of peer dependencies that are valid according to the peer dependency specification of this module.
As ESLint configs and dependencies can and will change their rules with major releases you will likely get an incorrect ruleset otherwise.
To easily install all correct peer dependencies, you can use install-peerdeps:
install-peerdeps --dev @voxpelli/eslint-config
Then add a .eslintrc with the following:
{
"extends": "@voxpelli",
"root": true
}
How does this differ from pure standard?
- :stop_sign: = changed to
errorlevel - :warning: = changed to
warnlevel - :mute: = deactivated
- :wrench: = changed config
- :grimacing: = will not pass vanilla standard linting
:wrench: Changed standard rules
- :wrench::warning::grimacing:
comma-dangle– changed – ignore it in everything but functions + is it set towarnrather thanerror. Reason: I'm moving towards preferring dangling commas and thus want my shared config to not prohibit them while a project-by-project override can actually require them (Incompatible with standard) - :mute:
dot-notation– deactivated – clashes with thenoPropertyAccessFromIndexSignaturecheck in TypeScript, which I use - :wrench::grimacing:
no-multi-spaces– changed – setsignoreEOLCommentstotrue, can be useful for more readable comments across multiple lines and I see no real downsides to it (Incompatible with standard) - :wrench:
no-unused-vars– changed – sets"args": "all", "argsIgnorePattern": "^_",because I personally don't feel limited by Express error handlers + wants to stay in sync with TypeScriptnoUnusedParameters - :wrench::grimacing:
semiandno-extra-semi– changed – adopts the semicolons setup from semistandard (Incompatible with plain standard, compatible with semistandard) - :wrench::warning:
n/no-deprecated-api– changed – changed towarninstead oferroras 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 ofconsole.logand similar, as they are mostly used for debugging and should not be committed - :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 orNaNresults - :warning:
no-warning-comments– warns of the existence ofFIXMEcomments, 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
plugin:n/recommendedplugin:security/recommendedplugin:mocha/recommendedplugin:unicorn/recommendedplugin:promise/recommended@voxpelli/eslint-config-jsdoc-ts– which is a TypeScript packaging ofplugin:jsdoc/recommended
:wrench: Overrides of added ESLint rule packages
:mute:
mocha/no-mocha-arrows– deactivated – while Mocha discourages arrow functions I find it more readable to use them + I find it safe when type checking ones test files as then the type checking will notify one when one tries to do athis.setTimeout()or similar in an arrow function where there is no such local context:mute:
n/no-process-exit– deactivated – added byplugin:n/recommended, but deactivated in favor ofunicorn/no-process-exit:wrench:
n/no-unsupported-features/es-syntax– changed – set to always allow dynamicimport(), pending correct detection of support:mute:
security/detect-object-injection– deactivated – causes too many false errors:mute:
security/detect-unsafe-regex– deactivated – at least early on wasn't very stable:wrench:
unicorn/catch-error-name– changed – I prefererrovererroras I finderrorto be a far too similar name to the built inErrorclass:mute:
unicorn/explicit-length-check– deactivated – I don't see an issue withif (string.length)instead ofif (string.length !== 0):warning:
unicorn/unicorn/no-await-expression-member– changed – eg. useful in chai tests:mute:
unicorn/numeric-separators-style– deactivated – currently not enough good support for this in engines:warning:
unicorn/prefer-add-event-listener– changed – set towarninstead oferror:mute:
unicorn/prefer-module– deactivated – each project needs to activate this one themselves for now:warning:
unicorn/prefer-spread– changed – set towarninstead oferror:mute:
unicorn/prevent-abbreviations– deactivated – same asunicorn/catch-error-name, I prefer an abbreviatederrover a non-abbreviatederrorbecause the latter is too similar toErrorfor my taste
:heavy_plus_sign: Additional standalone ESLint rules
:warning:
es/no-exponential-operators– disallows the use of the**operator, as that's in most cases a mistake and one really meant to write*:warning:
n/prefer-global/console:warning:
n/prefer-promises/fs:warning:
n/no-process-env:stop_sign:
n/no-sync:stop_sign:
promise/prefer-await-to-then
Alternatives
See also
- voxpelli/ghatemplates – the templates I use with
ghatto update GitHub Actions in my projects - voxpelli/renovate-config-voxpelli – the shareable Renovate setup I use in my projects
- voxpelli/tsconfig – the shareable
tsconfig.jsonsetup I use in my projects