check-barrel-import-violation
v0.3.0
Published
Ensure that files inside a folder with a barrel are not imported outside this folder
Downloads
385
Maintainers
Readme
check-barrel-import-violation
Ensure that files inside a folder with a barrel are not imported outside this folder.
Installation
npm install --save-dev check-barrel-import-violationThen run it against your project's tsconfig.json:
npx check-barrel-import-violation tsconfig.jsonTo check only specific files instead of the whole project:
npx check-barrel-import-violation tsconfig.json src/foo.ts src/bar.tsxTo check only uncommitted files:
npx check-barrel-import-violation tsconfig.json $(git diff --name-only --diff-filter=d HEAD)You can also add it as a script in your package.json:
{
"scripts": {
"check-barrels": "check-barrel-import-violation tsconfig.json"
}
}Development
git clone https://github.com/tolokoban/check-barrel-import-violation.git
cd check-barrel-import-violation
npm install
npm run buildThe project compiles TypeScript from src/ into dist/ via tsc. After building, you can test locally:
node dist/index.js path/to/tsconfig.json