mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 05:55:11 -05:00
perf: replace String and Array indexOf method calls with includes method call (#55482)
This commit is contained in:
@@ -71,7 +71,7 @@ async function checkSourceFiles() {
|
||||
let count = 0;
|
||||
console.log("== List of errors not used in source ==");
|
||||
for (const errName of errorNames) {
|
||||
if (allSrc.indexOf(errName) < 0) {
|
||||
if (!allSrc.includes(errName)) {
|
||||
console.log(errName);
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ module.exports = createRule({
|
||||
}
|
||||
}
|
||||
|
||||
const hasNewLine = sourceCodeText.slice(commentRangeEnd, argRangeStart).indexOf("\n") >= 0;
|
||||
const hasNewLine = sourceCodeText.slice(commentRangeEnd, argRangeStart).includes("\n");
|
||||
if (argRangeStart !== commentRangeEnd + 1 && !hasNewLine) {
|
||||
// TODO(jakebailey): range should be whitespace
|
||||
context.report({
|
||||
|
||||
@@ -88,7 +88,7 @@ async function main() {
|
||||
const mergeTree = runSequence([
|
||||
["git", ["merge-tree", mergeBase.trim(), branch, "experimental"]],
|
||||
]);
|
||||
if (mergeTree.indexOf(`===${"="}===`) >= 0) { // 7 equals is the center of the merge conflict marker
|
||||
if (mergeTree.includes(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker
|
||||
throw new Error(`Merge conflict detected involving PR ${branch} with other experiment`);
|
||||
}
|
||||
// Merge (always producing a merge commit)
|
||||
|
||||
Reference in New Issue
Block a user