npm i -D eslint-plugin-restrict-named-import
# or
yarn add -D eslint-plugin-restrict-named-import
- Add settings to
.eslintrc
.
// ...
plugins: [
/** other plugins **/,
"restrict-named-import"
],
rules: {
"restrict-named-import/no-specific-named-import": [2, [["foo", "bar"]]]
},
// ...
- An error occurs in the following.
import { bar } from 'foo';
// ...
- no-specific-named-import: Do not allow specific import.