- Install the package:
pnpm add -D eslint husky lint-staged prettier @neuledge/eslint-config
- Create a
.eslintrc.json
file with the following content:
{
"extends": "@neuledge"
}
- Create a
.prettierrc.json
file with the following content:
{
"singleQuote": true
}
- Add the following scripts to your
package.json
:
{
"scripts": {
"fix": "pnpm lint:fix",
"lint": "eslint . --ext \"js,ts,mjs,cjs\"",
"lint:fix": "pnpm lint --fix",
"lint:strict": "pnpm lint --max-warnings 0"
}
}
- Add
lint-state
to the end of yourpackage.json
file:
{
"lint-staged": {
"*.{js,ts,mjs,cjs}": "eslint"
}
}
- Install and configure husky:
pnpm husky init
echo 'NODE_OPTIONS="--max_old_space_size=4096" npx --no-save lint-staged' > .husky/pre-commit
pnpm lint
pnpm fix
(Best used in CI)
pnpm lint:strict