enforce-module-boundaries eslint rule takes ~3min on one file
See original GitHub issueCurrent Behavior
Linting one small file of a large project (1000+ files) with the enforce-module-boundaries
eslint rule on takes about ~3min. Linting that same file with this rule off it takes, <1s.
Expected Behavior
For the plugin to take slightly longer, not magnitudes longer.
Steps to Reproduce
I don’t have a small repo where this occurs, because it seems to happen at scale.
The time sink happens on this recursive call: https://github.com/nrwl/nx/blob/master/packages/workspace/src/utils/runtime-lint-utils.ts#L170
Eslint config looks like:
{
plugins: [
'@nrwl/eslint-plugin-nx'
],
rules: {
'@nrwl/nx/enforce-module-boundaries': [
'error',
{
"depConstraints": [
{
"sourceTag": "scope:client",
"onlyDependOnLibsWithTags": ["scope:libs"]
}
]
}
]
}
}
nx.json
looks like:
"my-app": {
"tags": ["scope:client"]
},
"my-lib" : { "tags": ["scope:libs"] }
This issue may not be prioritized if details are not provided to help us reproduce the issue.
Failure Logs
Running like: time nx lint my-app
Getting:
my-app/index.js
2:1 error Circular dependency between "my-app" and "another-app" detected @nrwl/nx/enforce-module-boundaries
3:1 error Circular dependency between "my-app" and "my-app" detected @nrwl/nx/enforce-module-boundaries
✖ 2 problems (2 errors, 0 warnings)
Lint errors found in the listed files.
nx lint my-app 192.34s user 10.69s system 112% cpu 3:00.16 total
Environment
> NX Report complete - copy this into the issue template
@nrwl/angular : Not Found
@nrwl/cli : 9.4.0-rc.8
@nrwl/cypress : 9.4.0-rc.8
@nrwl/eslint-plugin-nx : 9.4.0-rc.8
@nrwl/express : 9.4.0-rc.8
@nrwl/jest : 9.4.0-rc.8
@nrwl/linter : 9.4.0-rc.8
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 9.4.0-rc.8
@nrwl/react : 9.4.0-rc.8
@nrwl/schematics : Not Found
@nrwl/tao : 9.4.0-rc.8
@nrwl/web : 9.4.0-rc.8
@nrwl/workspace : 9.4.0-rc.8
typescript : 3.8.3
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Working with Rules - ESLint - Pluggable JavaScript Linter
Each rule in ESLint has three files named with its identifier (for example, no-extra-semi ). in the lib/rules directory: a source file (for...
Read more >Taming Code Organization with Module Boundaries in Nx
Nx ships with enforce-module-boundaries ESLint rule that helps restrict that possibility.
Read more >How to deal with the TSLint error "A project without tags ...
By default, the nx-enforce-module-boundaries TSLint rule in nx.json comes with the following boundaries: "nx-enforce-module-boundaries": ...
Read more >eslint rule @nrwl/nx/enforce-module-boundaries fails [UPDATE]
To get this working: On your base tsconfig.base.json or your local tsconfig.json . I suggest to do it on the tsconfig.base.json.
Read more >Enforcing Consistent Code in Expo React Native Projects
Improve your team's code quality and efficiency by using ESLint, Prettier, Husky, and lint-staged to automate formatting and consistency ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hm you must have a very deep dependency chain. We should probably memoize that function though.
Would you like to contribute a PR? Someone from the community is also welcome to try.
Do you happen to have a repo exhibiting the issue to verify if a fix really speeds things up?
Try with the latest version or at least some v13 and let me know if it still happens.