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