Browse Source

fix: make lint run on Windows in PowerShell

Heilig Benedek 6 years ago
parent
commit
4017f3faa7
2 changed files with 7 additions and 7 deletions
  1. 6 6
      package.json
  2. 1 1
      script/lint.js

+ 6 - 6
package.json

@@ -44,19 +44,19 @@
     "bump-version": "./script/bump-version.py",
     "check-tls": "python ./script/tls.py",
     "clang-format": "find atom/ brightray/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
-    "lint": "./script/lint.js && npm run lint:clang-format && npm run lint:docs",
-    "lint:js": "./script/lint.js --js",
+    "lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
+    "lint:js": ".node /script/lint.js --js",
     "lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
-    "lint:cpp": "./script/lint.js --cc",
-    "lint:py": "./script/lint.js --py",
-    "lint:gn": "./script/lint.js --gn",
+    "lint:cpp": "node ./script/lint.js --cc",
+    "lint:py": "node ./script/lint.js --py",
+    "lint:gn": "node ./script/lint.js --gn",
     "lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links",
     "lint:docs-relative-links": "python ./script/check-relative-doc-links.py",
     "lint:js-in-markdown": "standard-markdown docs",
     "create-api-json": "electron-docs-linter docs --outfile=electron-api.json",
     "create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=electron-api.json --out=electron.d.ts",
     "preinstall": "node -e 'process.exit(0)'",
-    "precommit": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ && ./script/lint.js -c && remark docs -qf || (echo \"Code not formatted correctly.\" && exit 1)",
+    "precommit": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ && node ./script/lint.js -c && remark docs -qf || (echo \"Code not formatted correctly.\" && exit 1)",
     "prepack": "check-for-leaks",
     "prepush": "check-for-leaks",
     "repl": "node ./script/start.js --interactive",

+ 1 - 1
script/lint.js

@@ -94,7 +94,7 @@ const LINTERS = [ {
     const allOk = filenames.map(filename => {
       const args = ['format', filename]
       if (!opts.fix) args.push('--dry-run')
-      const result = childProcess.spawnSync('gn', args, { stdio: 'inherit' })
+      const result = childProcess.spawnSync('gn', args, { stdio: 'inherit', shell: true })
       if (result.status === 0) {
         return true
       } else if (result.status === 2) {