Skip to content

Commit 9a28510

Browse files
feat(eslint): support glob for windows (#79)
Currently, the `lint` script will fail on Windows because single quotes are being used to wrap the glob. This can be easily fixed by using double quotes. Source: https://eslint.org/docs/user-guide/command-line-interface#:~:text=If%20you%20want%20to%20use%20node%20glob%20syntax%2C%20you%20have%20to%20quote%20your%20parameter%20(using%20double%20quotes%20if%20you%20need%20it%20to%20run%20in%20Windows)
1 parent 50e3494 commit 9a28510

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ These fields will be set in the project's `package.json`:
3838
license: 'ISC',
3939
templateVersion: $TEMPLATE_VERSION,
4040
scripts: {
41-
lint: `eslint '**/*.js'`,
41+
lint: 'eslint "**/*.js"',
4242
postlint: 'npm-template-check',
4343
lintfix: 'npm run lint -- --fix',
4444
'template-copy': 'npm-template-copy --force',

lib/postinstall/update-package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const changes = {
99
author: 'GitHub Inc.',
1010
files: ['bin', 'lib'],
1111
scripts: {
12-
lint: `eslint '**/*.js'`,
12+
lint: 'eslint "**/*.js"',
1313
postlint: 'npm-template-check',
1414
'template-copy': 'npm-template-copy --force',
1515
lintfix: 'npm run lint -- --fix',

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"npm-template-copy": "bin/postinstall.js"
99
},
1010
"scripts": {
11-
"lint": "eslint '**/*.js'",
11+
"lint": "eslint \"**/*.js\"",
1212
"lintfix": "npm run lint -- --fix",
1313
"postinstall": "node bin/postinstall.js",
1414
"postlint": "npm-template-check",

tap-snapshots/test/postlint/check-package.js.test.cjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Array [
1212
The following package.json fields are incorrect:
1313
Field: "author" Expected: "GitHub Inc." Found: "Bob"
1414
Field: "files" Expected: ["bin","lib"] Found: undefined
15-
Field: "scripts" Expected: {"lint":"eslint '**/*.js'","postlint":"npm-template-check","template-copy":"npm-template-copy --force","lintfix":"npm run lint -- --fix","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","snap":"tap","test":"tap","posttest":"npm run lint"} Found: undefined
15+
Field: "scripts" Expected: {"lint":"eslint \\\\"**/*.js\\\\"","postlint":"npm-template-check","template-copy":"npm-template-copy --force","lintfix":"npm run lint -- --fix","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","snap":"tap","test":"tap","posttest":"npm run lint"} Found: undefined
1616
Field: "engines" Expected: {"node":"^12.13.0 || ^14.15.0 || >=16"} Found: undefined
1717
),
1818
"solution": "npm rm @npmcli/template-oss && npm i -D @npmcli/template-oss",
@@ -27,7 +27,7 @@ Array [
2727
The following package.json fields are incorrect:
2828
Field: "author" Expected: "GitHub Inc." Found: undefined
2929
Field: "files" Expected: ["bin","lib"] Found: undefined
30-
Field: "scripts.lint" Expected: "eslint '**/*.js'" Found: undefined
30+
Field: "scripts.lint" Expected: "eslint \\\\"**/*.js\\\\"" Found: undefined
3131
Field: "scripts.postlint" Expected: "npm-template-check" Found: undefined
3232
Field: "scripts.template-copy" Expected: "npm-template-copy --force" Found: undefined
3333
Field: "scripts.lintfix" Expected: "npm run lint -- --fix" Found: undefined
@@ -51,7 +51,7 @@ Array [
5151
The following package.json fields are incorrect:
5252
Field: "author" Expected: "GitHub Inc." Found: undefined
5353
Field: "files" Expected: ["bin","lib"] Found: undefined
54-
Field: "scripts" Expected: {"lint":"eslint '**/*.js'","postlint":"npm-template-check","template-copy":"npm-template-copy --force","lintfix":"npm run lint -- --fix","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","snap":"tap","test":"tap","posttest":"npm run lint"} Found: undefined
54+
Field: "scripts" Expected: {"lint":"eslint \\\\"**/*.js\\\\"","postlint":"npm-template-check","template-copy":"npm-template-copy --force","lintfix":"npm run lint -- --fix","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","snap":"tap","test":"tap","posttest":"npm run lint"} Found: undefined
5555
Field: "engines" Expected: {"node":"^12.13.0 || ^14.15.0 || >=16"} Found: undefined
5656
),
5757
"solution": "npm rm @npmcli/template-oss && npm i -D @npmcli/template-oss",
@@ -66,7 +66,7 @@ Array [
6666
The following package.json fields are incorrect:
6767
Field: "author" Expected: "GitHub Inc." Found: undefined
6868
Field: "files" Expected: ["bin","lib"] Found: undefined
69-
Field: "scripts" Expected: {"lint":"eslint '**/*.js'","postlint":"npm-template-check","template-copy":"npm-template-copy --force","lintfix":"npm run lint -- --fix","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","snap":"tap","test":"tap","posttest":"npm run lint"} Found: undefined
69+
Field: "scripts" Expected: {"lint":"eslint \\\\"**/*.js\\\\"","postlint":"npm-template-check","template-copy":"npm-template-copy --force","lintfix":"npm run lint -- --fix","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","snap":"tap","test":"tap","posttest":"npm run lint"} Found: undefined
7070
Field: "engines" Expected: {"node":"^12.13.0 || ^14.15.0 || >=16"} Found: undefined
7171
),
7272
"solution": "npm rm @npmcli/template-oss && npm i -D @npmcli/template-oss",

0 commit comments

Comments
 (0)