Opinionated personal ESLint config for React & Next.js developers.
- Compose with your config easily with the help of ESLint flat config.
- React, Next.js and UnoCSS support out-of-box.
- Format your source code comfortably using ESLint Stylistic and eslint-plugin-format.
- Best practices included, simple usage for everyone.
pnpm install -D eslint @hellolin/eslint-config
Then create a eslint.config.js
in your project root:
import defineConfig from '@hellolin/eslint-config';
export default defineConfig();
Then you can lint files:
pnpm exec eslint .
Optionally add it to your package.json
:
{
// ...
"scripts": {
"lint": "eslint --fix ."
}
// ...
}
Pass your options like that:
import defineConfig from '@hellolin/eslint-config';
export default defineConfig({
typescript: {
// Strict checking (enabled by default)
strict: true,
// Enable rules related to any type
enableAnyRelatedRules: true,
},
// Enable React support
react: true,
// Enable Next.js support
next: true,
// Enable UnoCSS support
unocss: {
// Attributify mode (enabled by default)
attributify: true,
},
});
You can also pass ESLint flat config items after the first parameter of defineConfig
:
import defineConfig from '@hellolin/eslint-config';
export default defineConfig(
{
react: true,
next: true,
},
{
files: ['**/*.?([cm])[jt]s?(x)'],
rules: {
'react/no-class-component': 'off',
'react/no-complex-conditional-rendering': 'off',
},
},
);
For advanced config, view types.ts.
To integrate with VSCode, install ESLint extension, then add the following settings to .vscode/settings.json
:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"markdown",
"json",
"jsonc",
"gql",
"graphql",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
This project is inspired by @antfu/eslint-config.
Release under the MIT License.
Copyright © 2025 hellolin. All rights reserved.