From 9ac1fce1175964f71117f6574d96eda127282bf4 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:05:47 -0700 Subject: [PATCH] Fix eslint not looking at certain scripts, fix lints (#50660) --- .eslintignore | 13 +++++++++++++ .eslintrc.json | 2 +- scripts/failed-tests.js | 4 ++-- scripts/find-unused-diganostic-messages.mjs | 3 ++- scripts/post-vsts-artifact-comment.js | 2 +- scripts/run-sequence.js | 3 +-- scripts/update-experimental-branches.js | 2 +- 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.eslintignore b/.eslintignore index 078de54900063..8d53899550031 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,7 +3,20 @@ /tests/** /lib/** /src/lib/*.generated.d.ts +# Ignore all compiled script outputs /scripts/*.js +# But, not the ones that are hand-written. +# TODO: remove once scripts are pure JS +!/scripts/browserIntegrationTest.js +!/scripts/createPlaygroundBuild.js +!/scripts/failed-tests.js +!/scripts/find-unused-diagnostic-messages.js +!/scripts/lint-hooks.js +!/scripts/perf-result-post.js +!/scripts/post-vsts-artifact-comment.js +!/scripts/regenerate-unicode-identifier-parts.js +!/scripts/run-sequence.js +!/scripts/update-experimental-branches.js /scripts/eslint/built/** /internal/** /coverage/** diff --git a/.eslintrc.json b/.eslintrc.json index 789725d782835..2ea9622d72e9d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -22,7 +22,7 @@ // // ESLint in VS Code will lint any opened file (so long as it's not eslintignore'd), so // that will work regardless of the below. - { "files": ["*.ts"] } + { "files": ["*.ts", "*.mts", "*.cts", "*.mjs", "*.cjs"] } ], "rules": { "@typescript-eslint/adjacent-overload-signatures": "error", diff --git a/scripts/failed-tests.js b/scripts/failed-tests.js index 66463e56c7c2d..41536e633755a 100644 --- a/scripts/failed-tests.js +++ b/scripts/failed-tests.js @@ -45,7 +45,7 @@ class FailedTestsReporter extends Mocha.reporters.Base { } } - const newOptions = Object.assign({}, options, { reporterOptions: reporterOptions.reporterOptions || {} }); + const newOptions = { ...options, reporterOptions: reporterOptions.reporterOptions || {} }; if (reporterOptions.reporter === "xunit") { newOptions.reporterOptions.output = "TEST-results.xml"; } @@ -142,4 +142,4 @@ class FailedTestsReporter extends Mocha.reporters.Base { } } -module.exports = FailedTestsReporter; \ No newline at end of file +module.exports = FailedTestsReporter; diff --git a/scripts/find-unused-diganostic-messages.mjs b/scripts/find-unused-diganostic-messages.mjs index 6ecff6642d3db..ba529cf81bcf0 100644 --- a/scripts/find-unused-diganostic-messages.mjs +++ b/scripts/find-unused-diganostic-messages.mjs @@ -17,7 +17,8 @@ startOfDiags.split(EOL).forEach(line => { try { execSync(`grep -rnw 'src' -e 'Diagnostics.${diagName}'`).toString(); process.stdout.write("."); - } catch (error) { + } + catch (error) { missingNames.push(diagName); process.stdout.write("x"); } diff --git a/scripts/post-vsts-artifact-comment.js b/scripts/post-vsts-artifact-comment.js index 125b047f51901..f0ffa2c4105ed 100644 --- a/scripts/post-vsts-artifact-comment.js +++ b/scripts/post-vsts-artifact-comment.js @@ -48,7 +48,7 @@ and then running \`npm install\`. // Temporarily disable until we get access controls set up right // Send a ping to https://github.com/microsoft/typescript-make-monaco-builds#pull-request-builds - await gh.request("POST /repos/microsoft/typescript-make-monaco-builds/dispatches", { event_type: process.env.SOURCE_ISSUE, headers: { Accept: "application/vnd.github.everest-preview+json" }}); + await gh.request("POST /repos/microsoft/typescript-make-monaco-builds/dispatches", { event_type: process.env.SOURCE_ISSUE, headers: { Accept: "application/vnd.github.everest-preview+json" } }); } main().catch(async e => { diff --git a/scripts/run-sequence.js b/scripts/run-sequence.js index 21c771ad9913a..6f5828f0b79c8 100644 --- a/scripts/run-sequence.js +++ b/scripts/run-sequence.js @@ -1,7 +1,6 @@ // @ts-check const cp = require("child_process"); /** - * * @param {[string, string[]][]} tasks * @param {cp.SpawnSyncOptions} opts */ @@ -17,4 +16,4 @@ function runSequence(tasks, opts = { timeout: 100000, shell: true }) { return lastResult && lastResult.stdout && lastResult.stdout.toString(); } -exports.runSequence = runSequence; \ No newline at end of file +exports.runSequence = runSequence; diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 6f137db13c518..2dfea45e89330 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -10,7 +10,7 @@ const triggeredPR = process.env.SOURCE_ISSUE || process.env.SYSTEM_PULLREQUEST_P * This program should be invoked as `node ./scripts/update-experimental-branches ` * TODO: the following is racey - if two experiment-enlisted PRs trigger simultaneously and witness one another in an unupdated state, they'll both produce * a new experimental branch, but each will be missing a change from the other. There's no _great_ way to fix this beyond setting the maximum concurrency - * of this task to 1 (so only one job is allowed to update experiments at a time). + * of this task to 1 (so only one job is allowed to update experiments at a time). */ async function main() { const gh = new Octokit({