0

I was looking into understanding how -- works recently when I've seen it used on command lines and I learned that it separates a command and it's options from other arguments, so that the command knows not to expect any further options after the -- e.g.

 grep -- --hello data.txt

however I was reading some npm articles and I came across this command in a package.json file:

"lint:fix": "npm run lint -- --fix",

What I'm confused about here is that the --fix option is being passed after the double dashes, isn't this against how the -- syntax is meant to work?

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
j obe
  • 1,759
  • 4
  • 15
  • 23
  • 1
    look at your lint script. – Daniel A. White Jan 19 '22 at 21:30
  • 1
    Does this answer your question? [Sending command line arguments to npm script](https://stackoverflow.com/questions/11580961/sending-command-line-arguments-to-npm-script) – pilchard Jan 19 '22 at 22:43
  • Ah thanks, so it is a combination of an option that is also being passed as an argument, I hadn't seen it that way, thanks. – j obe Jan 19 '22 at 23:06

0 Answers0