Node CLI eval option can't take unary negation operator
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Version
v17.9.0
Platform
Darwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64
Subsystem
No response
What steps will reproduce the bug?
Execute the following:
$ node -pe "-0"
And you will get back:
node: --eval requires an argument
In fact, anything where the - comes first, you get this message.
For example, all of the following also result in the above message:
$ node -pe "-42"
$ node -pe "-"
$ node -pe "-NaN"
How often does it reproduce? Is there a required condition?
It's always reproducable (at least on this version and machine).
What is the expected behavior?
I'd like it to not spit back an error message and give me the evaluated value, please.
What do you see instead?
An error message detailing that the "eval" option was not given a value.
Additional information
It seems that the CLI is not properly parsing its arguments?
Prefixing the expression with 0 seems to work:
$ node -pe "0-42"
42
As well as using a comma operator:
$ node -pe "(0, -42)"
-42
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、文書化されている node -pe "-0" と関連コマンドで問題を再現し、次に eval オプションに対する Node の CLI 引数解析を追跡します。- で始まる式の回帰テストを追加し、eval に引数がないと報告されるのではなく、コマンドが正常に評価されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100