sindresorhus/eslint-plugin-unicorn

Rule proposal: Use `Array#includes()` instead of repeated conditional checks

クローズ

#423 opened on 2019/10/19

 (12 件のコメント) (13 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
help wantednew rule

Repository metrics

Stars
 (5,022 個のスター)
PR merge metrics
 (平均マージ 4h 30m) (30d で 26 merged PRs)

説明

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();
}

コントリビューターガイド