From 627211b06ba4e01d5a9d9691cbe2a980dc02fb59 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 14 Jun 2019 12:18:27 +0300 Subject: [PATCH] quotes --- .eslintrc | 2 +- scripts/authors.ts | 10 ++--- scripts/bisect-test.ts | 38 +++++++++---------- scripts/buildProtocol.ts | 2 +- scripts/errorCheck.ts | 38 +++++++++---------- .../importDefinitelyTypedTests.ts | 2 +- scripts/processDiagnosticMessages.ts | 2 +- scripts/produceLKG.ts | 11 +++--- src/lib/es2018.intl.d.ts | 6 +-- 9 files changed, 55 insertions(+), 56 deletions(-) diff --git a/.eslintrc b/.eslintrc index bf278936bc5..15cdd79a83b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -115,7 +115,7 @@ "prefer-const": "off", "prefer-object-spread": "error", "quote-props": ["error", "consistent-as-needed"], - "quotes": "off", + "quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }], "radix": "off", "sort-keys": "off", "space-before-function-paren": "off", diff --git a/scripts/authors.ts b/scripts/authors.ts index 72f2997f6b7..acc265b02f1 100644 --- a/scripts/authors.ts +++ b/scripts/authors.ts @@ -1,5 +1,5 @@ -import fs = require('fs'); -import path = require('path'); +import fs = require("fs"); +import path = require("path"); import child_process = require("child_process"); interface Author { @@ -169,14 +169,14 @@ namespace Commands { var args = process.argv.slice(2); if (args.length < 1) { - console.log('Usage: node authors.js [command]'); - console.log('List of commands: '); + console.log("Usage: node authors.js [command]"); + console.log("List of commands: "); Object.keys(Commands).forEach(k => console.log(` ${k}: ${(Commands as any)[k].description}`)); } else { var cmd: Function = (Commands as any)[args[0]]; if (cmd === undefined) { - console.log('Unknown command ' + args[1]); + console.log("Unknown command " + args[1]); } else { cmd.apply(undefined, args.slice(1)); diff --git a/scripts/bisect-test.ts b/scripts/bisect-test.ts index fb56dad9b85..312afd43b2e 100644 --- a/scripts/bisect-test.ts +++ b/scripts/bisect-test.ts @@ -2,62 +2,62 @@ * You should have ts-node installed globally before executing this, probably! * Otherwise you'll need to compile this script before you start bisecting! */ -import cp = require('child_process'); -import fs = require('fs'); +import cp = require("child_process"); +import fs = require("fs"); // Slice off 'node bisect-test.js' from the command line args var args = process.argv.slice(2); function tsc(tscArgs: string, onExit: (exitCode: number) => void) { - var tsc = cp.exec('node built/local/tsc.js ' + tscArgs,() => void 0); - tsc.on('close', tscExitCode => { + var tsc = cp.exec("node built/local/tsc.js " + tscArgs,() => void 0); + tsc.on("close", tscExitCode => { onExit(tscExitCode); }); } // TODO: Rewrite bisect script to handle the post-jake/gulp swap period -var jake = cp.exec('jake clean local', () => void 0); -jake.on('close', jakeExitCode => { +var jake = cp.exec("jake clean local", () => void 0); +jake.on("close", jakeExitCode => { if (jakeExitCode === 0) { // See what we're being asked to do - if (args[1] === 'compiles' || args[1] === '!compiles') { + if (args[1] === "compiles" || args[1] === "!compiles") { tsc(args[0], tscExitCode => { - if ((tscExitCode === 0) === (args[1] === 'compiles')) { - console.log('Good'); + if ((tscExitCode === 0) === (args[1] === "compiles")) { + console.log("Good"); process.exit(0); // Good } else { - console.log('Bad'); + console.log("Bad"); process.exit(1); // Bad } }); } - else if (args[1] === 'emits' || args[1] === '!emits') { + else if (args[1] === "emits" || args[1] === "!emits") { tsc(args[0], tscExitCode => { - fs.readFile(args[2], 'utf-8', (err, data) => { + fs.readFile(args[2], "utf-8", (err, data) => { var doesContains = data.indexOf(args[3]) >= 0; - if (doesContains === (args[1] === 'emits')) { - console.log('Good'); + if (doesContains === (args[1] === "emits")) { + console.log("Good"); process.exit(0); // Good } else { - console.log('Bad'); + console.log("Bad"); process.exit(1); // Bad } }); }); } else { - console.log('Unknown command line arguments.'); - console.log('Usage (compile errors): git bisect run ts-node scripts\bisect-test.ts "../failure.ts --module amd" !compiles'); - console.log('Usage (emit check): git bisect run ts-node scripts\bisect-test.ts bar.ts emits bar.js "_this = this"'); + console.log("Unknown command line arguments."); + console.log("Usage (compile errors): git bisect run ts-node scripts\bisect-test.ts '../failure.ts --module amd' !compiles"); + console.log("Usage (emit check): git bisect run ts-node scripts\bisect-test.ts bar.ts emits bar.js '_this = this'"); // Aborts the 'git bisect run' process process.exit(-1); } } else { // Compiler build failed; skip this commit - console.log('Skip'); + console.log("Skip"); process.exit(125); // bisect skip } }); diff --git a/scripts/buildProtocol.ts b/scripts/buildProtocol.ts index b25574ef379..123fef78b5b 100644 --- a/scripts/buildProtocol.ts +++ b/scripts/buildProtocol.ts @@ -140,7 +140,7 @@ function writeProtocolFile(outputFile: string, protocolTs: string, typeScriptSer if (protocolDts === undefined) { const diagHost: ts.FormatDiagnosticsHost = { getCanonicalFileName(f) { return f; }, - getCurrentDirectory() { return '.'; }, + getCurrentDirectory() { return "."; }, getNewLine() { return "\r\n"; } }; const diags = emitResult.diagnostics.map(d => ts.formatDiagnostic(d, diagHost)).join("\r\n"); diff --git a/scripts/errorCheck.ts b/scripts/errorCheck.ts index 4c1dbf7af35..902f001d2cd 100644 --- a/scripts/errorCheck.ts +++ b/scripts/errorCheck.ts @@ -1,16 +1,16 @@ declare var require: any; -let fs = require('fs'); -let async = require('async'); -let glob = require('glob'); +let fs = require("fs"); +let async = require("async"); +let glob = require("glob"); -fs.readFile('src/compiler/diagnosticMessages.json', 'utf-8', (err, data) => { +fs.readFile("src/compiler/diagnosticMessages.json", "utf-8", (err, data) => { if (err) { throw err; } let messages = JSON.parse(data); let keys = Object.keys(messages); - console.log('Loaded ' + keys.length + ' errors'); + console.log("Loaded " + keys.length + " errors"); for (let k of keys) { messages[k].seen = false; @@ -18,12 +18,12 @@ fs.readFile('src/compiler/diagnosticMessages.json', 'utf-8', (err, data) => { let errRegex = /\(\d+,\d+\): error TS([^:]+):/g; - let baseDir = 'tests/baselines/reference/'; + let baseDir = "tests/baselines/reference/"; fs.readdir(baseDir, (err, files) => { - files = files.filter(f => f.indexOf('.errors.txt') > 0); + files = files.filter(f => f.indexOf(".errors.txt") > 0); let tasks: Array<(callback: () => void) => void> = []; files.forEach(f => tasks.push(done => { - fs.readFile(baseDir + f, 'utf-8', (err, baseline) => { + fs.readFile(baseDir + f, "utf-8", (err, baseline) => { if (err) throw err; let g: string[]; @@ -38,7 +38,7 @@ fs.readFile('src/compiler/diagnosticMessages.json', 'utf-8', (err, data) => { })); async.parallelLimit(tasks, 25, done => { - console.log('== List of errors not present in baselines =='); + console.log("== List of errors not present in baselines =="); let count = 0; for (let k of keys) { if (messages[k].seen !== true) { @@ -46,12 +46,12 @@ fs.readFile('src/compiler/diagnosticMessages.json', 'utf-8', (err, data) => { count++; } } - console.log(count + ' of ' + keys.length + ' errors are not in baselines'); + console.log(count + " of " + keys.length + " errors are not in baselines"); }); }); }); -fs.readFile('src/compiler/diagnosticInformationMap.generated.ts', 'utf-8', (err, data) => { +fs.readFile("src/compiler/diagnosticInformationMap.generated.ts", "utf-8", (err, data) => { let errorRegexp = /\s(\w+): \{ code/g; let errorNames: string[] = []; let errMatch: string[]; @@ -59,28 +59,28 @@ fs.readFile('src/compiler/diagnosticInformationMap.generated.ts', 'utf-8', (err, errorNames.push(errMatch[1]); } - let allSrc = ''; - glob('./src/**/*.ts', {}, (err, files) => { - console.log('Reading ' + files.length + ' source files'); + let allSrc = ""; + glob("./src/**/*.ts", {}, (err, files) => { + console.log("Reading " + files.length + " source files"); for (let file of files) { - if (file.indexOf('diagnosticInformationMap.generated.ts') > 0) { + if (file.indexOf("diagnosticInformationMap.generated.ts") > 0) { continue; } - let src = fs.readFileSync(file, 'utf-8'); + let src = fs.readFileSync(file, "utf-8"); allSrc = allSrc + src; } - console.log('Consumed ' + allSrc.length + ' characters of source'); + console.log("Consumed " + allSrc.length + " characters of source"); let count = 0; - console.log('== List of errors not used in source =='); + console.log("== List of errors not used in source =="); for (let errName of errorNames) { if (allSrc.indexOf(errName) < 0) { console.log(errName); count++; } } - console.log(count + ' of ' + errorNames.length + ' errors are not used in source'); + console.log(count + " of " + errorNames.length + " errors are not used in source"); }); }); diff --git a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index 9291714e929..1032cdcb867 100644 --- a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -95,7 +95,7 @@ function importDefinitelyTypedTest(tscPath: string, rwcTestPath: string, testCas //console.log("\r\n"); }) - .on('error', (error: any) => { + .on("error", (error: any) => { console.log("==> error " + JSON.stringify(error)); console.log("\r\n"); }); diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index cc93117f4d0..0c1f6142b35 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -60,7 +60,7 @@ function checkForUniqueCodes(diagnosticTable: InputDiagnosticMessageTable) { function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFilePathRel: string, thisFilePathRel: string): string { let result = "// \r\n" + - "// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel.replace(/\\/g, '/') + "'\r\n" + + "// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel.replace(/\\/g, "/") + "'\r\n" + "/* @internal */\r\n" + "namespace ts {\r\n" + " function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {\r\n" + diff --git a/scripts/produceLKG.ts b/scripts/produceLKG.ts index 31a81f97a2c..da45ae35fe4 100644 --- a/scripts/produceLKG.ts +++ b/scripts/produceLKG.ts @@ -1,10 +1,10 @@ /// -import childProcess = require('child_process'); -import fs = require('fs-extra'); -import path = require('path'); -import removeInternal = require('remove-internal'); -import glob = require('glob'); +import childProcess = require("child_process"); +import fs = require("fs-extra"); +import path = require("path"); +import removeInternal = require("remove-internal"); +import glob = require("glob"); const root = path.join(__dirname, ".."); const source = path.join(root, "built/local"); @@ -30,7 +30,6 @@ async function copyLocalizedDiagnostics() { for (const d of dir) { const fileName = path.join(source, d); if (fs.statSync(fileName).isDirectory()) { - if (d === 'tslint') continue; await fs.copy(fileName, path.join(dest, d)); } } diff --git a/src/lib/es2018.intl.d.ts b/src/lib/es2018.intl.d.ts index ab5c725c8cd..c93a443db85 100644 --- a/src/lib/es2018.intl.d.ts +++ b/src/lib/es2018.intl.d.ts @@ -1,13 +1,13 @@ declare namespace Intl { interface PluralRulesOptions { - localeMatcher?: 'lookup' | 'best fit'; - type?: 'cardinal' | 'ordinal'; + localeMatcher?: "lookup" | "best fit"; + type?: "cardinal" | "ordinal"; } interface ResolvedPluralRulesOptions { locale: string; pluralCategories: string[]; - type: 'cardinal' | 'ordinal'; + type: "cardinal" | "ordinal"; minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number;