eslint-webpack-plugin icon indicating copy to clipboard operation
eslint-webpack-plugin copied to clipboard

ESLint's lintFiles function expects to receive files in dependency order, ESLintWebpackPlugin does not guarantee this

Open kowsen opened this issue 3 years ago • 1 comments

Modification Proposal

I've been debugging an issue where even with caching disabled, the previous state of my files can sometimes mess with my linter results. I filed an issue on typescript-eslint and they told me that the eslint.lintFiles function expects to receive files in dependency order, but from playing around with ESLintWebpackPlugin, it looks like there's no guarantee that's the order it passes files into the linter.

I tried digging a little further, and can't find any docs anywhere for whether there's a specific order that modules will come through succeedModule in or a good way to use the dependency tree in finishModules to sort the rebuilt modules. Is there a way we can sort the files to be linted in the expected order or some other workaround I can use to avoid these false errors?

Expected Behavior / Situation

The array of files passed into eslint.lintFiles should be given in dependency order.

Actual Behavior / Situation

The array of files passed into eslint.lintFiles does not appear to be ordered in a useful way.

Please paste the results of npx webpack-cli info here, and mention other relevant information

I see this same issue with ESLint's caching either enabled or disabled.

System: OS: Linux 5.4 Ubuntu 18.04.5 LTS (Bionic Beaver) CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz Memory: 4.36 GB / 31.14 GB Binaries: Node: 14.18.3 - /opt/qumulo/env/202203241517/bin/node npm: 6.14.15 - /opt/qumulo/env/202203241517/bin/npm Browsers: Firefox: 98.0.2

kowsen avatar Mar 28 '22 17:03 kowsen

Hi, it's not the case that lintFiles has that expectation, but rather that typescript-eslint's parser does not support all use cases, as explained in this comment.

This issue would need a reproduction specifically using this plugin, to show which use case is falling outside of what their parser supports.

facugaich avatar Feb 03 '23 16:02 facugaich