JSPM

eslint-plugin-no-barrel-files

1.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 214503
  • Score
    100M100P100Q188658F
  • License ISC

Package Exports

  • eslint-plugin-no-barrel-files
  • eslint-plugin-no-barrel-files/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-no-barrel-files) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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 }

import { Moo } from './Moo';
export const Baz = Moo;

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.