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 #313

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

flat config does not work as documented #313

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

Comments

@danielrentz
Copy link
Contributor

danielrentz commented Mar 18, 2024

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

TypeError: Key "rules": Key "jsonc/comma-dangle": Could not find plugin "jsonc".

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 [
  // ...
  eslintPluginJson.configs["flat/recommended-with-json"][0],

  {
    files: ["**/*.json"],
    rules: {
      ...eslintPluginJson.configs["flat/recommended-with-json"][1].rules,
      // ... extra rules
    },
  }
];

See also ota-meshi/eslint-plugin-yml#310

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