Enable func-style ESLint rule
This commit is contained in:
@@ -53,7 +53,6 @@ const baseConfig = {
|
|||||||
"etc/no-implicit-any-catch": "error",
|
"etc/no-implicit-any-catch": "error",
|
||||||
"filenames/match-regex": "off",
|
"filenames/match-regex": "off",
|
||||||
"filenames/match-regexp": "off",
|
"filenames/match-regexp": "off",
|
||||||
"func-style": "off",
|
|
||||||
"i18n-text/no-en": "off",
|
"i18n-text/no-en": "off",
|
||||||
"no-invalid-this": "off",
|
"no-invalid-this": "off",
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ export function assertNever(value: never): never {
|
|||||||
/**
|
/**
|
||||||
* Use to perform array filters where the predicate is asynchronous.
|
* Use to perform array filters where the predicate is asynchronous.
|
||||||
*/
|
*/
|
||||||
export const asyncFilter = async function <T>(
|
export async function asyncFilter<T>(
|
||||||
arr: T[],
|
arr: T[],
|
||||||
predicate: (arg0: T) => Promise<boolean>,
|
predicate: (arg0: T) => Promise<boolean>,
|
||||||
) {
|
) {
|
||||||
const results = await Promise.all(arr.map(predicate));
|
const results = await Promise.all(arr.map(predicate));
|
||||||
return arr.filter((_, index) => results[index]);
|
return arr.filter((_, index) => results[index]);
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This regex matches strings of the form `owner/repo` where:
|
* This regex matches strings of the form `owner/repo` where:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { expect } from "@jest/globals";
|
|||||||
import type { MatcherFunction } from "expect";
|
import type { MatcherFunction } from "expect";
|
||||||
import { pathsEqual } from "../../src/common/files";
|
import { pathsEqual } from "../../src/common/files";
|
||||||
|
|
||||||
|
// eslint-disable-next-line func-style -- We need to set the type of this function
|
||||||
const toEqualPath: MatcherFunction<[expectedPath: unknown]> = function (
|
const toEqualPath: MatcherFunction<[expectedPath: unknown]> = function (
|
||||||
actual,
|
actual,
|
||||||
expectedPath,
|
expectedPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user