mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Replace eslint rulesdir with eslint-plugin-local, convert eslint rules to JS (#50380)
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Harness.Parallel.Host {
|
||||
constructor(info: ErrorInfo | TestInfo) {
|
||||
super(info.name[info.name.length - 1]);
|
||||
this.info = info;
|
||||
this.state = "error" in info ? "failed" : "passed"; // eslint-disable-line no-in-operator
|
||||
this.state = "error" in info ? "failed" : "passed"; // eslint-disable-line local/no-in-operator
|
||||
this.pending = false;
|
||||
}
|
||||
}
|
||||
@@ -512,7 +512,7 @@ namespace Harness.Parallel.Host {
|
||||
function replayTest(runner: Mocha.Runner, test: RemoteTest) {
|
||||
runner.emit("test", test);
|
||||
if (test.isFailed()) {
|
||||
runner.emit("fail", test, "error" in test.info ? rebuildError(test.info) : new Error("Unknown error")); // eslint-disable-line no-in-operator
|
||||
runner.emit("fail", test, "error" in test.info ? rebuildError(test.info) : new Error("Unknown error")); // eslint-disable-line local/no-in-operator
|
||||
}
|
||||
else {
|
||||
runner.emit("pass", test);
|
||||
|
||||
@@ -550,7 +550,7 @@ import {
|
||||
x
|
||||
} from "bar"`;
|
||||
runSingleFileTest("insertNodeInListAfter12", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), factory.createImportSpecifier(/*isTypeOnly*/ false, undefined, factory.createIdentifier("a")));
|
||||
});
|
||||
}
|
||||
@@ -560,7 +560,7 @@ import {
|
||||
x // this is x
|
||||
} from "bar"`;
|
||||
runSingleFileTest("insertNodeInListAfter13", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), factory.createImportSpecifier(/*isTypeOnly*/ false, undefined, factory.createIdentifier("a")));
|
||||
});
|
||||
}
|
||||
@@ -591,7 +591,7 @@ import {
|
||||
x
|
||||
} from "bar"`;
|
||||
runSingleFileTest("insertNodeInListAfter16", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), factory.createImportSpecifier(/*isTypeOnly*/ false, undefined, factory.createIdentifier("a")));
|
||||
});
|
||||
}
|
||||
@@ -602,7 +602,7 @@ import {
|
||||
x // this is x
|
||||
} from "bar"`;
|
||||
runSingleFileTest("insertNodeInListAfter17", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), factory.createImportSpecifier(/*isTypeOnly*/ false, undefined, factory.createIdentifier("a")));
|
||||
});
|
||||
}
|
||||
@@ -612,14 +612,14 @@ import {
|
||||
x0, x
|
||||
} from "bar"`;
|
||||
runSingleFileTest("insertNodeInListAfter18", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), factory.createImportSpecifier(/*isTypeOnly*/ false, undefined, factory.createIdentifier("a")));
|
||||
});
|
||||
}
|
||||
{
|
||||
const runTest = (name: string, text: string) => runSingleFileTest(name, /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
for (const specifier of ["x3", "x4", "x5"]) {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeInListAfter(sourceFile, findChild("x2", sourceFile), factory.createImportSpecifier(/*isTypeOnly*/ false, undefined, factory.createIdentifier(specifier)));
|
||||
}
|
||||
});
|
||||
@@ -639,7 +639,7 @@ class A {
|
||||
const newNodes = [];
|
||||
for (let i = 0; i < 11 /*error doesn't occur with fewer nodes*/; ++i) {
|
||||
newNodes.push(
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
factory.createPropertyDeclaration(undefined, i + "", undefined, undefined, undefined));
|
||||
}
|
||||
const insertAfter = findChild("x", sourceFile);
|
||||
@@ -655,7 +655,7 @@ class A {
|
||||
}
|
||||
`;
|
||||
runSingleFileTest("insertNodeAfterInClass1", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeAfter(sourceFile, findChild("x", sourceFile), factory.createPropertyDeclaration(undefined, "a", undefined, factory.createKeywordTypeNode(SyntaxKind.BooleanKeyword), undefined));
|
||||
});
|
||||
}
|
||||
@@ -666,7 +666,7 @@ class A {
|
||||
}
|
||||
`;
|
||||
runSingleFileTest("insertNodeAfterInClass2", /*placeOpenBraceOnNewLineForFunctions*/ false, text, /*validateNodes*/ false, (sourceFile, changeTracker) => {
|
||||
// eslint-disable-next-line boolean-trivia
|
||||
// eslint-disable-next-line local/boolean-trivia
|
||||
changeTracker.insertNodeAfter(sourceFile, findChild("x", sourceFile), factory.createPropertyDeclaration(undefined, "a", undefined, factory.createKeywordTypeNode(SyntaxKind.BooleanKeyword), undefined));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ namespace ts.projectSystem {
|
||||
export function openFilesForSession(files: readonly (File | { readonly file: File | string, readonly projectRootPath: string, content?: string })[], session: server.Session): void {
|
||||
for (const file of files) {
|
||||
session.executeCommand(makeSessionRequest<protocol.OpenRequestArgs>(CommandNames.Open,
|
||||
"projectRootPath" in file ? { file: typeof file.file === "string" ? file.file : file.file.path, projectRootPath: file.projectRootPath } : { file: file.path })); // eslint-disable-line no-in-operator
|
||||
"projectRootPath" in file ? { file: typeof file.file === "string" ? file.file : file.file.path, projectRootPath: file.projectRootPath } : { file: file.path })); // eslint-disable-line local/no-in-operator
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1560,7 +1560,7 @@ const b: B = new B();`
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-disable boolean-trivia */
|
||||
/* eslint-disable local/boolean-trivia */
|
||||
|
||||
// Pre-loaded = A file from project B is already open when FAR is invoked
|
||||
// dRPL = Project A has disableReferencedProjectLoad
|
||||
@@ -1587,7 +1587,7 @@ const b: B = new B();`
|
||||
baselineDisableReferencedProjectLoad(false, false, false, true); // Loaded | Via redirect | index.ts, helper.ts |
|
||||
baselineDisableReferencedProjectLoad(false, false, false, false); // Loaded | Via redirect | index.ts, helper.ts |
|
||||
|
||||
/* eslint-enable boolean-trivia */
|
||||
/* eslint-enable local/boolean-trivia */
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable boolean-trivia */
|
||||
/* eslint-disable local/boolean-trivia */
|
||||
namespace ts.projectSystem {
|
||||
describe("unittests:: tsserver:: webServer", () => {
|
||||
class TestWorkerSession extends server.WorkerSession {
|
||||
|
||||
Reference in New Issue
Block a user