mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Add custom eslint rule 'no-array-mutating-method-expressions' (#59526)
This commit is contained in:
1 parent
7753487591
commit
25e09d9fc3
12 files changed
+153
-19
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import * as ts from "../../../_namespaces/ts.js";
|
||||
import { extractTest } from "./helpers.js";
|
||||
|
||||
function testExtractRangeFailed(caption: string, s: string, expectedErrors: string[]) {
|
||||
function testExtractRangeFailed(caption: string, s: string, expectedErrors: readonly string[]) {
|
||||
return it(caption, () => {
|
||||
const t = extractTest(s);
|
||||
const file = ts.createSourceFile("a.ts", t.source, ts.ScriptTarget.Latest, /*setParentNodes*/ true);
|
||||
@@ -12,7 +12,7 @@ function testExtractRangeFailed(caption: string, s: string, expectedErrors: stri
|
||||
const result = ts.refactor.extractSymbol.getRangeToExtract(file, ts.createTextSpanFromRange(selectionRange), /*invoked*/ false);
|
||||
assert(result.targetRange === undefined, "failure expected");
|
||||
const sortedErrors = result.errors.map(e => e.messageText as string).sort();
|
||||
assert.deepEqual(sortedErrors, expectedErrors.sort(), "unexpected errors");
|
||||
assert.deepEqual(sortedErrors, expectedErrors.slice().sort(), "unexpected errors");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user