eslint-plugin-batman-requires

0.0.2 • Public • Published

batman-requires

eslint plugin to prevent requireing modules from parent directories. no parents. get it?

Image of Sad Batman

installation

npm install eslint-plugin-batman-requires --save-dev

usage

and then in your .eslintrc:

{
  "plugins": [
    "batman-requires"
  ],
  "rules": {
    "batman-requires/no-parents": 2
  }
}

whitelisting files

sometimes you do actually want to require parents. like if you put tests in a __tests__ directory right next to the modules, and each test file requires its subject. rather than putting a custom .eslintrc in every __tests__ dir or putting eslint comments everywhere, you can just specify some whitelist globs (minimatch-style) in your rule config, e.g.

{
  "rules": {
    "batman-requires/no-parents": [2, "**/__tests__/*", "moar", "patterns", "here/*"]
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-batman-requires

Weekly Downloads

1

Version

0.0.2

License

ISC

Last publish

Collaborators

  • jenseng