From 70fb0fbaad108ec2453f3259fb824bc72a4f2941 Mon Sep 17 00:00:00 2001 From: eyelidlessness Date: Tue, 17 Dec 2024 09:37:25 -0800 Subject: [PATCH] Fix lint errors introduced by updated eslint etc --- packages/common/src/test/assertions/dom.ts | 1 + .../src/test/assertions/vitest/shared-extension-types.ts | 6 +++--- .../scenario/src/answer/ExpectedApproximateUOMAnswer.ts | 5 +++++ packages/web-forms/e2e/build/style.test.ts | 2 +- packages/web-forms/e2e/build/wf-preview.test.ts | 2 +- packages/web-forms/tests/components/FormPanel.test.ts | 2 +- .../sources/GeoJSONExternalSecondaryInstance.ts | 1 + .../xforms-engine/src/parse/xpath/semantic-analysis.ts | 7 ++++--- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/common/src/test/assertions/dom.ts b/packages/common/src/test/assertions/dom.ts index f77cbafdc..0636f7c5a 100644 --- a/packages/common/src/test/assertions/dom.ts +++ b/packages/common/src/test/assertions/dom.ts @@ -97,6 +97,7 @@ export const expectEqualNode = (actual: Node, expected: Node) => { } else if (isCommentNode(expected)) { expectEqualComment(actual, expected); } else { + // eslint-disable-next-line @typescript-eslint/no-base-to-string -- Intentional fallback throw new Error(`Unhandled expected node: ${String(expected)}`); } }; diff --git a/packages/common/src/test/assertions/vitest/shared-extension-types.ts b/packages/common/src/test/assertions/vitest/shared-extension-types.ts index 909d307e2..1b29efaf2 100644 --- a/packages/common/src/test/assertions/vitest/shared-extension-types.ts +++ b/packages/common/src/test/assertions/vitest/shared-extension-types.ts @@ -72,9 +72,9 @@ export type ExpectExtension = | TypedExpectExtension | UntypedExpectExtension; -export type ExpectExtensionRecord = { - [K in MethodName]: ExpectExtension; -}; +export type ExpectExtensionRecord = Readonly< + Record +>; // prettier-ignore export type DeriveStaticVitestExpectExtension< diff --git a/packages/scenario/src/answer/ExpectedApproximateUOMAnswer.ts b/packages/scenario/src/answer/ExpectedApproximateUOMAnswer.ts index 9e4c0eaad..c68252d4e 100644 --- a/packages/scenario/src/answer/ExpectedApproximateUOMAnswer.ts +++ b/packages/scenario/src/answer/ExpectedApproximateUOMAnswer.ts @@ -22,6 +22,7 @@ export abstract class UOMValue implements CustomInspectable { constructor(readonly unitValue: number) {} + [Symbol.toPrimitive](hint: 'string'): string; [Symbol.toPrimitive](hint: ToPrimitiveHint = 'default'): number | string { const { unitValue } = this; @@ -48,6 +49,10 @@ export abstract class UOMValue implements CustomInspectable { return `${baseResult} (± ${String(errorTolerance)} ${uom})`; } + + toString(): string { + return this[Symbol.toPrimitive]('string'); + } } export class ExpectedApproximateUOMAnswer< diff --git a/packages/web-forms/e2e/build/style.test.ts b/packages/web-forms/e2e/build/style.test.ts index 903ef05de..e5beeadc8 100644 --- a/packages/web-forms/e2e/build/style.test.ts +++ b/packages/web-forms/e2e/build/style.test.ts @@ -36,7 +36,7 @@ test('Build includes component-defined styles', async ({ page }) => { // variable, in OdkWebForm.vue. const colors = ['rgb(255, 0, 0)', 'rgb(0, 255, 0)', 'rgb(0, 0, 255)']; - for await (const color of colors) { + for (const color of colors) { await expect(page.locator('body')).not.toHaveCSS('background-color', color); await page.locator('html').evaluate((pageRoot, gray200) => { diff --git a/packages/web-forms/e2e/build/wf-preview.test.ts b/packages/web-forms/e2e/build/wf-preview.test.ts index 4d6c28df5..9c8510212 100644 --- a/packages/web-forms/e2e/build/wf-preview.test.ts +++ b/packages/web-forms/e2e/build/wf-preview.test.ts @@ -7,7 +7,7 @@ test('Web Forms Preview: demo forms load', async ({ context, page }) => { expect(formPreviewLinks.length).toBeGreaterThan(0); - for await (const link of formPreviewLinks) { + for (const link of formPreviewLinks) { const [previewPage] = await Promise.all([context.waitForEvent('page'), link.click()]); await previewPage.waitForSelector( diff --git a/packages/web-forms/tests/components/FormPanel.test.ts b/packages/web-forms/tests/components/FormPanel.test.ts index 4d1599eaa..06919ba2d 100644 --- a/packages/web-forms/tests/components/FormPanel.test.ts +++ b/packages/web-forms/tests/components/FormPanel.test.ts @@ -5,7 +5,7 @@ import { globalMountOptions } from '../helpers'; const mountComponent = (props: PanelProps) => { return mount(FormPanel, { - props, // eslint-disable-line @typescript-eslint/no-unsafe-assignment + props, global: globalMountOptions, }); }; diff --git a/packages/xforms-engine/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts b/packages/xforms-engine/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts index eca660a9c..6101d4599 100644 --- a/packages/xforms-engine/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +++ b/packages/xforms-engine/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts @@ -305,6 +305,7 @@ class GeoJSONSecondaryInstanceFeaturePropertyElement extends StaticElement { const { id = propertiesId } = feature; if (id !== undefined) { + // eslint-disable-next-line @typescript-eslint/no-base-to-string -- Intentional fallback, we don't know what this is and it could be any permutation of JSON yield new this(parent, 'id', String(id)); } diff --git a/packages/xforms-engine/src/parse/xpath/semantic-analysis.ts b/packages/xforms-engine/src/parse/xpath/semantic-analysis.ts index dae48a92a..50b8ecc02 100644 --- a/packages/xforms-engine/src/parse/xpath/semantic-analysis.ts +++ b/packages/xforms-engine/src/parse/xpath/semantic-analysis.ts @@ -396,9 +396,10 @@ const findConstantExpressionNode = (expression: string): ConstantExpressionSynta } }; -type BrandedExpression = Expression & { - readonly [K in Brand]: true; -}; +// prettier-ignore +type BrandedExpression = + & Expression + & Readonly>; const CONSTANT_EXPRESSION = Symbol('CONSTANT_EXPRESSION'); type CONSTANT_EXPRESSION = typeof CONSTANT_EXPRESSION;