Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid flat config #378

Closed
swachter opened this issue Feb 23, 2024 · 2 comments · Fixed by #407
Closed

Invalid flat config #378

swachter opened this issue Feb 23, 2024 · 2 comments · Fixed by #407

Comments

@swachter
Copy link

Configuring the plugin by

// eslint.config.js
import vitest from 'eslint-plugin-vitest';

export default [
  vitest.configs.recommended
];

results in the following error:

ESLint: 8.56.0


A config object has a "plugins" key defined as an array of strings.

Flat config requires "plugins" to be an object in this form:

    {
        plugins: {
            vitest: pluginObject
        }
    }

I think the issue is caused by the createConfig function. A possible workaround it to tweak the returned config object in the following way:

export default [
  { ...vitest.configs.recommended, plugins: { vitest } }
];
@tobiasdiez
Copy link

Yes, the plugin needs some changes to work with flat configs, see https://eslint.org/docs/latest/extend/plugin-migration-flat-config#migrating-configs-for-flat-config.

@Stanzilla
Copy link

rules: {
      ...vitest.configs.recommended.rules,
    },

this part errors on 0.4.2-beta.1, Configuration for rule "plugins" is invalid. Expected severity of "off", 0, "warn", 1, "error", or 2.

You passed '"vitest"'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants