Skip to content

Commit

Permalink
Disable some newly enabled test lints
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Sep 27, 2023
1 parent 0e9086e commit 7ee43a9
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 87 deletions.
4 changes: 4 additions & 0 deletions packages/preact/preact/tests/create.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
// @vitest-environment jsdom

import { install, setup } from "@starbeam/preact";
Expand Down
4 changes: 4 additions & 0 deletions packages/preact/preact/tests/reactive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
// @vitest-environment jsdom

import { install, setupReactive, useReactive } from "@starbeam/preact";
Expand Down
4 changes: 4 additions & 0 deletions packages/preact/preact/tests/resources.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
// @vitest-environment jsdom

import { install, setupResource, useResource } from "@starbeam/preact";
Expand Down
4 changes: 4 additions & 0 deletions packages/preact/preact/tests/services.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
// @vitest-environment jsdom

import { install, useService } from "@starbeam/preact";
Expand Down
4 changes: 4 additions & 0 deletions packages/preact/preact/tests/sync.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
// @vitest-environment jsdom

import { install, setupSync } from "@starbeam/preact";
Expand Down
3 changes: 1 addition & 2 deletions packages/react/react/src/polyfill.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
if (typeof process === "undefined") {
// eslint-disable-next-line
globalThis.process = {} as any;
globalThis.process = {} as never;
}

export {};
15 changes: 8 additions & 7 deletions packages/react/test-utils/src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ export const react = {
render,
} as const;

