added rule import/no-extraneous-dependencies to docs#2748
Draft
meddy672 wants to merge 4 commits intoairbnb:masterfrom
Draft
added rule import/no-extraneous-dependencies to docs#2748meddy672 wants to merge 4 commits intoairbnb:masterfrom
meddy672 wants to merge 4 commits intoairbnb:masterfrom
Conversation
ljharb
requested changes
May 15, 2023
|
|
||
| ``` | ||
|
|
||
| <a name="modules--import/no-extraneous-dependencies"></a><a name="10.11"></a> |
Collaborator
There was a problem hiding this comment.
new sections don't get numbered links.
Suggested change
| <a name="modules--import/no-extraneous-dependencies"></a><a name="10.11"></a> | |
| <a name="modules--import/no-extraneous-dependencies"></a> |
| <a name="modules--import/no-extraneous-dependencies"></a><a name="10.11"></a> | ||
|
|
||
| - [10.11](#modules--import/no-extraneous-dependencies) Forbid the use of extraneous packages. | ||
| eslint: [`import/no-extraneous-dependencies`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md) |
Collaborator
There was a problem hiding this comment.
Suggested change
| eslint: [`import/no-extraneous-dependencies`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md) | |
| eslint: [`import/no-extraneous-dependencies`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md) |
Comment on lines
+1483
to
+1490
| // Not declared in package.json - es6.js | ||
| import es6 from 'es6'; | ||
| const es6 = require('es6'); | ||
|
|
||
| // good | ||
| // Declared in package.json es6.js | ||
| import es6 from 'es6'; | ||
| const es6 = require('es6'); |
Collaborator
There was a problem hiding this comment.
let's use a package name someone's actually likely to use here.
but also, i'm not sure how helpful this example is since it's not showing package.json. but maybe that'd be overkill?
There was a problem hiding this comment.
I added this lint rule in our project when someone tried to use "axios" without mentioning it in package.json. That can be used as an example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the eslint rule import/no-extraneous-dependencies to the modules section. Fixes #2727