mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-05 06:08:12 +08:00
Added @typescript-eslint/recommended config with suppressions (#2345)
* Disabled @blueprintjs/classes-constants. #2288. * thuang-eslint-bp-off (#2344) * Disabled @blueprintjs/classes-constants on webpack dev and shared. #2288. * Added TS recommended, suppress lint errors codemod. * Added per-error/warning ignore for tests. * Added per-error/warning ignore for configuration. * Added per-error/warning ignore for src. Removed suppress package. * Minor linting. Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
This commit is contained in:
co-authored by
Timmy Huang
parent
32f60a1547
commit
27575b8d86
@@ -14,9 +14,11 @@ import { Dataframe } from "../../../src/util/dataframe";
|
||||
enableFetchMocks();
|
||||
|
||||
describe("AnnoMatrix", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let annoMatrix: any;
|
||||
|
||||
beforeEach(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).resetMocks(); // reset all fetch mocking state
|
||||
// reset all fetch mocking state
|
||||
annoMatrix = new AnnoMatrixLoader(
|
||||
@@ -37,6 +39,7 @@ describe("AnnoMatrix", () => {
|
||||
});
|
||||
|
||||
test("simple single column fetch", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(serverMocks.annotationsObs(["name_0"]));
|
||||
|
||||
const df = await annoMatrix.fetch("obs", "name_0");
|
||||
@@ -46,6 +49,7 @@ describe("AnnoMatrix", () => {
|
||||
});
|
||||
|
||||
test("simple multi column fetch", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any)
|
||||
.once(serverMocks.annotationsObs(["name_0"]))
|
||||
.once(serverMocks.annotationsObs(["n_genes"]));
|
||||
@@ -56,8 +60,10 @@ describe("AnnoMatrix", () => {
|
||||
});
|
||||
|
||||
describe("fetch from field", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const getLastTwo = async (field: any) => {
|
||||
const columnNames = annoMatrix.getMatrixColumns(field).slice(-2);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockResponses(
|
||||
...columnNames.map(() => serverMocks.responder)
|
||||
);
|
||||
@@ -73,18 +79,21 @@ describe("AnnoMatrix", () => {
|
||||
|
||||
test("fetch - test all query forms", async () => {
|
||||
// single string is a column name
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(serverMocks.annotationsObs(["n_genes"]));
|
||||
await expect(annoMatrix.fetch("obs", "n_genes")).resolves.toBeInstanceOf(
|
||||
Dataframe
|
||||
);
|
||||
|
||||
// array of column names, expecting n_genes to be cached.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(serverMocks.annotationsObs(["percent_mito"]));
|
||||
await expect(
|
||||
annoMatrix.fetch("obs", ["n_genes", "percent_mito"])
|
||||
).resolves.toBeInstanceOf(Dataframe);
|
||||
|
||||
// more complex value filter query, enumerated
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(serverMocks.responder);
|
||||
await expect(
|
||||
annoMatrix.fetch("X", {
|
||||
@@ -98,6 +107,7 @@ describe("AnnoMatrix", () => {
|
||||
|
||||
// more complex value filter query, range
|
||||
const varIndex = annoMatrix.schema.annotations.var.index;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any)
|
||||
.once(
|
||||
serverMocks.withExpected("/data/var", [[`var:${varIndex}`, "SUMO3"]])
|
||||
@@ -174,6 +184,7 @@ describe("AnnoMatrix", () => {
|
||||
expect(am1.nObs).toEqual(am2.nObs);
|
||||
expect(am1.nVar).toEqual(am2.nVar);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any)
|
||||
.once(serverMocks.annotationsObs(["n_genes"]))
|
||||
.once(serverMocks.annotationsObs(["n_genes"]));
|
||||
@@ -191,6 +202,7 @@ describe("AnnoMatrix", () => {
|
||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'base' implicitly has an 'any' type.
|
||||
async function addDrop(base) {
|
||||
expect(base.getMatrixColumns("obs")).not.toContain("foo");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(base.fetch("obs", "foo")).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -216,6 +228,7 @@ describe("AnnoMatrix", () => {
|
||||
const am2 = am1.dropObsColumn("foo");
|
||||
expect(base.getMatrixColumns("obs")).not.toContain("foo");
|
||||
expect(am2.getMatrixColumns("obs")).not.toContain("foo");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(am2.fetch("obs", "foo")).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -239,6 +252,7 @@ describe("AnnoMatrix", () => {
|
||||
const am4 = clip(am3, 0, 1);
|
||||
await addDrop(am4);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockResponse(serverMocks.responder);
|
||||
|
||||
await am1.fetch("obs", am1.getMatrixColumns("obs"));
|
||||
@@ -246,6 +260,7 @@ describe("AnnoMatrix", () => {
|
||||
await am3.fetch("obs", am3.getMatrixColumns("obs"));
|
||||
await am4.fetch("obs", am4.getMatrixColumns("obs"));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).resetMocks();
|
||||
|
||||
await addDrop(am1);
|
||||
@@ -292,6 +307,7 @@ describe("AnnoMatrix", () => {
|
||||
);
|
||||
|
||||
/* drop column */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
am = am1.dropObsColumn("test");
|
||||
await expect(am.fetch("obs", "test")).rejects.toThrow(
|
||||
@@ -313,6 +329,7 @@ describe("AnnoMatrix", () => {
|
||||
const am3 = isubset(annoMatrix, [10, 1, 0, 30, 2]);
|
||||
await addSetDrop(am3);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockResponse(serverMocks.responder);
|
||||
|
||||
await am1.fetch("obs", am1.getMatrixColumns("obs"));
|
||||
|
||||
@@ -17,10 +17,13 @@ import { rangeFill } from "../../../src/util/range";
|
||||
enableFetchMocks();
|
||||
|
||||
describe("AnnoMatrixCrossfilter", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let annoMatrix: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let crossfilter: any;
|
||||
|
||||
beforeEach(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).resetMocks(); // reset all fetch mocking state
|
||||
// reset all fetch mocking state
|
||||
annoMatrix = new AnnoMatrixLoader(
|
||||
@@ -68,6 +71,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
crossfilter.obsCrossfilter.hasDimension("obs/louvain")
|
||||
).toBeFalsy();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(["louvain"], [obsLouvain])
|
||||
);
|
||||
@@ -79,6 +83,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
newCrossfilter.obsCrossfilter.hasDimension("obs/louvain")
|
||||
).toBeTruthy();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
expect((fetch as any).mock.calls).toHaveLength(1);
|
||||
|
||||
newCrossfilter = await crossfilter.select("obs", "louvain", {
|
||||
@@ -90,6 +95,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
test("simple column select", async () => {
|
||||
let xfltr;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(["louvain"], [obsLouvain])
|
||||
);
|
||||
@@ -130,10 +136,12 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
const values = df.col("louvain").asArray();
|
||||
const selected = xfltr.allSelectedMask();
|
||||
values.every(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(val: any, idx: any) =>
|
||||
!["NK cells", "B cells"].includes(val) !== !selected[idx]
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(["n_genes"], [new Int32Array(obsNGenes)])
|
||||
);
|
||||
@@ -168,6 +176,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
const varIndex = annoMatrix.schema.annotations.var.index;
|
||||
|
||||
const { nObs } = annoMatrix.schema.dataframe;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(
|
||||
["TEST"],
|
||||
@@ -205,14 +214,17 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
const values = df.icol(0).asArray();
|
||||
const selected = xfltr.allSelectedMask();
|
||||
values.every(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(val: any, idx: any) => !(val >= 0 && val <= 50) !== !selected[idx]
|
||||
);
|
||||
expect(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
selected.reduce((acc: any, val: any) => (val ? acc + 1 : acc), 0)
|
||||
).toEqual(xfltr.countSelected());
|
||||
});
|
||||
|
||||
test("spatial column select", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(
|
||||
["umap_0", "umap_1"],
|
||||
@@ -241,6 +253,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
let xfltr = new AnnoMatrixObsCrossfilter(annoMatrixSubset);
|
||||
expect(xfltr.countSelected()).toEqual(annoMatrixSubset.nObs);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(["louvain"], [obsLouvain])
|
||||
);
|
||||
@@ -256,6 +269,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
const values = df.col("louvain").asArray();
|
||||
const selected = xfltr.allSelectedMask();
|
||||
values.every(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(val: any, idx: any) =>
|
||||
!["NK cells", "B cells"].includes(val) !== !selected[idx]
|
||||
);
|
||||
@@ -270,6 +284,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
"unable to obsSelect upon the var dimension"
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(crossfilter.select("obs", "foo")).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -281,6 +296,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
/*
|
||||
test the matrix mutators via crossfilter proxy
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function helperAddTestCol(cf: any, colName: any, colSchema = null) {
|
||||
expect(
|
||||
cf.annoMatrix.getMatrixColumns("obs").includes(colName)
|
||||
@@ -301,6 +317,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
const xfltr = cf.addObsColumn(colSchema, Array, initValue);
|
||||
expect(
|
||||
xfltr.annoMatrix.schema.annotations.obs.columns.filter(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(v: any) => v.name === colName
|
||||
)
|
||||
).toHaveLength(1);
|
||||
@@ -331,6 +348,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
});
|
||||
expect(
|
||||
xfltr.annoMatrix.schema.annotations.obs.columns.filter(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(v: any) => v.name === "foo"
|
||||
)
|
||||
).toHaveLength(1);
|
||||
@@ -340,7 +358,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
df
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.every((v: any) => v === "A")
|
||||
).toBeTruthy();
|
||||
|
||||
@@ -378,10 +396,12 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
xfltr = xfltr.dropObsColumn("foo");
|
||||
expect(
|
||||
xfltr.annoMatrix.schema.annotations.obs.columns.filter(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(v: any) => v.name === "foo"
|
||||
)
|
||||
).toHaveLength(0);
|
||||
expect(xfltr.annoMatrix.schema.annotations.obsByName.foo).toBeUndefined();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(xfltr.annoMatrix.fetch("obs", "foo")).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -395,6 +415,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
});
|
||||
xfltr = xfltr.dropObsColumn("bar");
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(xfltr.select("obs", "bar", { mode: "all" })).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -421,6 +442,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
type: "categorical",
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(xfltr.annoMatrix.fetch("obs", "foo")).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -436,6 +458,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
});
|
||||
xfltr = xfltr.renameObsColumn("bar", "xyz");
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).mockRejectOnce(new Error("unknown column name"));
|
||||
await expect(xfltr.select("obs", "bar", { mode: "all" })).rejects.toThrow(
|
||||
"unknown column name"
|
||||
@@ -446,6 +469,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
});
|
||||
|
||||
test("addObsAnnoCategory", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let xfltr: any;
|
||||
|
||||
// catch unknown or readonly columns
|
||||
@@ -515,7 +539,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
(await xfltr.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.every((v: any) => v === "unassigned")
|
||||
).toBeTruthy();
|
||||
expect(xfltr.annoMatrix.getColumnSchema("obs", "foo")).toMatchObject({
|
||||
@@ -534,7 +558,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
(await xfltr1.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.every((v: any) => v === "unassigned")
|
||||
).toBeTruthy();
|
||||
expect(xfltr1.annoMatrix.getColumnSchema("obs", "foo")).toMatchObject({
|
||||
@@ -557,7 +581,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
(await xfltr2.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.every((v: any) => v === "red")
|
||||
).toBeTruthy();
|
||||
expect(xfltr2.annoMatrix.getColumnSchema("obs", "foo")).toMatchObject({
|
||||
@@ -593,7 +617,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
(await xfltr.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.every((v: any) => v === "unassigned")
|
||||
).toBeTruthy();
|
||||
const xfltr1 = await xfltr.setObsColumnValues("foo", [0, 10], "purple");
|
||||
@@ -602,6 +626,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.every(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(v: any, i: any) =>
|
||||
v === "unassigned" || (v === "purple" && (i === 0 || i === 10))
|
||||
)
|
||||
@@ -660,7 +685,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
(await xfltr1.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.filter((v: any) => v === "purple")
|
||||
).toHaveLength(2);
|
||||
|
||||
@@ -668,13 +693,13 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
expect(
|
||||
(await xfltr1.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.filter((v: any) => v === "magenta")
|
||||
).toHaveLength(2);
|
||||
expect(
|
||||
(await xfltr1.annoMatrix.fetch("obs", "foo"))
|
||||
.col("foo")
|
||||
.asArray()
|
||||
.asArray() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.filter((v: any) => v === "purple")
|
||||
).toHaveLength(0);
|
||||
expect(xfltr1.annoMatrix.getColumnSchema("obs", "foo")).toMatchObject({
|
||||
@@ -695,6 +720,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
describe("edge cases", () => {
|
||||
test("transition from empty annoMatrix", async () => {
|
||||
// select before fetch needs to work
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(fetch as any).once(
|
||||
serverMocks.dataframeResponse(["louvain"], [obsLouvain])
|
||||
);
|
||||
@@ -702,6 +728,7 @@ describe("AnnoMatrixCrossfilter", () => {
|
||||
mode: "exact",
|
||||
values: "B cells",
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
expect((fetch as any).mock.calls).toHaveLength(1);
|
||||
expect(xfltr.obsCrossfilter.hasDimension("obs/louvain")).toBeTruthy();
|
||||
expect(xfltr.obsCrossfilter.all()).toBe(xfltr.annoMatrix._cache.obs);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const baseDataURL = "https://a.fake.url/api/v0.2";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(window as any).CELLXGENE = {
|
||||
API: {
|
||||
prefix: baseDataURL,
|
||||
|
||||
@@ -14,6 +14,7 @@ const indexedSchema = {
|
||||
),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function makeMockColumn(s: any, length: any) {
|
||||
const { type } = s;
|
||||
switch (type) {
|
||||
@@ -37,8 +38,10 @@ function makeMockColumn(s: any, length: any) {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function getEncodedDataframe(colNames: any, length: any, colSchemas: any) {
|
||||
const colIndex = new KeyIndex(colNames);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const columns = colSchemas.map((s: any) => makeMockColumn(s, length));
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'KeyIndex' is not assignable to p... Remove this comment to see the full error message
|
||||
const df = new Dataframe([length, colNames.length], columns, null, colIndex);
|
||||
@@ -46,6 +49,7 @@ function getEncodedDataframe(colNames: any, length: any, colSchemas: any) {
|
||||
return body;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
export function dataframeResponse(colNames: any, columns: any) {
|
||||
const colIndex = new KeyIndex(colNames);
|
||||
const df = new Dataframe(
|
||||
@@ -62,8 +66,10 @@ export function dataframeResponse(colNames: any, columns: any) {
|
||||
return () => Promise.resolve({ body, init: { status: 200, headers } });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function annotationObsResponse(request: any) {
|
||||
const url = new URL(request.url);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const params = Array.from((url.searchParams as any).entries());
|
||||
const names = params
|
||||
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
||||
@@ -91,8 +97,10 @@ function annotationObsResponse(request: any) {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function annotationVarResponse(request: any) {
|
||||
const url = new URL(request.url);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const params = Array.from((url.searchParams as any).entries());
|
||||
const names = params
|
||||
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
||||
@@ -120,8 +128,10 @@ function annotationVarResponse(request: any) {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function layoutObsResponse(request: any) {
|
||||
const url = new URL(request.url);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const params = Array.from((url.searchParams as any).entries());
|
||||
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
||||
const names = params.filter(([k]) => k === "layout-name").map(([, v]) => v);
|
||||
@@ -150,10 +160,13 @@ function layoutObsResponse(request: any) {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function dataVarResponse(request: any) {
|
||||
const url = new URL(request.url);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const params = Array.from((url.searchParams as any).entries());
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const colNames = params.map((v) => `${(v as any)[0]}/${(v as any)[1]}`);
|
||||
const colSchemas = colNames.map(() => schema.schema.dataframe);
|
||||
const body = getEncodedDataframe(
|
||||
@@ -171,6 +184,7 @@ function dataVarResponse(request: any) {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
export function responder(request: any) {
|
||||
const url = new URL(request.url);
|
||||
const { pathname } = url;
|
||||
@@ -189,29 +203,34 @@ export function responder(request: any) {
|
||||
return Promise.reject(new Error("bad URL"));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
export function withExpected(expectedURL: any, expectedParams: any) {
|
||||
/*
|
||||
Do some additional error checking
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
return (request: any) => {
|
||||
// if URL is bogus, reject the promise
|
||||
const url = new URL(request.url);
|
||||
if (!url.pathname.endsWith(expectedURL)) {
|
||||
return Promise.reject(new Error("Unexpected URL!"));
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const params = Array.from((url.searchParams as any).entries()).sort(
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '(a: unknown, b: unknown) => bool... Remove this comment to see the full error message
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(a, b) => (a as any)[0] < (b as any)[0]
|
||||
);
|
||||
expectedParams = expectedParams
|
||||
.slice()
|
||||
.slice() // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.sort((a: any, b: any) => a[0] < b[0]);
|
||||
|
||||
if (
|
||||
params.length !== expectedParams.length ||
|
||||
!params.every(
|
||||
(p, i) =>
|
||||
(p as any)[0] === expectedParams[i][0] &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(p as any)[0] === expectedParams[i][0] && // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(p as any)[1] === expectedParams[i][1]
|
||||
)
|
||||
) {
|
||||
@@ -222,9 +241,11 @@ export function withExpected(expectedURL: any, expectedParams: any) {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
export function annotationsObs(names: any) {
|
||||
return withExpected(
|
||||
"/annotations/obs",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
names.map((name: any) => ["annotation-name", name])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -219,13 +219,16 @@ describe("whereCache", () => {
|
||||
})
|
||||
);
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
expect((wc.where as any).field.queryField.has("queryColumn")).toEqual(true);
|
||||
expect(
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(wc.where as any).field.queryField.get("queryColumn")
|
||||
).toBeInstanceOf(Map);
|
||||
expect(
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(wc.where as any).field.queryField.get("queryColumn").has("queryValue")
|
||||
).toEqual(true);
|
||||
expect(_whereCacheGet(wc, schema, "field", query)).toEqual([0, 1, 2]);
|
||||
|
||||
@@ -8,8 +8,11 @@ import { indexEntireSchema } from "../../src/util/stateManager/schemaHelpers";
|
||||
import { _normalizeCategoricalSchema } from "../../src/annoMatrix/schema";
|
||||
|
||||
describe("centroid", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let schema: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let obsAnnotations: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let obsLayout: any;
|
||||
|
||||
beforeAll(() => {
|
||||
@@ -44,6 +47,7 @@ describe("centroid", () => {
|
||||
quantile([0.5], obsLayout.col("umap_1").asArray())[0],
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
centroidResult.forEach((coordinate: any) => {
|
||||
expect(coordinate).toEqual(expectedResult);
|
||||
});
|
||||
@@ -68,6 +72,7 @@ describe("centroid", () => {
|
||||
quantile([0.5], obsLayout.col("umap_1").asArray())[0],
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
centroidResult.forEach((coordinate: any) => {
|
||||
expect(coordinate).toEqual(expectedResult);
|
||||
});
|
||||
|
||||
@@ -811,6 +811,7 @@ describe("dataframe factories", () => {
|
||||
new Float64Array(3).fill(1.1),
|
||||
]
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const dfB = dfA.mapColumns((col: any, idx: any) => {
|
||||
expect(dfA.icol(idx).asArray()).toBe(col);
|
||||
return col;
|
||||
@@ -869,6 +870,7 @@ describe("dataframe factories", () => {
|
||||
});
|
||||
|
||||
describe("dataframe col", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let df: any = null;
|
||||
beforeEach(() => {
|
||||
df = new Dataframe.Dataframe(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as Dataframe from "../../../src/util/dataframe";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function float32Conversion(f: any) {
|
||||
return new Float32Array([f])[0];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import PromiseLimit from "../../src/util/promiseLimit";
|
||||
import { range } from "../../src/util/range";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const delay = (t: any) => new Promise((resolve) => setTimeout(resolve, t));
|
||||
|
||||
describe("PromiseLimit", () => {
|
||||
@@ -52,6 +53,7 @@ describe("PromiseLimit", () => {
|
||||
};
|
||||
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 1.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
await Promise.all(range(10).map((i: any) => plimit.add(() => callback(i))));
|
||||
|
||||
expect(maxRunning).toEqual(2);
|
||||
|
||||
@@ -125,6 +125,7 @@ describe("categorical color helpers", () => {
|
||||
Array.from(schema.annotations.obsByName.categoricalColumn.categories)
|
||||
);
|
||||
const userDefinedColorTable = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
categoricalColumn: shuffleCats.reduce((acc: any, label: any) => {
|
||||
acc[label] = randRGBColor();
|
||||
return acc;
|
||||
@@ -159,23 +160,29 @@ TODO:
|
||||
2. user defined colors
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function indexSchema(schema: any) {
|
||||
schema.annotations.obsByName = Object.fromEntries(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
schema.annotations?.obs?.columns?.map((v: any) => [v.name, v]) ?? []
|
||||
);
|
||||
schema.annotations.varByName = Object.fromEntries(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
schema.annotations?.var?.columns?.map((v: any) => [v.name, v]) ?? []
|
||||
);
|
||||
schema.layout.obsByName = Object.fromEntries(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
schema.layout?.obs?.map((v: any) => [v.name, v]) ?? []
|
||||
);
|
||||
schema.layout.varByName = Object.fromEntries(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
schema.layout?.var?.map((v: any) => [v.name, v]) ?? []
|
||||
);
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function makeScale(rgb: any) {
|
||||
// make a scale string from a rgb float triple
|
||||
return `rgb(${(rgb[0] * 255) >>> 0}, ${(rgb[1] * 255) >>> 0}, ${
|
||||
@@ -183,6 +190,7 @@ function makeScale(rgb: any) {
|
||||
})`;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function shuffle(array: any) {
|
||||
for (let i = array.length - 1; i > 0; i -= 1) {
|
||||
const j = (Math.random() * (i + 1)) >>> 0;
|
||||
|
||||
@@ -107,8 +107,11 @@ const anAnnotationsVarJSONResponse = {
|
||||
.value(),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function encodeTypedArray(builder: any, uType: any, uData: any) {
|
||||
// @ts-expect-error --- FIXME: Element implicitly has an 'any' type.
|
||||
const uTypeName = NetEncoding.TypedArray[uType];
|
||||
// @ts-expect-error --- FIXME: Element implicitly has an 'any' type.
|
||||
const ArrayType = NetEncoding[uTypeName];
|
||||
const dv = ArrayType.createDataVector(builder, uData);
|
||||
builder.startObject(1);
|
||||
@@ -116,6 +119,7 @@ function encodeTypedArray(builder: any, uType: any, uData: any) {
|
||||
return builder.endObject();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function encodeMatrix(columns: any, colIndex = undefined) {
|
||||
/*
|
||||
IMPORTANT: this is not a general purpose encoder. in particular,
|
||||
|
||||
@@ -126,6 +126,7 @@ const someData = [
|
||||
},
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let payments: any = null;
|
||||
beforeEach(() => {
|
||||
payments = new Crossfilter(someData);
|
||||
@@ -141,6 +142,7 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
.addDimension(
|
||||
"quantity",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].quantity,
|
||||
Int32Array
|
||||
)
|
||||
@@ -163,6 +165,7 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
const p2 = payments.addDimension(
|
||||
"quantity",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, data: any) => data[i].quantity,
|
||||
Int32Array
|
||||
);
|
||||
@@ -183,16 +186,18 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
.addDimension(
|
||||
"quantity",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].quantity,
|
||||
Int32Array
|
||||
)
|
||||
) // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.addDimension("tip", "scalar", (i: any, d: any) => d[i].tip, Float32Array)
|
||||
.addDimension(
|
||||
"total",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].total,
|
||||
Float32Array
|
||||
)
|
||||
) // eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
.addDimension("type", "enum", (i: any, d: any) => d[i].type);
|
||||
expect(p).toBeDefined();
|
||||
|
||||
@@ -245,18 +250,21 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
});
|
||||
|
||||
describe("scalar dimension", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let p: any;
|
||||
beforeEach(() => {
|
||||
p = payments
|
||||
.addDimension(
|
||||
"quantity",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].quantity,
|
||||
Int32Array
|
||||
)
|
||||
.addDimension(
|
||||
"tip",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].tip,
|
||||
Float32Array
|
||||
)
|
||||
@@ -302,8 +310,10 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
});
|
||||
|
||||
describe("enum dimension", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let p: any;
|
||||
beforeEach(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
p = payments.addDimension("type", "enum", (i: any, d: any) => d[i].type);
|
||||
});
|
||||
|
||||
@@ -342,6 +352,7 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
});
|
||||
|
||||
describe("spatial dimension", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let p: any;
|
||||
beforeEach(() => {
|
||||
const X = someData.map((r) => r.coords[0]);
|
||||
@@ -431,18 +442,21 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
});
|
||||
|
||||
describe("non-finite scalars", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let p: any;
|
||||
beforeEach(() => {
|
||||
p = payments
|
||||
.addDimension(
|
||||
"quantity",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].quantity,
|
||||
Int32Array
|
||||
)
|
||||
.addDimension(
|
||||
"nonFinite",
|
||||
"scalar",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(i: any, d: any) => d[i].nonFinite,
|
||||
Float32Array
|
||||
)
|
||||
|
||||
@@ -15,6 +15,7 @@ paths for:
|
||||
const pInf = Number.POSITIVE_INFINITY;
|
||||
const nInf = Number.NEGATIVE_INFINITY;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function fillRange(arr: any, start = 0) {
|
||||
const larr = arr;
|
||||
for (let i = 0, len = larr.length; i < len; i += 1) {
|
||||
@@ -23,6 +24,7 @@ function fillRange(arr: any, start = 0) {
|
||||
return larr;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function fillRand(arr: any) {
|
||||
for (let i = 0, len = arr.length; i < len; i += 1) {
|
||||
arr[i] = Math.random();
|
||||
@@ -140,6 +142,7 @@ describe("sortIndex", () => {
|
||||
const source1 = Type.from([6, 5, 4, 3, 2, 1, 0]);
|
||||
const index1 = fillRange(new Uint32Array(source1.length));
|
||||
expect(sortIndex(index1, source1)).toMatchObject(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
index1.sort((a: any, b: any) => source1[a] - source1[b])
|
||||
);
|
||||
|
||||
@@ -147,12 +150,14 @@ describe("sortIndex", () => {
|
||||
const source2 = Type.from([6, 5, 4, 3, 2, 1]);
|
||||
const index2 = fillRange(new Uint32Array(source2.length));
|
||||
expect(sortIndex(index2, source2)).toMatchObject(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
index2.sort((a: any, b: any) => source1[a] - source1[b])
|
||||
);
|
||||
|
||||
const source3 = fillRand(new Type(1000));
|
||||
const index3 = fillRange(new Uint32Array(source3.length));
|
||||
expect(sortIndex(index3, source3)).toMatchObject(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
index3.sort((a: any, b: any) => source1[a] - source1[b])
|
||||
);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user