/* eslint-disable */
export const html: HtmlProxy = new Proxy(() => {}, {
get: (target, property, receiver) => {
get: (target, property, _receiver) => {
if (typeof property === "symbol") {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Reflect.get(target, property);
}

return (...args: any[]) => {
if (isReactNode(args[0])) {
return (...args: never[]) => {
const [node] = args;

if (isReactNode(node)) {
return createElement(property, null, ...args);
} else {
const [props, ...children] = args;
Expand All @@ -79,13 +81,12 @@ export const html: HtmlProxy = new Proxy(() => {}, {
};
},

apply: (target, receiver, args) => {},
apply: (_target, _receiver, _args) => {},
}) as unknown as HtmlProxy;
/* eslint-enable */

export function el(
tag: string | FunctionComponent,
children: ReactNode[]
children: ReactNode[],
): JSX.Element {
return createElement(tag, null, ...children);
}
10 changes: 5 additions & 5 deletions packages/universal/collections/src/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Shadow<T> {
private constructor(
fns: Map<string, Fn>,
target: T[],
collection: Collection<number>
collection: Collection<number>,
) {
this.#fns = fns;
this.#target = target;
Expand All @@ -103,7 +103,7 @@ class Shadow<T> {
this.#collection.get(
index,
index in this.#target ? "hit" : "miss",
member(index)
member(index),
);
this.#collection.iterateKeys();

Expand All @@ -123,7 +123,7 @@ class Shadow<T> {
}`,
});
this.#collection.iterateKeys();
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
return (this.#target as any)[methodName](...args);
};

Expand All @@ -147,7 +147,7 @@ class Shadow<T> {
});
const prev = this.#target.length;

// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
const result = (this.#target as any)[methodName](...args);

const next = this.#target.length;
Expand All @@ -156,7 +156,7 @@ class Shadow<T> {
this.#collection.splice();
}

// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return result;
};
}
Expand Down
10 changes: 5 additions & 5 deletions packages/universal/collections/src/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const cached = <T>(
target: object,
key: symbol | string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
descriptor: TypedPropertyDescriptor<any>
descriptor: TypedPropertyDescriptor<any>,
): void => {
// const { get, enumerable = true, configurable = true } = descriptor;

Expand All @@ -17,8 +17,8 @@ export const cached = <T>(
expected(`the target of @cached`)
.toBe(`a getter`)
.butGot(() =>
typeof descriptor.value === "function" ? `a method` : `a field`
)
typeof descriptor.value === "function" ? `a method` : `a field`,
),
);

const CACHED = new WeakMap<object, FormulaFn<T>>();
Expand All @@ -33,9 +33,9 @@ export const cached = <T>(

if (!formula) {
formula = CachedFormula(
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
() => get.call(this),
{ description: `computing ${String(key)}` }
{ description: `computing ${String(key)}` },
);
CACHED.set(this, formula);
}
Expand Down
37 changes: 18 additions & 19 deletions packages/universal/debug/src/description/debug/describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function getFullName(description: DescriptionDetails): FullName {
let parent = base.parent;
const path: Nesting[] = [base];

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
while (true) {
const next = getBase(parent);

Expand Down Expand Up @@ -151,7 +150,7 @@ function getIdString(id: ReactiveId, accum = "", nested = false): string {
}

export const getUserFacing = (<D extends DescriptionDetails | undefined>(
description: D
description: D,
): D => {
if (description?.nesting?.type === "implementation") {
return getUserFacing(description.nesting.parent) as D;
Expand All @@ -170,23 +169,23 @@ if (import.meta.vitest) {
expect(getIdString(["a", "b", "c"])).toEqual("a/b/c");
expect(getIdString(["a", ["b", "c"], "d"])).toEqual("a->(b/c)->d");
expect(getIdString(["a", ["b", "c"], ["d", "e"]])).toEqual(
"a->(b/c)->(d/e)"
"a->(b/c)->(d/e)",
);
expect(
getIdString([
["a", "b"],
["c", "d"],
])
]),
).toEqual("(a/b)->(c/d)");
expect(getIdString(["a", ["b", "c"], ["d", "e"], "f"])).toEqual(
"a->(b/c)->(d/e)->f"
"a->(b/c)->(d/e)->f",
);
expect(getIdString(["a", ["b", "c"], ["d", "e"], ["f", "g"]])).toEqual(
"a->(b/c)->(d/e)->(f/g)"
"a->(b/c)->(d/e)->(f/g)",
);
// multiple levels of nesting
expect(getIdString(["a", ["b", ["c", "d"], "e"], "f"])).toEqual(
"a->(b->(c/d)->e)->f"
"a->(b->(c/d)->e)->f",
);
});

Expand Down Expand Up @@ -218,29 +217,29 @@ if (import.meta.vitest) {

test("describeFlat", () => {
expect(describeFlat({ type: "specified", value: "mycell" })).toEqual(
"mycell"
"mycell",
);
const id = getID();
expect(
describeFlat({
type: "anonymous",
kind: "cell",
id,
})
}),
).toEqual(`{anonymous cell:${id}}`);
});

test("describeFullName", () => {
expect(describeFullName({ type: "specified", value: "mycell" })).toEqual(
"mycell"
"mycell",
);
const id = getID();
expect(
describeFullName({
type: "anonymous",
kind: "cell",
id,
})
}),
).toEqual(`{anonymous cell:${id}}`);

const parentId = getID();
Expand Down Expand Up @@ -268,13 +267,13 @@ if (import.meta.vitest) {
} satisfies DescriptionDetails;

expect(describeFullName(getFullName(child))).toEqual(
"mycell->{impl: initialized?}"
"mycell->{impl: initialized?}",
);
expect(
describeFullName([
{ type: "specified", value: "mycell" },
{ type: "implementation", value: { name: "initialized?", reason: "" } },
])
]),
).toEqual("mycell->{impl: initialized?}");

const specified = {
Expand All @@ -289,32 +288,32 @@ if (import.meta.vitest) {
} satisfies Anonymous;

expect(describeFullName([anonymous, { type: "index", value: 2 }])).toEqual(
"{anonymous cell:1}[2]"
"{anonymous cell:1}[2]",
);
expect(describeFullName([specified, { type: "index", value: 2 }])).toEqual(
"mycell[2]"
"mycell[2]",
);

expect(
describeFullName([
anonymous,
{ type: "key", value: { name: "foo", key: {} } },
])
]),
).toEqual("{anonymous cell:1}.get(foo)");

expect(
describeFullName([
specified,
{ type: "key", value: { name: "foo", key: {} } },
])
]),
).toEqual("mycell.get(foo)");

expect(
describeFullName([anonymous, { type: "property", value: "foo" }])
describeFullName([anonymous, { type: "property", value: "foo" }]),
).toEqual("{anonymous cell:1}.foo");

expect(
describeFullName([specified, { type: "property", value: "foo" }])
describeFullName([specified, { type: "property", value: "foo" }]),
).toEqual("mycell.foo");
});

Expand Down
7 changes: 3 additions & 4 deletions packages/universal/verify/src/assertions/describe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export function format(value: unknown): string {
/* eslint-disable */
switch (typeof value) {
case "boolean":
case "number":
Expand All @@ -15,9 +14,9 @@ export function format(value: unknown): string {
// if it's an ES6 class; detect by using F.p.toString and looking for class
if (fn.startsWith("class")) {
return `{class ${value.name}}`;
} else if (fn.match(/^function\s*[*]/)) {
} else if (/^function\s*[*]/.exec(fn)) {
return `{function* ${value.name}}`;
} else if (fn.match(/^async\s+function/)) {
} else if (/^async\s+function/.exec(fn)) {
return `{async function ${value.name}}`;
} else if (value.name) {
return `{${value.name}`;
Expand All @@ -30,6 +29,7 @@ export function format(value: unknown): string {
return `null`;
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const proto = Object.getPrototypeOf(value);

if (proto === null || proto === Object.prototype) {
Expand All @@ -44,5 +44,4 @@ export function format(value: unknown): string {
}
}
}
/* eslint-enable */
}
Loading

0 comments on commit 7ee43a9

Please sign in to comment.