Skip to content

fix(eslint-plugin): validate workspace dependencies without builds - #37105

Open
Paul Mardling (PaulGMardling) wants to merge 12 commits into
microsoft:masterfrom
PaulGMardling:fix/27727-lint-dependency-resolution
Open

Paul Mardling (PaulGMardling) wants to merge 12 commits into
microsoft:masterfrom
PaulGMardling:fix/27727-lint-dependency-resolution

Conversation

@PaulGMardling

@PaulGMardling Paul Mardling (PaulGMardling) commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Previous Behavior

import/no-extraneous-dependencies can silently miss undeclared workspace imports when their package entry points have not been built. This let the Monaco/charting dependency violation escape PR lint and surface later in release builds.

New Behavior

This follows Dmytro's second suggested route: make dependency checking understand workspace imports and manifest declarations directly. Rather than replace the upstream rule, a custom workspace-aware resolver supplies source package.json paths to the existing import/no-extraneous-dependencies rule. The upstream rule still checks the importing package's declarations and retains its options, exemptions and diagnostics.

The resolver discovers package names from the repository's workspaces patterns, so shared v8/v9 lint catches missing declarations without compiled entry points, workspace links or an Nx graph cache. It is scoped to this dependency rule; external packages and other import rules retain their configured resolution. It does not validate subpath exports or whether imported files exist.

Discovery is cached, with metadata freshness checks on each import-bearing file to detect added, removed or renamed workspaces. Nx changes only track the implementation and manifests as lint cache inputs; they do not introduce Nx dependency validation or build prerequisites.

Reproduced the original Monaco/charting failure with both charting entry points absent: upstream reported nothing, while the adapted rule reported the missing dependency. Only private tooling changed; no component builds or visual tests were run locally.

Validation: 528 tests and 226 snapshots passed; lint and type checks passed

Node 22; NX_DAEMON=false NX_NO_CLOUD=true.

  • node .yarn/releases/yarn-4.18.0.cjs nx run-many -t test -p eslint-plugin,workspace-plugin --runInBand --skip-nx-cache --parallel=1: passed on the current revision, 83 plugin tests and 445 workspace-plugin tests; 226 snapshots.
  • node .yarn/releases/yarn-4.18.0.cjs nx run eslint-plugin:lint --skip-nx-cache --command='yarn run -T eslint src && yarn run -T tsc --allowJs --checkJs --noEmit --strict --skipLibCheck --module NodeNext --moduleResolution NodeNext --types node src/utils/importPlugin.js src/utils/workspaceResolver.js': passed after the cleanup; existing lint warnings only.
  • node .yarn/releases/yarn-4.18.0.cjs nx run-many -t lint -p eslint-plugin,workspace-plugin,scripts-babel,scripts-jest,verify-bundle-isolation,react-monaco-editor,react-text --skip-nx-cache --parallel=3: passed before the final cleanup; existing warnings only.
  • node .yarn/releases/yarn-4.18.0.cjs nx run workspace-plugin:type-check --skip-nx-cache: passed; workspace-plugin code was unchanged by the final cleanup.

Related Issue(s)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 11:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Adds an opt-in Nx target for react-text to lint package.json dependencies using Nx’s project graph/file map so missing workspace deps are detected without requiring builds.

Changes:

  • Add react-text:lint-dependencies Nx target that runs ESLint against the package manifest.
  • Introduce a dedicated flat ESLint config that runs @nx/dependency-checks and hard-fails when graph/file-map cache is missing.
  • Add a Jest regression suite (21 cases) and document limitations/usage in the package README.
File Description
packages/​react-components/​react-text/​library/​project.json Adds the opt-in lint-dependencies target and cache/inputs configuration.
packages/​react-components/​react-text/​library/​config/​eslint.config.cjs Adds a flat ESLint config for manifest dependency checks with explicit graph/file-map guards.
packages/​react-components/​react-text/​library/​config/​dependency-lint.test.js Adds regression tests validating behavior, edge cases, and missing-graph failure modes.
packages/​react-components/​react-text/​library/​README.md Documents how to run the pilot and known limitations vs existing linting.
change/​@fluentui-react-text-932fc45f-fc19-4898-ad7d-4debde6037e0.json Adds a Beachball none change entry for the tooling-only pilot.

Review effort: Lite

@github-actions

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

@github-actions

Copy link
Copy Markdown

🕵 . No visual changes in this PR

@PaulGMardling
Paul Mardling (PaulGMardling) marked this pull request as ready for review November 10, 2026 15:48
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@dmytrokirpa Dmytro Kirpa (dmytrokirpa) left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this PR solves the original problem mentioned in the linked issue. The correct direction is either:

  • Integrate Nx dependency validation into the shared lint configuration and roll it out systematically, or
  • Implement or configure a custom rule that directly understands workspace package imports and manifest declarations.

Replace the react-text manifest pilot with workspace-aware resolution in the shared dependency rule, preserving existing options and exemptions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@PaulGMardling Paul Mardling (PaulGMardling) changed the title chore(react-text): pilot build-independent dependency linting fix(eslint-plugin): validate workspace dependencies without builds Nov 23, 2026
…ests

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: import/no-extraneous-dependencies lint rule doesn't work without building monorepo packages first

3 participants