@nvon/eslint-config
v2.0.0
Published
These are the NVON coding styles (eslint, prettier).
Downloads
1,923
Readme
NVON coding styles
Consistent prettier/linting/typescript configs with strict defaults.
About the name
The name is pretty misleading, as this does not only contain an eslint-config, but also prettier and typescript configs. This is due to a eslint restriction, which does not allow for more customized names in scoped packages.
Usage
Basically, extend one of the given configs, overwriting the props you want changed.
eslint
The following base configs are available:
- @nvon/eslint-config/eslint-configs/base.cjs
- @nvon/eslint-config/eslint-configs/react.cjs
- @nvon/eslint-config/eslint-configs/gatsby.cjs
- @nvon/eslint-config/eslint-configs/nextjs.cjs
On top of them, you can apply additional rulesets that match your workflow.
🚨 Be sure to always extend the base config last!
- @nvon/eslint-config/eslint-configs/jsdoc.cjs
Stricter rules for comments via plugin:jsdoc. Recommended for package authors.
- @nvon/eslint-config/eslint-configs/i18n.cjs
Strict rules when using i18n.
Using eslint configs in your .eslintrc.js
Note: Since this package is an ESM package, all configs are available as .cjs
files. You need to specify the extension when extending!
module.exports = {
extends: [
"@nvon/eslint-config/eslint-configs/jsdoc.cjs",
"@nvon/eslint-config/eslint-configs/react.cjs", // base config goes last
],
};
Prettier
Currently, there is only a single prettier config:
- @nvon/eslint-config/prettier-configs/base
Using it in your .prettierrc.js
module.exports = {
...require("@nvon/eslint-config/prettier-configs/base.cjs"),
};
TypeScript config
Currently, there is are the following tsconfig files:
- @nvon/eslint-config/ts-configs/base
- @nvon/eslint-config/ts-configs/compile-package-esm
- @nvon/eslint-config/ts-configs/compile-package-cjs
Use it in your tsconfig.json
{
"extends": "@nvon/eslint-config/ts-configs/base.json"
}
Development
To work on the publishing scripts, npm run scripts-compile-watch
can be used. Compiled scripts are accessible in scripts/dist
.
For passing flags to scripts, you need to use a --
between the script and your flags. Otherwise, those flags will be consumed before the script is invoked:
npm run publish-package -- --minor --dry-run
Debugging scripts
For debugging an npm script in vscode, the launch.json
can be adjusted, so that the runtimeArgs
reflect the script you want to debug.
Publishing
- make sure your git repository is clean
- decide on the version change (patch/minor/major)
- run the publish-package command:
npm run publish-package -- --minor