Skip to content
New issue

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

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

Already on GitHub? # to your account

Export flat config plugin for standalone use #215

Open
Zamiell opened this issue May 1, 2024 · 2 comments
Open

Export flat config plugin for standalone use #215

Zamiell opened this issue May 1, 2024 · 2 comments

Comments

@Zamiell
Copy link

Zamiell commented May 1, 2024

The getting started page shows how to import the recommended config into a flat config. But I don't want to use the recommended config. I just want to import the plugin and then choose for myself what rules to turn on. The documentation does not cover this. Is this possible?

I did some digging and it looks like the index.js file does not even export the plugin (??), so I am very confused.

@voxpelli
Copy link
Member

Agree. The plugin itself should also be exported, which it isn't today: https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/configs.js

@voxpelli voxpelli changed the title unclear how to use the plugin with flat config Export flat config plugin for standalone use May 30, 2024
@Zamiell
Copy link
Author

Zamiell commented May 30, 2024

For now, VoxPelli helped me work around the issue with this code:

// @ts-expect-error https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/214
import ESLintPluginESLintCommentsConfigs from "@eslint-community/eslint-plugin-eslint-comments/configs";
import tseslint from "typescript-eslint";

// The plugin is not currently exported from the root, so we have to get the plugin from the config.
// https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/215
const ESLintPluginESLintComments =
  ESLintPluginESLintCommentsConfigs.recommended.plugins[
    "@eslint-community/eslint-comments"
  ];

export const configFoo = tseslint.config({
  plugins: {
    "@eslint-community/eslint-comments": ESLintPluginESLintComments,
  },
});

But this is really confusing and weird so hopefully it is exported from the root in the next version of the plugin.

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

No branches or pull requests

2 participants