This commit is contained in:
Alexander T 2019-06-14 12:18:27 +03:00
parent 713d6ec155
commit 627211b06b
9 changed files with 55 additions and 56 deletions

View File

@ -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",

View File

@ -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));

View File

@ -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
}
});

View File

@ -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");

View File

@ -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");
});
});

View File

@ -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");
});

View File

@ -60,7 +60,7 @@ function checkForUniqueCodes(diagnosticTable: InputDiagnosticMessageTable) {
function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFilePathRel: string, thisFilePathRel: string): string {
let result =
"// <auto-generated />\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" +

View File

@ -1,10 +1,10 @@
/// <reference types="node" />
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));
}
}

View File

@ -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;