https://github.com/davidchambers/deedpoll
:page_facing_up: Flag incorrectly named identifiers in JavaScript programs
https://github.com/davidchambers/deedpoll
Last synced: 4 months ago
JSON representation
:page_facing_up: Flag incorrectly named identifiers in JavaScript programs
- Host: GitHub
- URL: https://github.com/davidchambers/deedpoll
- Owner: davidchambers
- License: wtfpl
- Created: 2014-09-08T17:54:14.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T11:40:10.000Z (almost 9 years ago)
- Last Synced: 2025-02-27T23:57:21.290Z (5 months ago)
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.