microsoft / microsoft/fluentui

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

Open
#27,727 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Build System Area: Linting Fluent UI react (v8) Fluent UI react-components (v9) Package: eslint-plugin Resolution: Soft Close Status: In PR
Dominant language
TypeScript
Stars
20.3k
Forks
2.9k
Avg merge
2d 9h
Merged PRs (30d)
46

Description

Library

All

System Info
na
Are you reporting Accessibility issue?

None

Bug Description

Recently v8 release builds started to fail https://uifabric.visualstudio.com/UI%20Fabric/_build/results?buildId=300471&view=logs&j=8d802004-fbbb-5f17-b73e-f23de0c1dec8&t=fb65810a-a7a9-58a0-61f9-7163cb0bcc0b.

image

As you can see from the pipeline logs it is caused by import/no-extraneous-dependencies violation within react-monaco-editor package introduced by following PR https://github.com/microsoft/fluentui/pull/27539/files#diff-fe9af457a08692110b7ef7ab9ed97bd53b2496e4f2573f644dd1ec8fb921c6baR23.

Although on that PR there were no issues reported.

After deeper investigation the culprit is how import/no-extraneous-dependencies rule works. It needs packages to be build first as it traverses physically file system to obtain "real" package references. This goes against our DX and perf approach to linting which needs to work without any build first requirements.

Reported https://github.com/import-js/eslint-plugin-import/issues/2772

Until we will get some feedback from plugin authors we are left with following options:

  1. leave things as is. release pipelines will fail and report violations that need to be fixed by us
  2. add back build pre-requirement to be able to run lint ( will slow down PR pipeline )
  3. run lint on PR in separate step after build/test/type-check ( will slow down PR pipeline )

Actual Behavior

import/no-extraneous-dependencies needs package assets be physically present on filesystem ( build first , then lint )

Expected Behavior

import/no-extraneous-dependencies should not rely on physical filesystem

Logs

No response

Requested priority

Blocking

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the v8 release pipeline logs and the react-monaco-editor package, then inspect where import/no-extraneous-dependencies is configured and how lint runs relative to package builds. Review the linked eslint-plugin-import issue before choosing an approach; done means lint no longer requires built package assets or release pipelines no longer report this violation.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, react, typescript
Domain
build-system, ci-cd, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.