From 5aef721b3cb49b0ac5431812a73405ce3ca149f3 Mon Sep 17 00:00:00 2001 From: Artem Niehrieiev Date: Mon, 16 Nov 2026 08:13:16 +0000 Subject: [PATCH] fix(frontend): use Biome 2.6.6, the version of the root configuration The root biome.json uses the 2.6.6 schema and the keys preset, markdown and yaml (4e2152c4f). The frontend still installed Biome 2.4.0, which does not know these keys. So `pnpm lint` failed in CI before it checked a file. - Pin @biomejs/biome 2.6.6 in frontend/package.json and the lockfile. - Exclude public/assets from Biome. Version 2.6 lints standalone SVG files and asks for a title. These files are images that loads, and the alt text gives the accessible name. - Remove five unsafe optional chains in three spec files. A missing element still fails the test. - Apply the 2.6 formatter to three spec files. Lint exit 0, typecheck clean, vitest 2569/2569. Co-Authored-By: Claude Opus 5.5 --- frontend/biome.json | 11 ++- frontend/package.json | 2 +- frontend/pnpm-lock.yaml | 96 +++++++++++-------- .../fields/record-edit/FileEdit.spec.ts | 6 +- .../fields/record-edit/PhoneEdit.spec.ts | 20 ++-- .../components/shared/AppIconPicker.spec.ts | 2 +- frontend/src/components/ui/UiInput.spec.ts | 20 ++-- frontend/src/lib/table-url.spec.ts | 24 ++--- frontend/src/stores/cedar-permissions.spec.ts | 4 +- 9 files changed, 100 insertions(+), 85 deletions(-) diff --git a/frontend/biome.json b/frontend/biome.json index 0868a5bbf..8888cc147 100644 --- a/frontend/biome.json +++ b/frontend/biome.json @@ -1,9 +1,16 @@ { - "$schema": "https://biomejs.dev/schemas/2.4.0/schema.json", + "$schema": "https://biomejs.dev/schemas/2.6.6/schema.json", "root": false, "extends": "//", "files": { - "includes": ["**", "!**/dist", "!**/src/version.ts", "!**/index.saas.html", "!**/storybook-static"] + "includes": [ + "**", + "!**/dist", + "!**/src/version.ts", + "!**/index.saas.html", + "!**/storybook-static", + "!**/public/assets" + ] }, "overrides": [ { diff --git a/frontend/package.json b/frontend/package.json index bc7b153f6..65b08ff26 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -61,7 +61,7 @@ "vuedraggable": "^4.1.0" }, "devDependencies": { - "@biomejs/biome": "2.4.0", + "@biomejs/biome": "2.6.6", "@playwright/test": "^1.64.1", "@storybook/addon-a11y": "^10.6.3", "@storybook/addon-docs": "^10.6.3", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 1d83ff9f7..63ccf37db 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -127,8 +127,8 @@ importers: version: 4.1.0(vue@3.5.43(typescript@5.9.3)) devDependencies: '@biomejs/biome': - specifier: 2.4.0 - version: 2.4.0 + specifier: 2.6.6 + version: 2.6.6 '@playwright/test': specifier: ^1.64.1 version: 1.64.1 @@ -258,59 +258,71 @@ packages: resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==} engines: {node: '>=6.9.0'} - '@biomejs/biome@2.4.0': - resolution: {integrity: sha512-iluT61cORUDIC5i/y42ljyQraCemmmcgbMLLCnYO+yh+2hjTmcMFcwY8G0zTzWCsPb3t3AyKc+0t/VuhPZULUg==} + '@biomejs/biome@2.6.6': + resolution: {integrity: sha512-NCgVJRyrU1+hsW1ILNaRqNAb9fRL4n49bwyef+wjVJQ488/bXbp0BfnNqTTExkiNQT3ugkgYKR1vK8NxsjlNSQ==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@2.4.0': - resolution: {integrity: sha512-L+YpOtPSuU0etomfvFTPWRsa7+8ejaJL3yaROEoT/96HDJbR6OsvZQk0C8JUYou+XFdP+JcGxqZknkp4n934RA==} + '@biomejs/cli-android-arm64@2.6.6': + resolution: {integrity: sha512-bicnqNNxEX7pjkDQaptYvPRIWDfgXJLl/Ok7iZjC+F1AhfReor3FSS7SgPYnOvUy/jf++5U/KYN4T8OKH5rrNA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [android] + + '@biomejs/cli-android-x64@2.6.6': + resolution: {integrity: sha512-N443kDSElF4kDMKjarsL+ymj/ewLA5R9VAdawA7fJ7pwgN3JVDZp0K+xhKBglH8EwsKi2+K8xC6WxXSkgziFfw==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [android] + + '@biomejs/cli-darwin-arm64@2.6.6': + resolution: {integrity: sha512-/vSAqWx3by3p8w5ew+HVJDgguuaTK3U6Fb5gk/oDUH21iWOopm3gOlhT6tZfy5mTaM5R4CVc3uFWkxBtEDrKyw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@2.4.0': - resolution: {integrity: sha512-Aq+S7ffpb5ynTyLgtnEjG+W6xuTd2F7FdC7J6ShpvRhZwJhjzwITGF9vrqoOnw0sv1XWkt2Q1Rpg+hleg/Xg7Q==} + '@biomejs/cli-darwin-x64@2.6.6': + resolution: {integrity: sha512-lLdOAJKbrAoDs+3GvTyVmMW345D9IhrIE3GgoL2eeHwO1boN4VhrSlALtFYsP0p+Jy4udUp4bTguij0qjKrH8w==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@2.4.0': - resolution: {integrity: sha512-1rhDUq8sf7xX3tg7vbnU3WVfanKCKi40OXc4VleBMzRStmQHdeBY46aFP6VdwEomcVjyNiu+Zcr3LZtAdrZrjQ==} + '@biomejs/cli-linux-arm64-musl@2.6.6': + resolution: {integrity: sha512-rw2Vsoi/WZGDyRjMXx9KZH9zsHe79LIzkdWHkLqsIkeKZm6qiGxtiIApxn7cmJSoEPaSvHaH5pRj1FhTcyL/XA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: [musl] - '@biomejs/cli-linux-arm64@2.4.0': - resolution: {integrity: sha512-u2p54IhvNAWB+h7+rxCZe3reNfQYFK+ppDw+q0yegrGclFYnDPZAntv/PqgUacpC3uxTeuWFgWW7RFe3lHuxOA==} + '@biomejs/cli-linux-arm64@2.6.6': + resolution: {integrity: sha512-UzJdUCg9dbEGpZOuZRyehEPrnwKjx9z4Um7sWLG5x6txu7UjeWdJZuBXVGlyAdD39w2Hx0nZeK1jKC4NFUTCNQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: [glibc] - '@biomejs/cli-linux-x64-musl@2.4.0': - resolution: {integrity: sha512-Omo0xhl63z47X+CrE5viEWKJhejJyndl577VoXg763U/aoATrK3r5+8DPh02GokWPeODX1Hek00OtjjooGan9w==} + '@biomejs/cli-linux-x64-musl@2.6.6': + resolution: {integrity: sha512-DiKejs+GnFbOVQsBnukUpiB+T13tqUDFGwwjsTq51vatAsaflzFzVD0BOgjVUGRrqKgE0K0Xf+wNtkcmdN2chw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: [musl] - '@biomejs/cli-linux-x64@2.4.0': - resolution: {integrity: sha512-WVFOhsnzhrbMGOSIcB9yFdRV2oG2KkRRhIZiunI9gJqSU3ax9ErdnTxRfJUxZUI9NbzVxC60OCXNcu+mXfF/Tw==} + '@biomejs/cli-linux-x64@2.6.6': + resolution: {integrity: sha512-l8/aPXc1cz8VpUyd4hb5Pm5zx+X3voQBks4aLYbp5pC8KSchuHyvqDfY5xax39qCHomI/2xn6NKEot+zebG38g==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: [glibc] - '@biomejs/cli-win32-arm64@2.4.0': - resolution: {integrity: sha512-aqRwW0LJLV1v1NzyLvLWQhdLmDSAV1vUh+OBdYJaa8f28XBn5BZavo+WTfqgEzALZxlNfBmu6NGO6Al3MbCULw==} + '@biomejs/cli-win32-arm64@2.6.6': + resolution: {integrity: sha512-DjVXwQAQeHrO1JEZAEus54k40Tnh4glyU3VFLcDBKwoz0xnxCEnqw6TCMXoujcQMQynWd3AY8bLrbR1o0XNqow==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@2.4.0': - resolution: {integrity: sha512-g47s+V+OqsGxbSZN3lpav6WYOk0PIc3aCBAq+p6dwSynL3K5MA6Cg6nkzDOlu28GEHwbakW+BllzHCJCxnfK5Q==} + '@biomejs/cli-win32-x64@2.6.6': + resolution: {integrity: sha512-B7KMG26A4I9lAuxwBGMmiVcjMGAeJRoz+pzFt9brRvOAsIrgOu8ptJld5rUWui6tM1uiJwxeJhhDPuAiZtxXdw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -3231,39 +3243,47 @@ snapshots: '@babel/helper-string-parser': 7.29.7 '@babel/helper-validator-identifier': 7.29.7 - '@biomejs/biome@2.4.0': + '@biomejs/biome@2.6.6': optionalDependencies: - '@biomejs/cli-darwin-arm64': 2.4.0 - '@biomejs/cli-darwin-x64': 2.4.0 - '@biomejs/cli-linux-arm64': 2.4.0 - '@biomejs/cli-linux-arm64-musl': 2.4.0 - '@biomejs/cli-linux-x64': 2.4.0 - '@biomejs/cli-linux-x64-musl': 2.4.0 - '@biomejs/cli-win32-arm64': 2.4.0 - '@biomejs/cli-win32-x64': 2.4.0 - - '@biomejs/cli-darwin-arm64@2.4.0': + '@biomejs/cli-android-arm64': 2.6.6 + '@biomejs/cli-android-x64': 2.6.6 + '@biomejs/cli-darwin-arm64': 2.6.6 + '@biomejs/cli-darwin-x64': 2.6.6 + '@biomejs/cli-linux-arm64': 2.6.6 + '@biomejs/cli-linux-arm64-musl': 2.6.6 + '@biomejs/cli-linux-x64': 2.6.6 + '@biomejs/cli-linux-x64-musl': 2.6.6 + '@biomejs/cli-win32-arm64': 2.6.6 + '@biomejs/cli-win32-x64': 2.6.6 + + '@biomejs/cli-android-arm64@2.6.6': + optional: true + + '@biomejs/cli-android-x64@2.6.6': + optional: true + + '@biomejs/cli-darwin-arm64@2.6.6': optional: true - '@biomejs/cli-darwin-x64@2.4.0': + '@biomejs/cli-darwin-x64@2.6.6': optional: true - '@biomejs/cli-linux-arm64-musl@2.4.0': + '@biomejs/cli-linux-arm64-musl@2.6.6': optional: true - '@biomejs/cli-linux-arm64@2.4.0': + '@biomejs/cli-linux-arm64@2.6.6': optional: true - '@biomejs/cli-linux-x64-musl@2.4.0': + '@biomejs/cli-linux-x64-musl@2.6.6': optional: true - '@biomejs/cli-linux-x64@2.4.0': + '@biomejs/cli-linux-x64@2.6.6': optional: true - '@biomejs/cli-win32-arm64@2.4.0': + '@biomejs/cli-win32-arm64@2.6.6': optional: true - '@biomejs/cli-win32-x64@2.4.0': + '@biomejs/cli-win32-x64@2.6.6': optional: true '@braintree/sanitize-url@7.1.2': {} diff --git a/frontend/src/components/fields/record-edit/FileEdit.spec.ts b/frontend/src/components/fields/record-edit/FileEdit.spec.ts index 7fd811d48..afaf7390a 100644 --- a/frontend/src/components/fields/record-edit/FileEdit.spec.ts +++ b/frontend/src/components/fields/record-edit/FileEdit.spec.ts @@ -9,7 +9,7 @@ describe('FileEdit', () => { it('defaults to hex and shows the value', () => { const wrapper = mount(FileEdit, { props: { label: 'attachment', value: '48656c6c6f' } }); expect(wrapper.find('textarea').element.value).toBe('48656c6c6f'); - expect((radio(wrapper, 0)?.element as HTMLInputElement).checked).toBe(true); + expect((radio(wrapper, 0)?.element as HTMLInputElement | undefined)?.checked).toBe(true); expect(wrapper.text()).toContain('Attachment'); }); @@ -19,7 +19,7 @@ describe('FileEdit', () => { expect(wrapper.emitted('fieldChange')).toEqual([['48656c6c6f']]); await wrapper.find('textarea').setValue('zz'); expect(wrapper.text()).toContain('Invalid hex.'); - expect((radio(wrapper, 1)?.element as HTMLInputElement).disabled).toBe(true); + expect((radio(wrapper, 1)?.element as HTMLInputElement | undefined)?.disabled).toBe(true); }); it('converts hex to base64 when switching to Base64', async () => { @@ -40,7 +40,7 @@ describe('FileEdit', () => { await radio(wrapper, 1)?.setValue(true); await wrapper.find('textarea').setValue('!!!invalid!!!'); expect(wrapper.text()).toContain('Invalid base64.'); - expect((radio(wrapper, 0)?.element as HTMLInputElement).disabled).toBe(true); + expect((radio(wrapper, 0)?.element as HTMLInputElement | undefined)?.disabled).toBe(true); }); it('uses the fixed type from widget params instead of the switcher', () => { diff --git a/frontend/src/components/fields/record-edit/PhoneEdit.spec.ts b/frontend/src/components/fields/record-edit/PhoneEdit.spec.ts index 4ae8879a4..a22813f53 100644 --- a/frontend/src/components/fields/record-edit/PhoneEdit.spec.ts +++ b/frontend/src/components/fields/record-edit/PhoneEdit.spec.ts @@ -51,17 +51,15 @@ describe('PhoneEdit', () => { }); describe('US formatting', () => { - it.each([ - ['(202) 456-1111'], - ['2024561111'], - ['202.456.1111'], - ['+1 202 456 1111'], - ])('stores %s as E.164', async (typed) => { - const wrapper = mountPhone(''); - await phoneInput(wrapper).setValue(typed); - expect(lastEmitted(wrapper)).toBe('+12024561111'); - wrapper.unmount(); - }); + it.each([['(202) 456-1111'], ['2024561111'], ['202.456.1111'], ['+1 202 456 1111']])( + 'stores %s as E.164', + async (typed) => { + const wrapper = mountPhone(''); + await phoneInput(wrapper).setValue(typed); + expect(lastEmitted(wrapper)).toBe('+12024561111'); + wrapper.unmount(); + }, + ); it('formats as you type', async () => { const wrapper = mountPhone(''); diff --git a/frontend/src/components/shared/AppIconPicker.spec.ts b/frontend/src/components/shared/AppIconPicker.spec.ts index e95d1aadd..7c4bc83cb 100644 --- a/frontend/src/components/shared/AppIconPicker.spec.ts +++ b/frontend/src/components/shared/AppIconPicker.spec.ts @@ -47,7 +47,7 @@ describe('AppIconPicker', () => { const radios = wrapper.findAll('input[type="radio"]'); expect(radios.map((radio) => (radio.element as HTMLInputElement).value)).toEqual(ICONS); - expect((radios[2]?.element as HTMLInputElement).checked).toBe(true); + expect((radios[2]?.element as HTMLInputElement | undefined)?.checked).toBe(true); expect(wrapper.findAll('.app-icon-picker__option')[0]?.text()).toContain('star'); }); diff --git a/frontend/src/components/ui/UiInput.spec.ts b/frontend/src/components/ui/UiInput.spec.ts index 18aeec92a..1137c9ec0 100644 --- a/frontend/src/components/ui/UiInput.spec.ts +++ b/frontend/src/components/ui/UiInput.spec.ts @@ -8,20 +8,12 @@ describe('UiInput', () => { expect(mount(UiInput).get('input').attributes('type')).toBe('text'); }); - it.each([ - 'email', - 'password', - 'url', - 'search', - 'tel', - 'number', - 'date', - 'time', - 'datetime-local', - 'color', - ] as const)('renders type %s natively', (type) => { - expect(mount(UiInput, { props: { type } }).get('input').attributes('type')).toBe(type); - }); + it.each(['email', 'password', 'url', 'search', 'tel', 'number', 'date', 'time', 'datetime-local', 'color'] as const)( + 'renders type %s natively', + (type) => { + expect(mount(UiInput, { props: { type } }).get('input').attributes('type')).toBe(type); + }, + ); it('round-trips a string through v-model', async () => { const wrapper = mount(UiInput, { props: { modelValue: 'a' } }); diff --git a/frontend/src/lib/table-url.spec.ts b/frontend/src/lib/table-url.spec.ts index 36909e7f9..4c8b646d3 100644 --- a/frontend/src/lib/table-url.spec.ts +++ b/frontend/src/lib/table-url.spec.ts @@ -9,19 +9,15 @@ describe('tablePagePath', () => { expect(tablePagePath('c1', 'users', 'entry')).toBe('/dashboard/c1/users/entry'); }); - it.each([ - 'a?b', - 'a#b', - '50%off', - 'public.my table', - 'a/b', - 'таблица', - ])('round-trips the table name %s through the router', (tableName) => { - const router = createRouter({ history: createMemoryHistory(), routes }); - const route = router.resolve({ path: tablePagePath('c1', tableName, 'entry'), query: { id: '1' } }); + it.each(['a?b', 'a#b', '50%off', 'public.my table', 'a/b', 'таблица'])( + 'round-trips the table name %s through the router', + (tableName) => { + const router = createRouter({ history: createMemoryHistory(), routes }); + const route = router.resolve({ path: tablePagePath('c1', tableName, 'entry'), query: { id: '1' } }); - expect(route.name).toBe('row-edit'); - expect(route.params).toEqual({ connectionId: 'c1', tableName }); - expect(route.query).toEqual({ id: '1' }); - }); + expect(route.name).toBe('row-edit'); + expect(route.params).toEqual({ connectionId: 'c1', tableName }); + expect(route.query).toEqual({ id: '1' }); + }, + ); }); diff --git a/frontend/src/stores/cedar-permissions.spec.ts b/frontend/src/stores/cedar-permissions.spec.ts index 8fd3ac378..ecfa32dca 100644 --- a/frontend/src/stores/cedar-permissions.spec.ts +++ b/frontend/src/stores/cedar-permissions.spec.ts @@ -79,7 +79,9 @@ function evaluate(permission: ComputedRef): boolean | null { } function staticPolicies(mock: Mock): string { - return (mock.mock.calls.at(-1)?.[0] as { policies: { staticPolicies: string } }).policies.staticPolicies; + const call = mock.mock.calls.at(-1); + if (!call) throw new Error('The mock has no call.'); + return (call[0] as { policies: { staticPolicies: string } }).policies.staticPolicies; } describe('createPermissionEvaluator', () => {