Skip to content

Commit

Permalink
Update documentation to support bundledDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidsi committed Aug 8, 2019
1 parent 5447f64 commit 486e07a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/rules/no-extraneous-dependencies.md
@@ -1,6 +1,6 @@
# import/no-extraneous-dependencies: Forbid the use of extraneous packages

Forbid the import of external modules that are not declared in the `package.json`'s `dependencies`, `devDependencies`, `optionalDependencies` or `peerDependencies`.
Forbid the import of external modules that are not declared in the `package.json`'s `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies` or `bundledDependencies`.
The closest parent `package.json` will be used. If no `package.json` is found, the rule will not lint anything. This behaviour can be changed with the rule option `packageDir`.

Modules have to be installed for this rule to work.
Expand All @@ -15,6 +15,8 @@ This rule supports the following options:

`peerDependencies`: If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `false`.

`bundledDependencies`: If set to `false`, then the rule will show an error when `bundledDependencies` are imported. Defaults to `true`.

You can set the options like this:

```js
Expand Down Expand Up @@ -70,7 +72,10 @@ Given the following `package.json`:
},
"peerDependencies": {
"react": ">=15.0.0 <16.0.0"
}
},
"bundledDependencies": [
"@generated/foo",
]
}
```

Expand All @@ -90,6 +95,10 @@ var test = require('ava');
/* eslint import/no-extraneous-dependencies: ["error", {"optionalDependencies": false}] */
import isArray from 'lodash.isarray';
var isArray = require('lodash.isarray');

/* eslint import/no-extraneous-dependencies: ["error", {"bundledDependencies": false}] */
import foo from '"@generated/foo"';
var foo = require('"@generated/foo"');
```


Expand All @@ -103,6 +112,7 @@ var foo = require('./foo');
import test from 'ava';
import find from 'lodash.find';
import isArray from 'lodash.isarray';
import foo from '"@generated/foo"';

/* eslint import/no-extraneous-dependencies: ["error", {"peerDependencies": true}] */
import react from 'react';
Expand Down

0 comments on commit 486e07a

Please sign in to comment.