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

Treat paths with node_modules as or next in order to "external" modules #1346

Closed
brettz9 opened this issue Apr 25, 2019 · 4 comments
Closed

Comments

@brettz9
Copy link
Contributor

brettz9 commented Apr 25, 2019

Hi,

I enjoy your plugin and use it in my own config (eslint-config-ash-nazg).

I am wondering whether you might add a condition to the order rule which gave special treatment when a path contained a directory node_modules, treating it with the same or just lower priority as "external" modules stated without a qualified path?

With ESM distributions, one can build applications, albeit for modern browsers only, which directly consume module builds without the need for doing one's own compilation. In these browser applications which avoid the need for bundling, one must write out the node_modules paths, but it would be nice to treat them as being external as far as import ordering.

Thanks again for the helpful plugin!

@ljharb
Copy link
Member

ljharb commented Apr 25, 2019

I don’t personally see any value in supporting use cases that lack a build process, since that’s something i feel is required for modern web dev for the foreseeable future - especially once node unflags its ESM implementation. Additionally, for targeting browsers without a build process you’ll want to keep using bare imports in your code, and use an import map to statically rewrite them to the node_modules path, which would make this request unnecessary.

I think a generic mechanism for defining your own groups, however, would support this use case without enshrining a bad (and already legacy) practice in this plugin. For that, see #674.

@brettz9
Copy link
Contributor Author

brettz9 commented Apr 25, 2019

Wasn't aware of the import map proposal, thanks!

@brettz9 brettz9 closed this as completed Apr 25, 2019
@brettz9
Copy link
Contributor Author

brettz9 commented Apr 25, 2019

But as far as use cases, it is convenient to use on demos on which one doesn't need to wait for build steps to debug some changes. The feedback loop is faster. But again, the import map proposal sounds like it would meet my needs whenever it may become implemented.

@ljharb
Copy link
Member

ljharb commented Apr 25, 2019

It's shipped in Chrome already (possibly behind a flag)

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

No branches or pull requests

2 participants