Forbid importing from barrel index.ts files.
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-no-penetrating-import
:
npm install eslint-plugin-no-penetrating-import --save-dev
Add no-penetrating-import
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"no-penetrating-import"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"<import-name>/no-penetrating-import": 2
}
}