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

[Fix] order: ignore requires in template literal #1940

Merged
merged 1 commit into from
Nov 11, 2020

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Nov 10, 2020

Fixes #1936.

@ljharb
Copy link
Member

ljharb commented Nov 10, 2020

Thanks! It seems like a more general fix is in order; the only requires that this rule should warn on are module-level requires, whether in a template literal or not.

@coveralls
Copy link

coveralls commented Nov 10, 2020

Coverage Status

Coverage increased (+2.5%) to 97.904% when pulling 957092a on golopot:issue-1936 into 6cd1fe1 on benmosher:master.

@golopot
Copy link
Contributor Author

golopot commented Nov 11, 2020

It sounds great to only warn on module-level requires! There are two cases I am unsure about, they are not strictly module-level requires:

const bar = require('foo').bar
const foo = require('foo')()

I handled both of them anyway, if just for backward compatibility.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@ljharb
Copy link
Member

ljharb commented Nov 11, 2020

Those are module-level requires, even tho they're immediately destructured. Thanks for handling them!

@ljharb ljharb merged commit 957092a into import-js:master Nov 11, 2020
@mAAdhaTTah
Copy link

@golopot Thank you for fixing!

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

Successfully merging this pull request may close these issues.

import/order complains about inline requires
4 participants