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

Enable linting rules for ES6 imports #181

Closed
gaearon opened this issue Jul 25, 2016 · 8 comments
Closed

Enable linting rules for ES6 imports #181

gaearon opened this issue Jul 25, 2016 · 8 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Jul 25, 2016

I wanted to use eslint-plugin-import but I had to disable it because it doesn’t seem to work very well with eslint-loader workflow.

I would very much welcome help in fixing this. I’m not sure if it’s possible, but it would be awesome to display good errors when users import something that doesn’t exist, or confuse named with default imports.

cc @benmosher and @MoOx as maintainers of the corresponding projects

@benmosher
Copy link

Oh man, that sounds really cool. I'm not sure exactly how that would work... some secret collaboration between the import plugin and eslint-loader to notify that dependencies have been changed?

Would want to avoid re-linting dependents unless there are import errors from one of the handful that does deep parsing, or I can imagine eslint-loader doing a lot of extra work.

I'm very interested in this. Will reflect on it. I'm interested to hear from @MoOx as well, I think we might need to cooperate via some secret internal APIs.

@benmosher
Copy link

Actually, isn't this a consequence of the way Webpack works? Loaders are only invoked for files that change, right?

@gaearon
Copy link
Contributor Author

gaearon commented Jul 25, 2016

Yes, but I think loaders can specify dependencies or something like this. To be honest I’m not very familiar with what loaders can do, but since webpack is crazy configurable, I would expect that this is possible in some hacky way. Also maybe it could be possible with a custom webpack plugin.

@benmosher
Copy link

Ah, right... interesting. Yeah, I'm not super-familiar with loaders, either. Good opportunity to get into it 😎

@TheLarkInn
Copy link

@benmosher you do have the ability to access the compiler instance from a loader function (this._compiler). This could allow you to plugin to that compiler.

@TheLarkInn
Copy link

TheLarkInn commented Jul 25, 2016

The Typescript loaders do this to perform type checking and diagnostics when the loaders finish. https://github.com/s-panferov/awesome-typescript-loader/blob/master/src/instance.ts Has a good example of this. @benmosher Hopefully this gives you some good direction.

@MoOx
Copy link
Contributor

MoOx commented Jul 26, 2016

For postcss-import we got a similar issue. I solved this by providing an option to specify dependencies, see https://github.com/postcss/postcss-import#adddependencyto
I don't have much time now so a PR is welcome for eslint-loader.

@gaearon
Copy link
Contributor Author

gaearon commented Mar 7, 2017

Closing in favor of #1559.

@gaearon gaearon closed this as completed Mar 7, 2017
louischan-oursky pushed a commit to louischan-oursky/create-react-app that referenced this issue Jan 25, 2018
Include TypeScript as devDependency in boilerplate output
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants