Skip to content

Hellolin's eslint config for React & Next.js developers.

License

Notifications You must be signed in to change notification settings

VLTHellolin/eslint-config

Repository files navigation

@hellolin/eslint-config

NPM Version

Opinionated personal ESLint config for React & Next.js developers.

Usage

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 ."
  }
  // ...
}

Customization

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.

Editor support

VSCode

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"
  ]
}

Acknowledgements

This project is inspired by @antfu/eslint-config.

License

Release under the MIT License.

Copyright © 2025 hellolin. All rights reserved.

About

Hellolin's eslint config for React & Next.js developers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published