My personal ESLint config β a superset of the neostandard base config that I co-created and co-maintain.
This config contains a couple of more opinionated checks that I find helpful in my projects.
To easily install correct peer dependencies, you can use install-peerdeps
:
install-peerdeps --dev @voxpelli/eslint-config
Add an eslint.config.js
(or eslint.config.mjs
if your project is CJS) that exports this config:
export { default } from '@voxpelli/eslint-config';
If you need to configure something, instead do:
import { voxpelli } from '@voxpelli/eslint-config';
export default voxpelli({
cjs: true, // Ensures the config has rules fit for a CJS context rather than an ESM context
noMocha: true, // By standard this config expects tests to be of the Mocha kind, but one can opt out
});
You can also do custom extensions:
import { voxpelli } from '@voxpelli/eslint-config';
export default [
...voxpelli({
// Config options
}),
{
// Custom ESLint config
},
];
How does this differ from pure neostandard?
- π = changed to
error
level β οΈ = changed towarn
level- π = deactivated
- π§ = changed config
π§ Changed neostandard rules
- π§
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
β οΈ 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
plugin:jsdoc/recommended
plugin:mocha/recommended
plugin:n/recommended
plugin:promise/recommended
plugin:security/recommended
plugin:unicorn/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 combined with type checking 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
-
π
@stylistic/quote-props
β requires properties to be quoted when needed but otherwise disallows it -
β οΈ 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*
-
β οΈ n/prefer-global/console
-
β οΈ n/prefer-promises/fs
-
β οΈ n/no-process-env
-
π
n/no-sync
-
π
unicorn/consistent-destructuring
β while unicorn dropped it from their recommended config I still like it, see #283
Unless one configures cjs: true
these additional rules will be applied:
β οΈ 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
You may want to use neostandard instead, it's the general base config that I help maintain for the community.
I do maintain this project though as if multiple people are using it, so sure, you can use it, but its ultimate purpose is to support my projects.
I do follow semantic versioning, so the addition or tightening of any checks will trigger major releases whereas minor and patch releases should only ever have relaxation of rules and bug fixes.
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