0.0.2 • Published 9 years ago

eslint-plugin-batman-requires v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

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/*"]
  }
}