In our project, I would like to disallow to use import {get} from 'lodash';.
The reason behind this is that import {get} from 'lodash' will load all of lodash functions (even if unused).
But when we use import 'lodash/get', only the specific needed functions are required (which minimizes our built files with webpack a lot).
However, after a while, someone will start to use import {get} from 'lodash'.
So I'm searching for a way to disallow that.
A suggestion that I would have is to have a import blacklist, that would be a list of regexes, and we could for example write :
importBlackList: [/^lodash$/]
What do you think ?
Is there another way to achieve this ?
This can be done with the core rule no-restricted-imports: http://eslint.org/docs/rules/no-restricted-imports
[2, { "paths": ["lodash"] }]
what about local import ?
import some form `./thing`;
Most helpful comment
This can be done with the core rule
no-restricted-imports: http://eslint.org/docs/rules/no-restricted-imports[2, { "paths": ["lodash"] }]