build: add missing test dependencies to package workspaces to fix lint warnings#1461
Conversation
danielpeintner
left a comment
There was a problem hiding this comment.
Thank you 👍
There is a CI consistency check that fails, see https://github.com/eclipse-thingweb/node-wot/actions/runs/20891164482/job/60048975528?pr=1461
eslint.config.mjs
Outdated
|
|
||
| // *************** Ensure that only used dependencies are imported *************** | ||
| "extraneous-dependencies/no-extraneous-dependencies": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 | ||
| "extraneous-dependencies/no-extraneous-dependencies": "warn", // https://github.com/eclipse-thingweb/node-wot/issues/1430 |
There was a problem hiding this comment.
| "extraneous-dependencies/no-extraneous-dependencies": "warn", // https://github.com/eclipse-thingweb/node-wot/issues/1430 | |
| "extraneous-dependencies/no-extraneous-dependencies": "warn", |
There was a problem hiding this comment.
Note: I propose to remove the Github link
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1461 +/- ##
==========================================
- Coverage 77.44% 77.42% -0.02%
==========================================
Files 83 83
Lines 15826 15826
Branches 1506 1503 -3
==========================================
- Hits 12256 12253 -3
- Misses 3545 3549 +4
+ Partials 25 24 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| const packageDirs = [__dirname]; | ||
| const packagesRoot = path.join(__dirname, "packages"); | ||
| if (fs.existsSync(packagesRoot)) { | ||
| fs.readdirSync(packagesRoot).forEach((dir) => { | ||
| const pkgPath = path.join(packagesRoot, dir, "package.json"); | ||
| if (fs.existsSync(pkgPath)) { | ||
| packageDirs.push(path.join(packagesRoot, dir)); | ||
| } | ||
| }); | ||
| } | ||
|
|
There was a problem hiding this comment.
Any reasons why we are collecting all the package directories?
There was a problem hiding this comment.
We collect all package directories to make the ESLint configuration monorepo-aware.
Even though we currently use only __dirname to validate dependencies against the root package.json, collecting package directories establishes package boundaries and allows the rule to be easily extended to validate files against their own package’s package.json without changing the discovery logic.
| "extraneous-dependencies/no-extraneous-dependencies": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 | ||
| // Default rule for root files | ||
| "extraneous-dependencies/no-extraneous-dependencies": [ | ||
| "warn", | ||
| { | ||
| packageDir: [__dirname], | ||
| }, | ||
| ], |
There was a problem hiding this comment.
Why we don't simply apply it to all?
There was a problem hiding this comment.
sorry i didn't get the question
Summary
This PR fixes
extraneous-dependencies/no-extraneous-dependencieswarnings while preserving the monorepo’s single-source-of-truth policy for shared dependencies.closes #1442
Test libraries remain declared only in the root
package.json. ESLint is updated to be monorepo-aware so workspace packages can correctly resolve hoisted dependencies.Changes
package.jsonfileseslint.config.mjsto validate dependencies against both root and workspace manifestsResult
npm run lintpassesnpm run check:versionspasses