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

flat config does not work as documented #310

Closed
danielrentz opened this issue Mar 18, 2024 · 0 comments · Fixed by #311
Closed

flat config does not work as documented #310

danielrentz opened this issue Mar 18, 2024 · 0 comments · Fixed by #311

Comments

@danielrentz
Copy link
Contributor

When using config "flat/recommended" (eslint.config.js) in an environment linting *.js and *.yaml together, the plugin fails:

TypeError: Key "rules": Key "yml/no-empty-document": Could not find plugin "yml".

Root cause seems that the config contains two objects. The first one correctly configures the plugin. However, the second object contains the recommended rules without a "files" property, thus ESLint tries to apply these rules on all JS files.

My current workaround is:

return [
  // ...
  eslintPluginYml.configs["flat/recommended"][0],

  {
    files: ["**/*.yaml", "**/*.yml"],
    rules: {
      ...eslintPluginYml.configs["flat/recommended"][1].rules,
      // ... extra rules
    },
  }
];

See also ota-meshi/eslint-plugin-jsonc#313

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.

1 participant