microsoft / fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
https://react.fluentui.dev
Other
18.57k stars 2.74k forks source link

feat(eslint): introduce `@nrwl/nx/enforce-module-boundaries` to prevent using transitive dependencies #21999

Open Hotell opened 2 years ago

Hotell commented 2 years ago

Describe the issue:

'import/no-extraneous-dependencies' rule is unable to handle following situation (single version policy for devDeps and monorepo packages):

// @filename package.json
{
  "dependencies": {
  },
  "devDependencies": {
     "lib-a": "1.0.0",
     "lib-b": "1.0.0",
  }
}
// @filename packages/react-foo/package.json
{
  "dependencies": {
        "@fluentui/react-one": "1.0.0"
  },
  "devDependencies": {
       "@fluentui/scripts": "1.0.0"
  }
}
// @filename packages/react-foo/src/hello.stories.ts

// 🚨 error, because `react-two` is not defined as dependency - ✋THIS IS INCORRECT ✋
// WHY: 
// - @fluentui/react-two is a monorepo package
// - @fluentui/react-two is used only for non production code (stories/tests/config)
import {Two} from '@fluentui/react-two";
// @filename packages/react-foo/src/implementation.ts

// ✅ no errors, because `react-one` is defined as dependency of this package
import {One} from '@fluentui/react-one"

Solution

After [link], import/no-extraneous-dependencies was turned off for non production files for reasons specified in this issue.

With that we know wont' trigger error if someone imports a transitive dev dependencies in non production code ( this is not the end of the world for sure). We would still like to prevent such a behaviour. thankfully NX eslint plugin comes with such a rule:

{
 "@nrwl/nx/enforce-module-boundaries": ["error", {"banTransitiveDependencies": true}]
}

Note that this rule will check only dependencies within root package.json - single version policy. so to be completely covered - we need to migrate whole monorepo to this approach

Related issues

msft-fluent-ui-bot commented 2 years ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 8 months ago

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 2 months ago

This issue has not had activity for over 180 days! We're adding Soft close label and will close it soon for house-keeping purposes. Still require assistance? Please add comment - "keep open".

Hotell commented 1 month ago

keep open