1.1.0 • Published 9 months ago

eslint-plugin-no-barrel-files v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

eslint-plugin-no-barrel-files

ESLint plugin to disallow barrel files.

Why?

Barrel files can slow down your build/tests, can cause circular dependencies, and makes tree shaking more difficult.

Rules

  • no-barrel-files
// fail
export * from "./foo";

import Foo from "./foo";
export default Foo;

import Foo from "./foo";
export { Foo };

export { Moo } from './Moo';
export { default as Moo } from './Moo';

// pass
const Foo = 'baz';
function Bar() {}
class Baz {}

export default Foo;
export { Bar, Baz }

Usage

Install

npm i eslint-plugin-no-barrel-files --dev

ESLint config

module.exports = {
    plugins: ['no-barrel-files'],
    rules: {
        'no-barrel-files/no-barrel-files': 'error'
    }
}

Contributing

If you need any additional features or you find a bug, feel free to submit a pull request or submit an issue.