How execute bash Command Substitution in npm script

Viewed 346

I want to execute linter only on staged files.

For this i wrote inside package.json the command(inside scripts):

"fix-lint": "tslint $(git diff --name-only --staged) "

Execute it:

npm run fix-lint

I have an error:

error: unknown option --name-only

I tried to figure out and try simple command:

"lss": "echo $(ls)" 

And again execute it:

npm run lss

The result is printing $(ls) instead of printing all files in directory.

My question is how to fix this commands/scripts? Or maybe in general how execute bash Command Substitution in npm script.

Thanks in advance.

0 Answers
Related