MarsBased / marstyle

MarsBased code linter rules for Ruby and Typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript/import-blacklist

davidgg opened this issue · comments

Rule definition: https://palantir.github.io/tslint/rules/import-blacklist/

It's a good practice to require only submodules that you will use, a clear case is lodash where we usually import the whole module

import _ from 'lodash';

In these cases, you will normally use one or two functions, but you are importing everything. With this rule you disallows the import of certain modules requiring you to import functions like this:

import map from 'lodash/map';

or

import {
    map,
    zipObject
} from 'lodash';

Check lodash/lodash#1457 for related lodash issue.

Interesting and long related reading: https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba

For now only lodash is added.