sindresorhus/eslint-plugin-unicorn
Rule proposal: Use `Array#includes()` instead of repeated conditional checks
Closed
#423 opened on Oct 19, 2019
help wantednew rule
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
Say that we've to show up help information when both -h and --help flags are fired in.
The Approach
const [, , ...args] = process.argv;
if (args[0] === '-h' || args[0] === '--help') {
outputHelp();
}
What Intended
const [, , ...args] = process.argv;
if (['-h', '--help'].includes(args[0])) {
outputHelp();
}