question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[import/no-extraneous-dependencies]: better support for monorepos

See original GitHub issue

This is a feature request

Its possible that this is just an issue in documentation as i didn’t dig to source code yet

packageDir option should take into account yarn workspaces or lerna projects if present to ease usage of for large monorepo projects

this can be also achieved by allowing us to use regexp / glob to find roots

Context

i recently noticed that in some of projects that I’m using, has this rule configured incorrectly, user has to provide paths to all package.json configs even if he is working on monorepos

example of projects that can benefit from this change (big one that i worked on):

Note that all of those projects currently have invalid configuration for this rule, unless i misread documentation and package.json files are resolved relatively to parsed file


related comments/issues:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
armano2commented, Jan 26, 2021

yes it’s look like issue with monorepos has been solved.

from my tests this is working fine now on win/linux/mac machines,

https://github.com/conventional-changelog/commitlint/blob/75b67b8fb7fc4df21267b98f0c9daeeb1130b824/.eslintrc.js#L31-L36

	// Forbid the use of extraneous packages
	'import/no-extraneous-dependencies': [
		'error',
		{
			devDependencies: ['**/*.test.js', '**/*.test.ts'],
		},
	],
1reaction
ljharbcommented, Feb 8, 2020

A PR with failing test cases would be appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Monorepos and no-extraneous-dependencies · Issue #1174 ...
Merge all the discovered deps, devDeps, peerDeps and optDeps; Check imports against this. This matches node's module resolution algorithm, which ...
Read more >
Eslint no-extraneous-dependencies error with npm workspaces
Is there a way to configure eslint to have it understand monorepos so that it does not give me a warning when I...
Read more >
node_modules/eslint-plugin-import/docs/rules/no-extraneous ...
This rule supports the following options: devDependencies : If set to false , then the rule will show an error when devDependencies are...
Read more >
Painless Monorepo Dependency Management with Bit - Bit.dev
I have personally added support for it to pnpm around the same time Yarn has. ... You may use the import/no-extraneous-dependencies rule of...
Read more >
Legacy: Hoisting | Lerna
When an overall project is divided into more than one NPM package, ... which has a rule no-extraneous-dependencies that can warn when an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found