Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 820 Bytes

no-full-import.md

File metadata and controls

37 lines (25 loc) · 820 Bytes

Enforce that some libraries are not fully imported

When building web apps, you want to keep the bundles as small as possible. This rule can help prevent fully importing huge libraries. The plugin is flexible and doesn't impose any list of libraries.

Rule Details

Assuming that you select these libraries: ["lodash", "aws-sdk"], the following patterns are considered invalid:

🚫 import _ from 'lodash';
🚫 import 'lodash';
🚫 import { default as something } from 'aws-sdk';
🚫 import { s3 } from 'aws-sdk';

The following patterns are considered valid:

 import find from 'lodash/debounce';
 import find from 'aws-sdk/clients/s3';

When Not To Use It

If you do not care that an entire libary is being included into your bundle.