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

[Bug]: ESLint lintDirtyModulesOnly not working properly, still lints everything #7748

Closed
markmssd opened this issue Aug 31, 2024 · 2 comments
Assignees
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Milestone

Comments

@markmssd
Copy link

System Info

System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Max
Memory: 631.08 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.14.0/bin/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.14.0/bin/npm
pnpm: 7.28.0 - ~/Library/pnpm/pnpm
bun: 1.1.8 - ~/.bun/bin/bun
Browsers:
Brave Browser: 126.1.67.123
Chrome: 128.0.6613.113
Edge: 128.0.2739.54
Safari: 17.6
npmPackages:
@rspack/cli: 1.0.0 => 1.0.0
@rspack/core: 1.0.0 => 1.0.0

Details

Might be related to #6432

Even if lintDirtyModulesOnly is enabled, it runs ESLint on all files. The expected behaviour (which seems to work well with Webpack) is to run the linter on the modified file only.

It's a negligible difference for a small repo like rspack-repro, but in large repos, it causes HMR to reload in multiple seconds, instead of <1sec.

Currently, modifying a single file will run the linter on all of them:

Screenshot 2024-08-31 at 4 03 33 PM

Expected (when using eslint-webpack-plugin):

Screenshot 2024-08-31 at 4 04 23 PM

Reproduce link

https://github.com/markmssd/rspack-repro/tree/eslint-warnings

Reproduce Steps

git clone https://github.com/markmssd/rspack-repro/tree/eslint-warnings
cd eslint-warnings
npm install
npm run dev:rspack

Now, modify src/index.js. It will run ESLint on all files (src/index.js and src/render.js), even if lintDirtyModulesOnly is enabled in config.mjs.

@markmssd markmssd added bug Something isn't working pending triage The issue/PR is currently untouched. labels Aug 31, 2024
@hardfist hardfist added this to the 1.1.0 milestone Sep 5, 2024
@markmssd
Copy link
Author

I digged more into it, it happens because it now uses the finishModules hook instead of the succeedModule (which is done on purpose for performance reasons it seems?).

The problem when I use succeedModule instead is that the linter always receives the original file content, not the updated one, so even if an issue is fixed, it will still report the issue. Maybe an issue from Rspack?

@LingyuCoder
Copy link
Collaborator

Fixed by @rspack/core@1.0.8 and eslint-rspack-plugin@4.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

3 participants