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-configAdd 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
errorlevel β οΈ = changed towarnlevel- π = deactivated
- π§ = changed config
π§ Changed neostandard rules
- π§
@stylistic/comma-dangleβ changed β set to enforce dangling commas in arrays, objects, imports and exports - π§
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.logand 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 orNaNresults β οΈ no-warning-commentsβ warns of the existence ofFIXMEcomments, as they should always be fixed before pushing- π
object-shorthandβ requires the use of object shorthands for properties, more tidy
plugin:jsdoc/recommendedplugin:mocha/recommendedplugin:n/recommendedplugin:promise/recommendedplugin:security/recommendedplugin: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 prefererrovererroras I finderrorto be a far too similar name to the built inErrorclass -
π
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 towarninstead oferror -
β οΈ unicorn/prefer-event-targetβ changed β set towarninstead oferror -
π
unicorn/prefer-moduleβ deactivated β only useful when you know you're targetting ESM -
β οΈ unicorn/prefer-spreadβ changed β set towarninstead oferror -
β οΈ unicorn/prefer-string-replace-allβ changed β set towarninstead oferror -
π
unicorn/prevent-abbreviationsβ deactivated β same asunicorn/catch-error-name, I prefer an abbreviatederrover a non-abbreviatederrorbecause the latter is too similar toErrorfor my taste -
π§
unicorn/switch-case-bracesβ changed β I prefer to avoid braces incasestatements 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/recommendedvalue 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 withghatto update GitHub Actions in my projectsvoxpelli/renovate-config-voxpelliβ the shareable renovate setup I use in my projectsvoxpelli/tsconfigβ the shareabletsconfig.jsonsetup I use in my projects