Skip to content

Commit 25a0d61

Browse files
Explain the transitive dependency case
no-extraneous-require will fail when a require is requiring a consistently available package that is not explicitly listed as a direct dependency. This doc change explains why.
1 parent 85b7945 commit 25a0d61

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/rules/no-extraneous-require.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
<!-- end auto-generated rule header -->
66

7-
If a `require()`'s target is extraneous (it's not written in `package.json`), the program works in local, but will not work after dependencies are re-installed. It will cause troubles to your team/contributors.
7+
If a `require()`'s target is extraneous (it's not written in `package.json`), the program works in local, but may not work after dependencies are re-installed. It will cause troubles to your team/contributors. If a target is extraneous yet consistently works for you and your team, it may be a transitive dependency (a dependency of a dependency). Transitive dependencies should still be saved as an explicit dependency in `package.json` to avoid the risk of a dependency changing and removing the dependency of a dependency this `require()` is relying on.
8+
89
This rule disallows `require()` of extraneous modules.
910

1011
## 📖 Rule Details

0 commit comments

Comments
 (0)