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

Add enable option #8

Closed
binarykitchen opened this issue Sep 14, 2024 · 6 comments · Fixed by #10
Closed

Add enable option #8

binarykitchen opened this issue Sep 14, 2024 · 6 comments · Fixed by #10

Comments

@binarykitchen
Copy link

That's the code I have now, and don't like it:

      plugins: [
        pluginStylus(),
        ...
        isProd() ? pluginGoogleAnalytics({ id: getGoogleTagID() }) : undefined, // <------------- This yuck
      ],

Creates an empty element in the plugin array. Could you add a new option enabled, similar like your other eslint plugin?

pluginEslint({
  enable: process.env.NODE_ENV === "production",
});

That would solve it elegantly. Thanks.

@chenjiahan
Copy link
Member

How about using &&?

      plugins: [
        isProd() && pluginGoogleAnalytics({ id: getGoogleTagID() }),
      ],

@binarykitchen
Copy link
Author

Well, that's not better either, it produces [false] when not in production mode.

@chenjiahan
Copy link
Member

The plugins array can accept false

@chenjiahan
Copy link
Member

I'm open to adding an enable option and welcome PR

@binarykitchen
Copy link
Author

I think it's important to keep all your plugins consistent. So that they all have the same pattern. Enable/Disable, depending on the environment.

(I'm a family father and for doing a PR, I'd have to examine code for which I do not have the time right now)

@binarykitchen
Copy link
Author

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants