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

eslint reports errors from files excluded from tsconfig.json - reproducing in 6.2, didn't happen in 5.x #580

Closed
grumd opened this issue Mar 23, 2021 · 7 comments · Fixed by #602

Comments

@grumd
Copy link

grumd commented Mar 23, 2021

Current behavior

In version 6.2.0: ESLint will report errors from files that are excluded in tsconfig.json

Expected behavior

In version 5.2.0: ESLint does NOT report errors from files that are excluded in tsconfig.json

Steps to reproduce the issue

npm run dev, then change fork-ts-checker-webpack-plugin version from 6.2 to 5.2 to see it fixed

Issue reproduction repository

https://github.com/grumd/fork-ts-checker-webpack-plugin-issue

Screenshots:

image
image

There doesn't seem to be an option to exclude files in plugin's eslint configuration, and 5.x versions worked differently from now, seems like a regression bug.

@grumd grumd added the bug label Mar 23, 2021
@grumd
Copy link
Author

grumd commented Mar 23, 2021

In addition, files excluded from tsconfig.json will not trigger a recheck, so you can't get rid of these errors by fixing them either.

@grumd
Copy link
Author

grumd commented Mar 25, 2021

Either eslint configuration should now support stuff like includes/excludes, or it should inherit it from tsconfig

@piotr-oles
Copy link
Collaborator

Hi!
Thanks for reporting this, but I don't agree that it's a bug - there was a major bump in the version and the behavior changed.
eslint doesn't use tsconfig.json settings via CLI so it should not do this in the plugin. You can control the list of files by setting the eslint.files glob. The fact that it used includes/excludes in version 5 was probably a side-effect of a different behavior - it was never intentional.

@grumd
Copy link
Author

grumd commented Mar 25, 2021

@piotr-oles Is it a bug that your plugin does not recheck the files that eslint found errors in?
If I understand it correctly, you just run eslint CLI to find errors using the files glob, then setup some kind of watch over the files compiled by ts, and rerun eslint over files that were edited. However unexpected behaviour happens when eslint finds errors in files that are not watched by your plugin, and those errors cannot be "fixed" without rerunning webpack.

I think the best approach would be to not let users control the files glob of eslint config, but use tsconfig.json, e.g. put excludes into options.ignorePatters for eslint, and includes into files. This would ensure consistent behaviour of this plugin. This is probably a good idea for 7.0 though. However it creates a lot of complications too, because tsconfig can only include an entry point, for example, and will still work. Maybe you could first get the list of files from ts-server, and then feed it into eslint?

@piotr-oles
Copy link
Collaborator

Oh, I missed the part that it's not possible to fix these errors. This is a bug, but the source is different - eslint should add these files to the compilation dependency for webpack to watch them.

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 6.2.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 7.0.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants