This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Add support for glob patterns in single quotes for files and exclude arguments #1679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR checklist
New feature, bugfix, orenhancementWhat changes did you make?
There were three ways to pass globs in npm scripts were mentioned in #1639:
Without quotes
src/**/*.ts
- works on Windows (
src/**/*.ts
is passed to process and matching is done withglob
module)- doesn't match all files on Linux (see Normalize glob matching between Linux and Windows during TSLint build. Fix lint error. #1678)
With single quotes
'src/**/*.ts'
src/**/*.ts
is passed to process and matched withglob
module)'src/**/*.ts'
andglob
returns no matches with quotes"src/**/*.ts"
src/**/*.ts
is passed to process and matching is done withglob
module)- requires escaping in
package.json file
(e.g."lint": "tslint \"src/**/*.ts\""
) which hurts readability and might lead to errors if code editor doesn't notify about errors immediatelyFirst case is OS specific and can't be addressed in TSLint package, but second might be properly handled.
This PR simply clears single quotes that may appear on Windows platform if glob is wrapped in single quotes in npm script.
Main intent is to increase interoperability between platforms and make npm scripts easy to write/read.