npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

deedpoll

0.3.0 • Public • Published

deedpoll

Large JavaScript projects often have naming conventions. Usually, the onus is on project maintainers to spot incorrectly named identifiers when reviewing pull requests. deedpoll is a simple tool for enforcing consistent naming of common identifiers such as those used as loop variables.

Consider the following file:

$ cat example.js
function findIndex(array, el) {
  for (var i = 0, len = array.length; i < len; i += 1) {
    if (array[i] === el) {
      return i;
    }
  }
  return -1;
}

Usage is straightforward. Include any number of --rename <bad>:<good> directives and any number of filenames (optionally separated by --):

$ deedpoll --rename array:list --rename i:idx --rename index:idx -- example.js
Expected "list" at example.js:1:19 (found "array")
Expected "idx" at example.js:2:11 (found "i")

The exit code indicates the number of incorrectly named identifiers:

$ echo $?
2

Keywords

none

install

npm i deedpoll

Downloadsweekly downloads

0

version

0.3.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability