`if` statements – one line vs. one expression
- 主要言語
- JavaScript
- スター
- 148k
- フォーク
- 26.6k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Until I started using ESLint with your configuration I saw nothing against the rules in this:
``` js
$ cat if.js
const [one, two] = [1, 2];
if (one !== two) throw new Error(
'One does not equal two'
);
```
But ESLint does:
``` sh
$ eslint if.js
if.js
3:0 error Expected { after 'if' condition curly
✖ 1 problem (1 error, 0 warnings)
```
Is this intended? In my opinion the pattern I’ve been using is explicit – and more readable than this:
``` js
if (one !== two) {
throw new Error(
'One does not equal two'
);
}
```
The parens form a visual brace-like block much like in #438.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
このレポートでは、ESLint の `curly` ルールとプロジェクトの設定を特定し、波括弧付きの形式との比較および #438 への参照を行います。まず `curly` がどのように設定されているか、またスタイルガイドが 1 行の `if` 文をどのように扱っているかを確認してください。現在のルールが意図されたものかどうかを判断し、それに応じてその指針を文書化または変更すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- eslint, javascript
- 領域
- documentation, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100