From a3fa7ad1784bef9bb535b000cf3cca7f9d4d70bb Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 15 Oct 2018 17:24:11 -0700 Subject: [PATCH] Adding some typings in npm scripts --- build/jsconfig.json | 3 ++- build/npm/postinstall.js | 4 ++++ build/npm/update-all-grammars.js | 3 +++ build/npm/update-grammar.js | 9 ++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/build/jsconfig.json b/build/jsconfig.json index a731bfcdfce..299294ef055 100644 --- a/build/jsconfig.json +++ b/build/jsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "target": "es2017", - "jsx": "preserve" + "jsx": "preserve", + "checkJs": true }, "include": [ "**/*.js" diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 2aaa93528f5..6df0b4ecb23 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -8,6 +8,10 @@ const path = require('path'); const fs = require('fs'); const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn'; +/** + * @param {string} location + * @param {*} [opts] + */ function yarnInstall(location, opts) { opts = opts || {}; opts.cwd = location; diff --git a/build/npm/update-all-grammars.js b/build/npm/update-all-grammars.js index af2db363e6a..3ff7254c3e2 100644 --- a/build/npm/update-all-grammars.js +++ b/build/npm/update-all-grammars.js @@ -7,6 +7,9 @@ const cp = require('child_process'); const fs = require('fs'); const path = require('path'); +/** + * @param {string} location + */ function updateGrammar(location) { const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; const result = cp.spawnSync(npm, ['run', 'update-grammar'], { diff --git a/build/npm/update-grammar.js b/build/npm/update-grammar.js index 988b7bc3795..2ccd808e152 100644 --- a/build/npm/update-grammar.js +++ b/build/npm/update-grammar.js @@ -12,6 +12,9 @@ var cson = require('cson-parser'); var https = require('https'); var url = require('url'); +/** + * @param {string} urlString + */ function getOptions(urlString) { var _url = url.parse(urlString); var headers = { @@ -19,7 +22,7 @@ function getOptions(urlString) { }; var token = process.env['GITHUB_TOKEN']; if (token) { - headers['Authorization'] = 'token ' + token + headers['Authorization'] = 'token ' + token; } return { protocol: _url.protocol, @@ -30,6 +33,10 @@ function getOptions(urlString) { }; } +/** + * @param {string} url + * @param {number} redirectCount + */ function download(url, redirectCount) { return new Promise((c, e) => { var content = '';