You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enforce-module-boundaries rule reads nx cache before linting each file causing a significant performance degradation
It's caused by this change: aefe782
Expected Behavior
In some cases we are calling eslint directly, not via nx for better performance (e.g. git pre-commit hook) passing only changed files. nx cache should be loaded once during such execution (as it was in previous versions).
Maybe we can introduce some flag to distinguish IDE server from the manual run (just an idea, not sure about the proper fix) ?
Steps to Reproduce
node_modules/eslint/bin/eslint "{apps,libs}/**/*.{ts,html}" --quiet (it will take 2 hours for medium size project instead of 3 minutes before the change)
Reproducible in nx-examples repository, yet the difference is not that huge (1-2 seconds) because the number of files is relatively low. I was modifying node_modules/@nrwl/eslint-plugin-nx/src/rules/enforce-module-boundaries.js directly to compare the performance, so it's hard to create a PR, but the change was quite obvious:
We do not suggest using eslint manually from the terminal. If you run it only against changed files, changing the tag in one project would not affect the parent projects (while in reality it often would).
Adding the explicit check to distinguish if the command is run via terminal or using eslint was to make sure the project graph used for the linter was always up to date (otherwise it would be read initially and used stale throughout the IDE session).
I will check if there is a way we can distinguish EslintServer runs from manual runs and use that as a denominator.
Current Behavior
enforce-module-boundaries
rule reads nx cache before linting each file causing a significant performance degradationIt's caused by this change: aefe782
Expected Behavior
In some cases we are calling
eslint
directly, not vianx
for better performance (e.g.git pre-commit hook
) passing only changed files.nx cache
should be loaded once during such execution (as it was in previous versions).Maybe we can introduce some flag to distinguish IDE server from the manual run (just an idea, not sure about the proper fix) ?
Steps to Reproduce
node_modules/eslint/bin/eslint "{apps,libs}/**/*.{ts,html}" --quiet
(it will take 2 hours for medium size project instead of 3 minutes before the change)Reproducible in
nx-examples
repository, yet the difference is not that huge (1-2 seconds) because the number of files is relatively low. I was modifyingnode_modules/@nrwl/eslint-plugin-nx/src/rules/enforce-module-boundaries.js
directly to compare the performance, so it's hard to create a PR, but the change was quite obvious:Failure Logs
No failure log, only performance issue.
Environment
The text was updated successfully, but these errors were encountered: