Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/davidchambers/deedpoll
- Owner: davidchambers
- License: wtfpl
- Created: 2014-09-08T17:54:14.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T11:40:10.000Z (over 8 years ago)
- Last Synced: 2024-11-17T13:21:27.665Z (about 1 month 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.