Skip to content

Commit

Permalink
fix(rspack): add dependency-checks lint rule (#28225)
Browse files Browse the repository at this point in the history
<!-- 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>
  • Loading branch information
3 people authored and jaysoo committed Oct 17, 2024
1 parent f808ea8 commit 6cb2af4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
24 changes: 24 additions & 0 deletions packages/rspack/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@
"rules": {
"@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"
]
}
]
}
}
]
}
12 changes: 9 additions & 3 deletions packages/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@
"dependencies": {
"@nx/js": "file:../js",
"@nx/devkit": "file:../devkit",
"@nx/eslint": "file:../eslint",
"@nx/web": "file:../web",
"@phenomnomnominal/tsquery": "~5.0.1",
"enquirer": "~2.3.6",
"express": "^4.19.2",
"http-proxy-middleware": "^3.0.0",
"less-loader": "11.1.0",
"license-webpack-plugin": "^4.0.2",
"sass-loader": "^12.2.0",
"stylus-loader": "^7.1.0",
"postcss-loader": "^8.1.1",
"@rspack/core": "^1.0.4",
"@rspack/dev-server": "^1.0.4",
"@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": {
"@module-federation/enhanced": "~0.6.0",
Expand Down

0 comments on commit 6cb2af4

Please sign in to comment.