From 6cb2af4e6fbca727320efc84fc13100f90e4aaac Mon Sep 17 00:00:00 2001 From: Phillip Barta Date: Wed, 16 Oct 2024 14:29:27 +0200 Subject: [PATCH] fix(rspack): add dependency-checks lint rule (#28225) ## Current Behavior The rspack plugin has no dependency-checks in place. I discovered it while working on #27676. ## Expected Behavior 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) #27676 --------- Co-authored-by: Emily Xiong Co-authored-by: Colum Ferry --- packages/rspack/.eslintrc.json | 24 ++++++++++++++++++++++++ packages/rspack/package.json | 12 +++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/packages/rspack/.eslintrc.json b/packages/rspack/.eslintrc.json index 4cf7f347f6a85..0b0be7016299b 100644 --- a/packages/rspack/.eslintrc.json +++ b/packages/rspack/.eslintrc.json @@ -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" + ] + } + ] + } } ] } diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 48d97a6d6538a..8f1317a713be0 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -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",