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

Undocumented option "commonjs" for import/no-useless-path-segments #1459

Closed
simlu opened this issue Aug 22, 2019 · 3 comments · Fixed by #1507
Closed

Undocumented option "commonjs" for import/no-useless-path-segments #1459

simlu opened this issue Aug 22, 2019 · 3 comments · Fixed by #1507

Comments

@simlu
Copy link

simlu commented Aug 22, 2019

By default import/no-useless-path-segments only checks require when the rule option commonjs is set to true.

Unfortunately this is not documented. Not sure where the best place for that to happen would be, so opening an issue.

Also, why is require not checked by default? It is somewhat cumbersome that one has to manually enable this setting.

@ljharb
Copy link
Member

ljharb commented Aug 22, 2019

It's not checked by default because that'd be a breaking change.

Documenting it is a great idea.

@simlu
Copy link
Author

simlu commented Aug 22, 2019

@ljharb Haha, asking the question "Why is the cat burning?" I wasn't really looking for the answer "Well it's too late now", more for something like "It got to close to the oven" :)

There must be a reason why someone decided they didn't want it enabled by default (or at least I'd hope so). Just curious what that reason was/is

Also; Breaking change should always be possible with major version bump (if it's the right thing to do)

@ljharb
Copy link
Member

ljharb commented Aug 22, 2019

The reason is that that option didn't exist when the rule was created, and thus adding it later meant it couldn't be defaulted to "on" without being a breaking change.

It's certainly possible, but it's best to avoid breaking changes at all costs until they're absolutely necessary.

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

Successfully merging a pull request may close this issue.

2 participants