Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/davidchambers/deedpoll

:page_facing_up: Flag incorrectly named identifiers in JavaScript programs
https://github.com/davidchambers/deedpoll

Last synced: 30 days ago
JSON representation

:page_facing_up: Flag incorrectly named identifiers in JavaScript programs

Awesome Lists containing this project

README

        

# 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:

```console
$ 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 :`
directives and any number of filenames (optionally separated by `--`):

```console
$ 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 is 0 if there are no incorrectly named identifiers, 1 otherwise.