fix(rspack): add dependency-checks lint rule (#28225)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

The rspack plugin has no dependency-checks in place. I discovered it
while working on #27676.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The `@nx/dependency-checks` eslint rule should be used.

There are a few dependencies that I don't know how to proceed with:

```
The "rspack" project uses the following packages, but they are missing from "dependencies":
    - @nx/workspace
    - webpack-sources
    - @module-federation/sdk  @nx/dependency-checks

The "@rspack/plugin-minify" package is not used by "rspack" project
```

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

#27676

---------

Co-authored-by: Emily Xiong <xiongemi@gmail.com>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
This commit is contained in:
Phillip Barta 2024-10-16 14:29:27 +02:00 committed by GitHub
parent bb14914275
commit 4b6c831a48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 3 deletions

View File

@ -20,6 +20,30 @@
"rules": { "rules": {
"@nx/nx-plugin-checks": "error" "@nx/nx-plugin-checks": "error"
} }
},
{
"files": ["./package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"buildTargets": ["build-base"],
"ignoredDependencies": [
"nx",
"typescript",
// Used in require.resolve calls
"postcss-loader",
"@module-federation/node",
// @nx/workspace is only required in < 15.8
"@nx/workspace",
// Imported types only
"@module-federation/sdk",
"@module-federation/enhanced"
]
}
]
}
} }
] ]
} }

View File

@ -26,17 +26,23 @@
"dependencies": { "dependencies": {
"@nx/js": "file:../js", "@nx/js": "file:../js",
"@nx/devkit": "file:../devkit", "@nx/devkit": "file:../devkit",
"@nx/eslint": "file:../eslint", "@nx/web": "file:../web",
"@phenomnomnominal/tsquery": "~5.0.1", "@phenomnomnominal/tsquery": "~5.0.1",
"enquirer": "~2.3.6",
"express": "^4.19.2",
"http-proxy-middleware": "^3.0.0",
"less-loader": "11.1.0", "less-loader": "11.1.0",
"license-webpack-plugin": "^4.0.2", "license-webpack-plugin": "^4.0.2",
"sass-loader": "^12.2.0", "sass-loader": "^12.2.0",
"stylus-loader": "^7.1.0", "stylus-loader": "^7.1.0",
"postcss-loader": "^8.1.1", "postcss-loader": "^8.1.1",
"@rspack/core": "^1.0.4", "@rspack/core": "^1.0.4",
"@rspack/dev-server": "^1.0.4",
"@rspack/plugin-react-refresh": "^1.0.0", "@rspack/plugin-react-refresh": "^1.0.0",
"@rspack/plugin-minify": "^0.7.5", "chalk": "~4.1.0",
"chalk": "~4.1.0" "tsconfig-paths": "^4.1.2",
"tslib": "^2.3.0",
"webpack-sources": "^3.2.3"
}, },
"peerDependencies": { "peerDependencies": {
"@module-federation/enhanced": "~0.6.0", "@module-federation/enhanced": "~0.6.0",