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

Change default values of unusedExports and/or missingExports with import/no-unused-modules #1324

Open
ehmicky opened this issue Apr 14, 2019 · 6 comments

Comments

@ehmicky
Copy link

ehmicky commented Apr 14, 2019

Would it make sense to change the default value of unusedExports and/or missingExports? At the moment, they both default to false. Unless I am mistaken, this means that the rule is a noop by default. This confused me at first and I thought the rule was not working. I am wondering if other users might have the same reaction. Would defaulting one of them or both of them to true be a good idea?

(Unrelated note: The no-unused-modules is great, thanks for this! This rule can replace whole libraries dedicated to finding dead code in JavaScript. Being built on top of ESLint, it also benefits from things like IDE integrations. In short, this is great!)

@ehmicky ehmicky changed the title [ENHANCEMENT] Change default values of unusedExports and/or missingExports with import/no-unused-modules Change default values of unusedExports and/or missingExports with import/no-unused-modules Apr 14, 2019
@ljharb
Copy link
Member

ljharb commented Apr 14, 2019

At this point that’d be a breaking change - but also i don’t think it’d make sense to default only one of them to true - it’d have to default both or neither to the same value.

@ehmicky
Copy link
Author

ehmicky commented Apr 14, 2019

This would need to be delayed until next major version indeed. Both true actually is what makes more sense to me as well.

@klippx
Copy link

klippx commented Apr 4, 2023

Would defaulting one of them or both of them to true be a good idea?

Defaulting unusedExports to true is no good for VSCode users, as unusedExports does not work as you'd expect.

@ljharb
Copy link
Member

ljharb commented Apr 4, 2023

@klippx can you elaborate on what you mean by "this"?

@silverwind
Copy link
Contributor

silverwind commented Apr 24, 2023

unusedExports: true works fine in my book. The only case where a exception is needed is for *.config.js files where the exports are not used in any 1st party code and the use in 3rd party code is likely a dynamic import that is not statically analyzable like this one.

@saiichihashimoto
Copy link

Is there any reason this isn’t two different rules? They share a setting but otherwise they seem to do two different things.

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

No branches or pull requests

5 participants