Skip to content

Commit 6a96b97

Browse files
authored
Enable eslint rule no-useless-escape (#55138)
1 parent 23eabea commit 6a96b97

32 files changed

+50
-51
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
],
105105

106106
// Todo: For each of these, investigate whether we want to enable them ✨
107-
"no-useless-escape": "off",
108107
"prefer-rest-params": "off",
109108
"prefer-spread": "off",
110109
"@typescript-eslint/no-unused-vars": "off",

scripts/build/tests.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,5 @@ function deleteTemporaryProjectOutput() {
222222
* @param {string} text
223223
*/
224224
function regExpEscape(text) {
225-
return text.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
225+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
226226
}

scripts/configurePrerelease.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function updateTsFile(tsFilePath, tsFileContents, majorMinor, patch, nightlyPatc
9090
* @returns {{ majorMinor: string, patch: string }}
9191
*/
9292
function parsePackageJsonVersion(versionString) {
93-
const versionRgx = /(\d+\.\d+)\.(\d+)($|\-)/;
93+
const versionRgx = /(\d+\.\d+)\.(\d+)($|-)/;
9494
const match = versionString.match(versionRgx);
9595
assert(match !== null, "package.json 'version' should match " + versionRgx.toString());
9696
return { majorMinor: match[1], patch: match[2] };

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ export function toLowerCase(x: string) {
19481948
//
19491949
// But to avoid having to do string building for most common cases, also ignore
19501950
// a-z, 0-9, \u0131, \u00DF, \, /, ., : and space
1951-
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
1951+
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_. ]+/g;
19521952
/**
19531953
* Case insensitive file systems have descripencies in how they handle some characters (eg. turkish Upper case I with dot on top - \u0130)
19541954
* This function is used in places where we want to make file name as a key on these systems

src/compiler/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export namespace Debug {
366366
}
367367
else {
368368
const text = Function.prototype.toString.call(func);
369-
const match = /^function\s+([\w\$]+)\s*\(/.exec(text);
369+
const match = /^function\s+([\w$]+)\s*\(/.exec(text);
370370
return match ? match[1] : "";
371371
}
372372
}

src/compiler/emitter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,9 +2493,9 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
24932493
}
24942494

24952495
function emitPlaceholder(hint: EmitHint, node: Node, snippet: Placeholder) {
2496-
nonEscapingWrite(`\$\{${snippet.order}:`); // `${2:`
2496+
nonEscapingWrite(`$\{${snippet.order}:`); // `${2:`
24972497
pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
2498-
nonEscapingWrite(`\}`); // `}`
2498+
nonEscapingWrite(`}`); // `}`
24992499
// `${2:...}`
25002500
}
25012501

@@ -2505,7 +2505,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
25052505
`A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`);
25062506
Debug.assert(hint !== EmitHint.EmbeddedStatement,
25072507
`A tab stop cannot be attached to an embedded statement.`);
2508-
nonEscapingWrite(`\$${snippet.order}`);
2508+
nonEscapingWrite(`$${snippet.order}`);
25092509
}
25102510

25112511
//

src/compiler/scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ export function createScanner(languageVersion: ScriptTarget,
15161516
case CharacterCodes.r:
15171517
return "\r";
15181518
case CharacterCodes.singleQuote:
1519-
return "\'";
1519+
return "'";
15201520
case CharacterCodes.doubleQuote:
15211521
return "\"";
15221522
case CharacterCodes.u:

src/compiler/semver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
//
1919
// NOTE: We differ here in that we allow X and X.Y, with missing parts having the default
2020
// value of `0`.
21-
const versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
21+
const versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
2222

2323
// https://semver.org/#spec-item-9
2424
// > A pre-release version MAY be denoted by appending a hyphen and a series of dot separated
@@ -427,4 +427,4 @@ function formatAlternative(comparators: readonly Comparator[]) {
427427

428428
function formatComparator(comparator: Comparator) {
429429
return `${comparator.operator}${comparator.operand}`;
430-
}
430+
}

src/compiler/utilities.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5813,10 +5813,10 @@ export function hasInvalidEscape(template: TemplateLiteral): boolean {
58135813
// the language service. These characters should be escaped when printing, and if any characters are added,
58145814
// the map below must be updated. Note that this regexp *does not* include the 'delete' character.
58155815
// There is no reason for this other than that JSON.stringify does not handle it either.
5816-
const doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
5817-
const singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
5816+
const doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
5817+
const singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
58185818
// Template strings preserve simple LF newlines, still encode CRLF (or CR)
5819-
const backtickQuoteEscapedCharsRegExp = /\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g;
5819+
const backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g;
58205820
const escapedCharsMap = new Map(Object.entries({
58215821
"\t": "\\t",
58225822
"\v": "\\v",
@@ -5826,8 +5826,8 @@ const escapedCharsMap = new Map(Object.entries({
58265826
"\n": "\\n",
58275827
"\\": "\\\\",
58285828
"\"": "\\\"",
5829-
"\'": "\\\'",
5830-
"\`": "\\\`",
5829+
"'": "\\'",
5830+
"`": "\\`",
58315831
"\u2028": "\\u2028", // lineSeparator
58325832
"\u2029": "\\u2029", // paragraphSeparator
58335833
"\u0085": "\\u0085", // nextLine
@@ -5883,11 +5883,11 @@ export function escapeNonAsciiString(s: string, quoteChar?: CharacterCodes.doubl
58835883
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
58845884
// the language service. These characters should be escaped when printing, and if any characters are added,
58855885
// the map below must be updated.
5886-
const jsxDoubleQuoteEscapedCharsRegExp = /[\"\u0000-\u001f\u2028\u2029\u0085]/g;
5887-
const jsxSingleQuoteEscapedCharsRegExp = /[\'\u0000-\u001f\u2028\u2029\u0085]/g;
5886+
const jsxDoubleQuoteEscapedCharsRegExp = /["\u0000-\u001f\u2028\u2029\u0085]/g;
5887+
const jsxSingleQuoteEscapedCharsRegExp = /['\u0000-\u001f\u2028\u2029\u0085]/g;
58885888
const jsxEscapedCharsMap = new Map(Object.entries({
58895889
"\"": """,
5890-
"\'": "'"
5890+
"'": "'"
58915891
}));
58925892

58935893
function encodeJsxCharacterEntity(charCode: number): string {
@@ -8848,7 +8848,7 @@ export function tryRemoveDirectoryPrefix(path: string, dirPath: string, getCanon
88488848
// Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.
88498849
// It may be inefficient (we could just match (/[-[\]{}()*+?.,\\^$|#\s]/g), but this is future
88508850
// proof.
8851-
const reservedCharacterPattern = /[^\w\s\/]/g;
8851+
const reservedCharacterPattern = /[^\w\s/]/g;
88528852

88538853
/** @internal */
88548854
export function regExpEscape(text: string) {

src/compiler/utilitiesPublic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ export function validateLocaleAndSetLanguage(
624624
sys: { getExecutingFilePath(): string, resolvePath(path: string): string, fileExists(fileName: string): boolean, readFile(fileName: string): string | undefined },
625625
errors?: Diagnostic[]) {
626626
const lowerCaseLocale = locale.toLowerCase();
627-
const matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(lowerCaseLocale);
627+
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
628628

629629
if (!matchResult) {
630630
if (errors) {

src/harness/fourslashImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4912,7 +4912,7 @@ function toArray<T>(x: ArrayOrSingle<T>): readonly T[] {
49124912
}
49134913

49144914
function makeWhitespaceVisible(text: string) {
4915-
return text.replace(/ /g, "\u00B7").replace(/\r/g, "\u00B6").replace(/\n/g, "\u2193\n").replace(/\t/g, "\u2192\ ");
4915+
return text.replace(/ /g, "\u00B7").replace(/\r/g, "\u00B6").replace(/\n/g, "\u2193\n").replace(/\t/g, "\u2192 ");
49164916
}
49174917

49184918
function showTextDiff(expected: string, actual: string): string {

src/harness/harnessIO.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,8 +1173,8 @@ export namespace TestCaseParser {
11731173
}
11741174

11751175
// Regex for parsing options in the format "@Alpha: Value of any sort"
1176-
const optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*([^\r\n]*)/gm; // multiple matches on multiple lines
1177-
const linkRegex = /^[\/]{2}\s*@link\s*:\s*([^\r\n]*)\s*->\s*([^\r\n]*)/gm; // multiple matches on multiple lines
1176+
const optionRegex = /^[/]{2}\s*@(\w+)\s*:\s*([^\r\n]*)/gm; // multiple matches on multiple lines
1177+
const linkRegex = /^[/]{2}\s*@link\s*:\s*([^\r\n]*)\s*->\s*([^\r\n]*)/gm; // multiple matches on multiple lines
11781178

11791179
export function parseSymlinkFromTest(line: string, symlinks: vfs.FileSet | undefined, absoluteRootDir?: string) {
11801180
const linkMetaData = linkRegex.exec(line);

src/server/editorServices.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ export interface TypesMapFile {
387387
const defaultTypeSafeList: SafeList = {
388388
"jquery": {
389389
// jquery files can have names like "jquery-1.10.2.min.js" (or "jquery.intellisense.js")
390-
match: /jquery(-[\d\.]+)?(\.intellisense)?(\.min)?\.js$/i,
390+
match: /jquery(-[\d.]+)?(\.intellisense)?(\.min)?\.js$/i,
391391
types: ["jquery"]
392392
},
393393
"WinJS": {
@@ -4008,7 +4008,7 @@ export class ProjectService {
40084008
}
40094009

40104010
/** Makes a filename safe to insert in a RegExp */
4011-
private static readonly filenameEscapeRegexp = /[-\/\\^$*+?.()|[\]{}]/g;
4011+
private static readonly filenameEscapeRegexp = /[-/\\^$*+?.()|[\]{}]/g;
40124012
private static escapeFilenameForRegex(filename: string) {
40134013
return filename.replace(this.filenameEscapeRegexp, "\\$&");
40144014
}
@@ -4113,7 +4113,7 @@ export class ProjectService {
41134113
}
41144114
if (!exclude) {
41154115
// Exclude any minified files that get this far
4116-
if (/^.+[\.-]min\.js$/.test(normalizedNames[i])) {
4116+
if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
41174117
excludedFiles.push(normalizedNames[i]);
41184118
}
41194119
else {

src/services/codefixes/convertTypedefToType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function findEndOfTextBetween(jsDocComment: JSDoc, from: number, to: number): nu
143143
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
144144

145145
for (let i = comment.length; i > 0; i--) {
146-
if(!/[*\/\s]/g.test(comment.substring(i - 1, i))) {
146+
if(!/[*/\s]/g.test(comment.substring(i - 1, i))) {
147147
return from + i;
148148
}
149149
}

src/services/codefixes/fixNaNEquality.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, ar
8181
}
8282

8383
function getSuggestion(messageText: string | DiagnosticMessageChain) {
84-
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [];
84+
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/'(.*)'/) || [];
8585
return suggestion;
8686
}

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ function getCompletionData(
31123112
// * |c|
31133113
// */
31143114
const lineStart = getLineStartPositionForPosition(position, sourceFile);
3115-
if (!/[^\*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) {
3115+
if (!/[^*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) {
31163116
return { kind: CompletionDataKind.JsDocTag };
31173117
}
31183118
}

src/services/outliningElementsCollector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function isRegionDelimiter(lineText: string) {
165165
// We trim the leading whitespace and // without the regex since the
166166
// multiple potential whitespace matches can make for some gnarly backtracking behavior
167167
lineText = trimStringStart(lineText);
168-
if (!startsWith(lineText, "\/\/")) {
168+
if (!startsWith(lineText, "//")) {
169169
return null; // eslint-disable-line no-null/no-null
170170
}
171171
lineText = trimString(lineText.slice(2));

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,7 @@ export function createLanguageService(
28912891
return result;
28922892

28932893
function escapeRegExp(str: string): string {
2894-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
2894+
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
28952895
}
28962896

28972897
function getTodoCommentsRegExp(): RegExp {

src/services/sourcemaps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
tryParseRawSourceMap,
2929
} from "./_namespaces/ts";
3030

31-
const base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/;
31+
const base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+/=]+)$)?/;
3232

3333
/** @internal */
3434
export interface SourceMapper {

src/testRunner/fourslashRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class FourSlashRunner extends RunnerBase {
5353
const file = typeof test === "string" ? test : test.file;
5454
describe(file, () => {
5555
let fn = ts.normalizeSlashes(file);
56-
const justName = fn.replace(/^.*[\\\/]/, "");
56+
const justName = fn.replace(/^.*[\\/]/, "");
5757

5858
// Convert to relative path
5959
const testIndex = fn.indexOf("tests/");

src/testRunner/projectsRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class ProjectTestCase {
137137

138138
constructor(testCaseFileName: string, { testCase, moduleKind, vfs }: ProjectTestPayload) {
139139
this.testCase = testCase;
140-
this.testCaseJustName = testCaseFileName.replace(/^.*[\\\/]/, "").replace(/\.json/, "");
140+
this.testCaseJustName = testCaseFileName.replace(/^.*[\\/]/, "").replace(/\.json/, "");
141141
this.compilerOptions = createCompilerOptions(testCase, moduleKind);
142142
this.sys = new fakes.System(vfs);
143143

src/testRunner/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function tryGetConfig(args: string[]) {
5353
const prefix = "--config=";
5454
const configPath = ts.forEach(args, arg => arg.lastIndexOf(prefix, 0) === 0 && arg.substr(prefix.length));
5555
// strip leading and trailing quotes from the path (necessary on Windows since shell does not do it automatically)
56-
return configPath && configPath.replace(/(^[\"'])|([\"']$)/g, "");
56+
return configPath && configPath.replace(/(^["'])|(["']$)/g, "");
5757
}
5858

5959
export function createRunner(kind: TestRunnerKind): RunnerBase {

src/testRunner/unittests/base64.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("unittests:: base64", () => {
1010
"日本語",
1111
"🐱",
1212
"\x00\x01",
13-
"\t\n\r\\\"\'\u0062",
13+
"\t\n\r\\\"'\u0062",
1414
"====",
1515
"",
1616
];

src/testRunner/unittests/convertToBase64.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("unittests:: convertToBase64", () => {
1313
});
1414

1515
it("Converts escape sequences correctly", () => {
16-
runTest("\t\n\r\\\"\'\u0062");
16+
runTest("\t\n\r\\\"'\u0062");
1717
});
1818

1919
it("Converts simple unicode characters correctly", () => {

src/testRunner/unittests/helpers/tsserver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export function createLoggerWritingToConsole(host: TestServerHost): Logger {
141141

142142
function sanitizeLog(s: string): string {
143143
s = s.replace(/Elapsed::?\s*\d+(?:\.\d+)?ms/g, "Elapsed:: *ms");
144-
s = s.replace(/\"updateGraphDurationMs\"\:\s*\d+(?:\.\d+)?/g, `"updateGraphDurationMs": *`);
145-
s = s.replace(/\"createAutoImportProviderProgramDurationMs\"\:\s*\d+(?:\.\d+)?/g, `"createAutoImportProviderProgramDurationMs": *`);
144+
s = s.replace(/"updateGraphDurationMs":\s*\d+(?:\.\d+)?/g, `"updateGraphDurationMs": *`);
145+
s = s.replace(/"createAutoImportProviderProgramDurationMs":\s*\d+(?:\.\d+)?/g, `"createAutoImportProviderProgramDurationMs": *`);
146146
s = replaceAll(s, ts.version, "FakeVersion");
147147
s = s.replace(/getCompletionData: Get current token: \d+(?:\.\d+)?/g, `getCompletionData: Get current token: *`);
148148
s = s.replace(/getCompletionData: Is inside comment: \d+(?:\.\d+)?/g, `getCompletionData: Is inside comment: *`);
@@ -155,7 +155,7 @@ function sanitizeLog(s: string): string {
155155
s = s.replace(/collectAutoImports: \d+(?:\.\d+)?/g, `collectAutoImports: *`);
156156
s = s.replace(/continuePreviousIncompleteResponse: \d+(?:\.\d+)?/g, `continuePreviousIncompleteResponse: *`);
157157
s = s.replace(/dependencies in \d+(?:\.\d+)?/g, `dependencies in *`);
158-
s = s.replace(/\"exportMapKey\"\:\s*\"[_$a-zA-Z][_$_$a-zA-Z0-9]*\|\d+\|/g, match => match.replace(/\|\d+\|/, `|*|`));
158+
s = s.replace(/"exportMapKey":\s*"[_$a-zA-Z][_$_$a-zA-Z0-9]*\|\d+\|/g, match => match.replace(/\|\d+\|/, `|*|`));
159159
return s;
160160
}
161161

src/testRunner/unittests/incrementalParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ describe("unittests:: Incremental Parser", () => {
249249
});
250250

251251
it("Strict mode 1", () => {
252-
const source = "foo1();\r\nfoo1();\r\nfoo1();\r\package();";
252+
const source = "foo1();\r\nfoo1();\r\nfoo1();\r\npackage();";
253253

254254
const oldText = ts.ScriptSnapshot.fromString(source);
255255
const newTextAndChange = withInsert(oldText, 0, "'strict';\r\n");
@@ -258,7 +258,7 @@ describe("unittests:: Incremental Parser", () => {
258258
});
259259

260260
it("Strict mode 2", () => {
261-
const source = "foo1();\r\nfoo1();\r\nfoo1();\r\package();";
261+
const source = "foo1();\r\nfoo1();\r\nfoo1();\r\npackage();";
262262

263263
const oldText = ts.ScriptSnapshot.fromString(source);
264264
const newTextAndChange = withInsert(oldText, 0, "'use strict';\r\n");

src/testRunner/unittests/tsbuild/commandLine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("unittests:: tsbuild:: commandLine::", () => {
2626
return {
2727
...withOptionChange(caption, option),
2828
discrepancyExplanation: () => [
29-
`Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/\-/g, "")}`,
29+
`Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`,
3030
`Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`,
3131
]
3232
};
@@ -428,4 +428,4 @@ describe("unittests:: tsbuild:: commandLine::", () => {
428428
baselinePrograms: true,
429429
});
430430
});
431-
});
431+
});

src/testRunner/unittests/tsc/incremental.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ console.log(a);`,
667667
return {
668668
...withOptionChange(caption, option),
669669
discrepancyExplanation: () => [
670-
`Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/\-/g, "")}`,
670+
`Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`,
671671
`Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`,
672672
]
673673
};

src/testRunner/unittests/tscWatch/programUpdates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ export function two() {
13331333
function changeParameterTypeOfBFile(parameterName: string, toType: string): TscWatchCompileChange {
13341334
return {
13351335
caption: `Changed ${parameterName} type to ${toType}`,
1336-
edit: sys => sys.replaceFileText(`/user/username/projects/myproject/b.ts`, new RegExp(`${parameterName}\: [a-z]*`), `${parameterName}: ${toType}`),
1336+
edit: sys => sys.replaceFileText(`/user/username/projects/myproject/b.ts`, new RegExp(`${parameterName}: [a-z]*`), `${parameterName}: ${toType}`),
13371337
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
13381338
};
13391339
}

src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS
397397
"typescript"
398398
},
399399
"scripts": {
400-
"test": "echo \"Error: no test specified\" && exit 1"
400+
"test": "echo \\"Error: no test specified\\" && exit 1"
401401
},
402402
"keywords": [],
403403
"author": "",
@@ -483,7 +483,7 @@ describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectS
483483
ts.forEach(filesAndFoldersToAdd, f => {
484484
f.path = f.path
485485
.replace("/a/b/node_modules/.staging", "/a/b/node_modules")
486-
.replace(/[\-\.][\d\w][\d\w][\d\w][\d\w][\d\w][\d\w][\d\w][\d\w]/g, "");
486+
.replace(/[-.][\d\w][\d\w][\d\w][\d\w][\d\w][\d\w][\d\w][\d\w]/g, "");
487487
});
488488

489489
host.deleteFolder(root + "/a/b/node_modules/.staging", /*recursive*/ true);

tests/baselines/reference/tsserver/cachingFileSystemInformation/npm-install-works-when-timeout-occurs-after-installation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface Array<T> { length: number; [n: number]: T; }
3636
"typescript"
3737
},
3838
"scripts": {
39-
"test": "echo "Error: no test specified" && exit 1"
39+
"test": "echo \"Error: no test specified\" && exit 1"
4040
},
4141
"keywords": [],
4242
"author": "",

0 commit comments

Comments
 (0)