Skip to content

Update configs format for use with defineConfig() #3956

@nzakas

Description

@nzakas

The format for flat configs in eslint-plugin-react is outside the norm for ESLint plugins.

Currently:

const react = require('eslint-plugin-react');

module.exports = [
    react.configs.flat.recommended
];

What I'd like to see:

import react from "eslint-plugin-react";
import { defineConfig } from "eslint";

export default defineConfig({
    files: ["**/*.jsx"],
    plugins: {
        react
    },
    extends: ["react/recommended"]
});

You can support this newer format by renaming flat.recommended to flat/recommended (or by exporting the same config with both names). See the docs here:
https://eslint.org/docs/latest/extend/plugins#backwards-compatibility-for-legacy-configs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions