1.1.1 • Published 1 year ago
@neuledge/eslint-config-next v1.1.1
ESLint Next.js Config
Initial Setup
- Install the package:
pnpm add -D eslint husky lint-staged prettier @neuledge/eslint-config-next
- Create a
.eslintrc.json
file with the following content:
{
"extends": "@neuledge/next",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"settings": {
"next": {
"rootDir": ["path/to/next/project"]
}
}
}
Make sure you update the path path/to/next/project
to all the root project
directories on Next.js.
- 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,jsx,ts,tsx,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,jsx,ts,tsx,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
Usage
Linting
pnpm lint
Fixing Linting Errors
pnpm fix
Strict Linting
(Best used in CI)
pnpm lint:strict
2.0.0-type-check.0
1 year ago
1.1.1
2 years ago
1.0.2
2 years ago
1.1.0
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
1.0.0-alpha.20
2 years ago
1.0.0-alpha.18
3 years ago
1.0.0-alpha.14
3 years ago
1.0.0-alpha.9
3 years ago
1.0.0-alpha.13
3 years ago
1.0.0-alpha.7
3 years ago
1.0.0-alpha.6
3 years ago
1.0.0-alpha.5
3 years ago
1.0.0-alpha.4
3 years ago