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.
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 ๐
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
Add an .eslintrc
, or other ESLint configuration, that extends this config:
{
"extends": "@voxpelli",
"root": true
}
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 towarn
level- ๐ = deactivated
- ๐ง = changed config
- ๐ฌ = will not pass vanilla standard linting
๐ง Changed standard rules
- ๐ง
โ ๏ธ ๐ฌcomma-dangle
โ changed โ prefer dangling commas in everything but functions + is it set towarn
rather thanerror
as I gradually move to this setup - ๐
dot-notation
โ deactivated โ clashes with thenoPropertyAccessFromIndexSignature
check in TypeScript, which I use - ๐ง๐ฌ
no-multi-spaces
โ changed โ setsignoreEOLComments
totrue
, can be useful for more readable comments across multiple lines and I see no real downsides to it (Incompatible with standard) - ๐ง
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
- ๐ง๐ฌ
semi
andno-extra-semi
โ changed โ adopts the semicolons setup from semistandard (Incompatible with plain standard, compatible with semistandard) - ๐ง
โ ๏ธ n/no-deprecated-api
โ changed โ changed towarn
instead oferror
as often it's not an urgent thing to fix
โ ๏ธ func-style
โ disallows function declarations, good to be consistent with how functions are declaredโ ๏ธ no-console
โ warns on existence ofconsole.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 orNaN
results โ ๏ธ no-warning-comments
โ warns of the existence ofFIXME
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
plugin:n/recommended
plugin:security/recommended
plugin:mocha/recommended
plugin:unicorn/recommended
plugin:promise/recommended
plugin:jsdoc/recommended
-
๐
jsdoc/check-types
โ deactivated โ to improve use with types in js. -
๐
jsdoc/no-undefined-types
โ deactivated โ to improve use with types in js. -
๐
jsdoc/require-jsdoc
โ deactivated โ to improve use with types in js. -
๐
jsdoc/require-param-description
โ deactivated โ to improve use with types in js. -
๐
jsdoc/require-property-description
โ deactivated โ to improve use with types in js. -
๐
jsdoc/require-returns-description
โ deactivated โ to improve use with types in js. -
๐
jsdoc/require-yields
โ deactivated โ to improve use with types in js. -
๐ง
jsdoc/tag-lines
โ changed โ to enforce an empty line between description and tags, but disallow them elsewhere. -
๐
jsdoc/valid-types
โ deactivated โ to improve use with types in js. -
๐
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 -
๐
n/no-process-exit
โ deactivated โ added byplugin:n/recommended
, but deactivated in favor ofunicorn/no-process-exit
-
๐
security/detect-object-injection
โ deactivated โ causes too many false errors -
๐
security/detect-unsafe-regex
โ deactivated โ at least early on wasn't very stable -
๐ง
unicorn/catch-error-name
โ changed โ I prefererr
overerror
as I finderror
to be a far too similar name to the built inError
class -
๐
unicorn/explicit-length-check
โ deactivated โ I don't see an issue withif (string.length)
instead ofif (string.length !== 0)
-
โ ๏ธ unicorn/unicorn/no-await-expression-member
โ changed โ eg. useful in chai tests -
โ ๏ธ unicorn/unicorn/no-negated-condition
โ deactivated โ turned off, there are valid cases for this, so it simply gets noisy -
๐
unicorn/numeric-separators-style
โ deactivated โ currently not enough good support for this in engines -
โ ๏ธ unicorn/prefer-add-event-listener
โ changed โ set towarn
instead oferror
-
โ ๏ธ unicorn/prefer-event-target
โ changed โ set towarn
instead oferror
-
๐
unicorn/prefer-module
โ deactivated โ only useful when you know you're targetting ESM -
โ ๏ธ unicorn/prefer-spread
โ changed โ set towarn
instead oferror
-
โ ๏ธ unicorn/prefer-string-replace-all
โ changed โ set towarn
instead oferror
-
๐
unicorn/prevent-abbreviations
โ deactivated โ same asunicorn/catch-error-name
, I prefer an abbreviatederr
over a non-abbreviatederror
because the latter is too similar toError
for my taste -
๐ง
unicorn/switch-case-braces
โ changed โ I prefer to avoid braces incase
statements rather than enforcing them
-
โ ๏ธ 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*
-
โ ๏ธ import/no-deprecated
โ disallows the use of explicitly deprecated code (code marked with@deprecated
) -
๐
import/no-order
โ enforces a specific ordering of imports -
โ ๏ธ n/prefer-global/console
-
โ ๏ธ n/prefer-promises/fs
-
โ ๏ธ n/no-process-env
-
๐
n/no-sync
By extending @voxpelli/eslint-config/esm
instead of @voxpelli
you will get these differences:
โ ๏ธ func-style
โ enforces function declarations whenever an arrow function isn't used. Better to doexport function foo () {
thanexport const foo = function () {
- ๐
unicorn/prefer-module
โ changed โ restored to itsplugin:unicorn/recommended
value oferror
voxpelli/ghatemplates
โ the templates I use withghat
to update GitHub Actions in my projectsvoxpelli/renovate-config-voxpelli
โ the shareable Renovate setup I use in my projectsvoxpelli/tsconfig
โ the shareabletsconfig.json
setup I use in my projects