Replace eslint rulesdir with eslint-plugin-local, convert eslint rules to JS (#50380)

This commit is contained in:
Jake Bailey
2022-08-22 13:46:03 -07:00
committed by GitHub
parent aaa4f9d9ff
commit 6362fb2dce
44 changed files with 200 additions and 165 deletions

View File

@@ -819,7 +819,7 @@ namespace ts {
// defined in `ts.commentPragmas` would be excessive, but we can avoid
// some obvious false positives (e.g. in XML-like doc comments) by
// checking the element name.
// eslint-disable-next-line no-in-operator
// eslint-disable-next-line local/no-in-operator
if (!match[3] || !(match[3] in commentPragmas)) {
return false;
}

View File

@@ -754,7 +754,7 @@ namespace ts.codefix {
}
// return undefined argName when arg is null or undefined
// eslint-disable-next-line no-in-operator
// eslint-disable-next-line local/no-in-operator
if (!name || "identifier" in name && name.identifier.text === "undefined") {
return undefined;
}

View File

@@ -1725,7 +1725,7 @@ namespace ts.FindAllReferences {
}
function addReference(referenceLocation: Node, relatedSymbol: Symbol | RelatedSymbol, state: State): void {
const { kind, symbol } = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }; // eslint-disable-line no-in-operator
const { kind, symbol } = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }; // eslint-disable-line local/no-in-operator
// if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference
if (state.options.use === FindReferencesUse.Rename && referenceLocation.kind === SyntaxKind.DefaultKeyword) {

View File

@@ -36,7 +36,7 @@ namespace ts {
}
private assertHasRealPosition(message?: string) {
// eslint-disable-next-line debug-assert
// eslint-disable-next-line local/debug-assert
Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation");
}

View File

@@ -19,7 +19,7 @@ let debugObjectHost: { CollectGarbage(): void } = (function (this: any) { // esl
})();
// We need to use 'null' to interface with the managed side.
/* eslint-disable no-in-operator */
/* eslint-disable local/no-in-operator */
/* @internal */
namespace ts {
@@ -1357,4 +1357,4 @@ namespace ts {
}
}
/* eslint-enable no-in-operator */
/* eslint-enable local/no-in-operator */

View File

@@ -407,11 +407,11 @@ namespace ts.SignatureHelp {
// not enough to put us in the substitution expression; we should consider ourselves part of
// the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1).
//
/* eslint-disable no-double-space */
/* eslint-disable local/no-double-space */
// Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # `
// ^ ^ ^ ^ ^ ^ ^ ^ ^
// Case: 1 1 3 2 1 3 2 2 1
/* eslint-enable no-double-space */
/* eslint-enable local/no-double-space */
Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
if (isTemplateLiteralToken(node)) {
if (isInsideTemplateLiteral(node, position, sourceFile)) {