ESLint plugin to detect barrel files (re-export aggregators) and imports from them, preventing unnecessary module loading in non-bundler environments. Current stable version 3.0.1. Release cadence is irregular; last major v3 dropped support for older ESLint versions. Differentiator: specifically targets barrel file patterns that cause performance issues in test runners, browsers, CDNs, and server-side runtimes where tree-shaking is absent. Alternatives like eslint-plugin-import have broader scope but don't focus on barrel files specifically.
npm install eslint-plugin-barrel-filesVerified import paths — ran on the pinned version, not inferred.
Shows how to configure eslint-plugin-barrel-files in ESLint flat config (recommended) and legacy .eslintrc format.
Update to ESLint flat config (eslint.config.js) or continue using v2.x for .eslintrc support.
Use 'barrel-files/avoid-re-export-all' instead.
In eslint.config.js, add 'files: ["**/*.js"]' to the config object that applies the barrel-files rules.
Add 'ignorePatterns: ["node_modules"]' in your config.
Run 'npm install eslint-plugin-barrel-files --save-dev' and ensure you import it at the top of eslint.config.js: import plugin from 'eslint-plugin-barrel-files';
Use 'barrel-files/avoid-barrel-files': 'error' or 'barrel-files/avoid-barrel-files': ['warn', { /* options */ }].Use 'barrel-files/avoid-barrel-files' instead of 'avoid-barrel-files'.