Next.js Discord

Discord Forum

ES Lint flat config

Unanswered
Siberian posted this in #help-forum
Open in Discord
SiberianOP
Heyhey

Has anyone here set up a Next project with ES Lint's flat config and has an example of that?

1 Reply

Brown bear
eslint.config.js
import { FlatESLint } from '@eslint/eslintrc';
import eslintNextConfig from 'eslint-config-next';

export default new FlatESLint({
  baseConfig: {
    ...eslintNextConfig,
    parserOptions: {
      ecmaVersion: 2021,
      sourceType: 'module',
    },
    env: {
      browser: true,
      es2021: true,
    },
    extends: [
      'eslint:recommended',
      'plugin:react/recommended',
      'plugin:@typescript-eslint/recommended',
    ],
    plugins: ['react', '@typescript-eslint'],
    rules: {
      'semi': ['error', 'always'],
      'quotes': ['error', 'single'],
      'react/react-in-jsx-scope': 'off',
      '@typescript-eslint/no-unused-vars': ['error'],
      // Add more custom rules as needed
    },
  },
});