diff --git a/README.md b/README.md index 660909e9a5..a47e66bf9f 100644 --- a/README.md +++ b/README.md @@ -1468,6 +1468,27 @@ Other Style Guides import foo from './foo'; import bar from './bar'; import baz from './baz'; + + ``` + + + + - [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) + + > Why? You should only allow modules that are declared in the package.json's dependencies, devDependencies, optionalDependencies, peerDependencies, or bundledDependencies to be imported and used within the project. + + ```javascript + // bad + // 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'); + ``` **[⬆ back to top](#table-of-contents)**