Why you should always quote your globs in NPM scripts.

NPM run-scripts don’t use the shell of the user who runs the command.

eslint src/**/*.js
eslint 'src/**/*.js'
...
"scripts": {
"lint": "eslint 'src/**/*.js'"
},
...

Do NPM scripts run cross-platform?

Summary

  • Always quote the globs in your NPM scripts when using ESLint, TSLint, Mocha or other tools that use node-glob,
  • Use cross-platform commands or node packages instead of commands,
  • Double-check if a command or expression is well supported across different shells/shell versions/operating systems (e.g. globstar),
...
"scripts": {
"clean": "rimraf .nyc_output coverage",
"test": "mocha 'tests/**/*spec.js'",
"lint": "eslint '{src,test}/**/*.js'"
},
...

--

--

--

software engineer at portent.io • builds cool stuff, mostly with typescript and python • meet.js Katowice organizer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jakub Synowiec

Jakub Synowiec

software engineer at portent.io • builds cool stuff, mostly with typescript and python • meet.js Katowice organizer

More from Medium

TypeScript Enums: What they are and why you should avoid them

Using JavaScript and window.postMessage() for Safe Cross-Domain Communication

Const myFirstJavascriptBlog = “Declaring Variables”

Webpack seed for FE applications