yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Yarn ignores invalid command line arguments

Open mprobst opened this issue 9 years ago • 4 comments

Do you want to request a feature or report a bug?

A bug.

What is the current behavior?

$ yarn install --parsing-command-line-arguments-is-hard
yarn install v0.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[...]
Done in 12.71s.

If the current behavior is a bug, please provide the steps to reproduce.

yarn silently ignores unknown command line arguments. That's a usability problem, i.e. when users mistype an argument, the command silently proceeds but then fails to behave as expected, leaving a puzzled user. Combined with potentially dangerous arguments, this can be a bigger problem. Imagine installing an untrusted package that you'd like to inspect for security reasons, but misstyping --ignore-scripts.

What is the expected behavior?

$ yarn install --fried-chicken
yarn install v0.19.1
error Unknown argument "--fried-chicken".

Please mention your node.js, yarn and operating system version.

Node v5.3.0, Ubuntu.

mprobst avatar Jan 31 '17 11:01 mprobst

I don't think this is a bug and it is a very good enhancement in terms of safety so marking as high-priority.

BYK avatar Oct 27 '17 10:10 BYK

Me and a team of 2 others will attempt to fix this issue

joaoptpsa avatar Nov 27 '17 15:11 joaoptpsa

So basically this issue is due to a issue in commander.js dependency, i created a PR for commander.js https://github.com/tj/commander.js/pull/730 that would fix this, should it get accepted

joaoptpsa avatar Dec 06 '17 14:12 joaoptpsa

This is likely fixed from Commander v5: https://github.com/tj/commander.js/issues/561

Update, Yarn 2 is using Clipanion: https://github.com/yarnpkg/yarn/issues/4225#issuecomment-669161536

shadowspawn avatar Aug 05 '20 10:08 shadowspawn