1
0

fix frontend lint errors

This commit is contained in:
Hazelnoot
2025-04-02 10:57:35 -04:00
parent 33b9f998da
commit 74d301dcf1
13 changed files with 54 additions and 41 deletions
+5 -4
View File
@@ -3,10 +3,10 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { registerAsUiLib } from '@/aiscript/ui.js';
import { errors, Interpreter, Parser, values } from '@syuilo/aiscript';
import { describe, expect, test } from 'vitest';
import { type Ref, ref } from 'vue';
import { ref } from 'vue';
import type { Ref } from 'vue';
import type {
AsUiButton,
AsUiButtons,
@@ -20,6 +20,7 @@ import type {
AsUiTextarea,
AsUiTextInput,
} from '@/aiscript/ui.js';
import { registerAsUiLib } from '@/aiscript/ui.js';
type ExeResult = {
root: AsUiRoot;
@@ -39,8 +40,8 @@ async function exe(script: string): Promise<ExeResult> {
{
out: (value) => {
outputs.push(value);
}
}
},
},
);
const ast = Parser.parse(script);
await interpreter.exec(ast);
+3 -2
View File
@@ -4,9 +4,10 @@
*/
import { describe, test, assert, afterEach } from 'vitest';
import { render, cleanup, type RenderResult } from '@testing-library/vue';
import { preferState } from './init.js';
import { render, cleanup } from '@testing-library/vue';
import { getEmojiName } from '@@/js/emojilist.js';
import { preferState } from './init.js';
import type { RenderResult } from '@testing-library/vue';
import { components } from '@/components/index.js';
import { directives } from '@/directives/index.js';
import MkEmoji from '@/components/global/MkEmoji.vue';
+6 -5
View File
@@ -4,9 +4,10 @@
*/
import { afterEach, assert, describe, test } from 'vitest';
import { cleanup, render, type RenderResult } from '@testing-library/vue';
import './init';
import * as Misskey from 'misskey-js';
import { cleanup, render } from '@testing-library/vue';
import type { RenderResult } from '@testing-library/vue';
import './init';
import { directives } from '@/directives/index.js';
import { components } from '@/components/index.js';
import XHome from '@/pages/user/home.vue';
@@ -15,7 +16,7 @@ import 'intersection-observer';
describe('XHome', () => {
const renderHome = (user: Partial<Misskey.entities.UserDetailed>): RenderResult => {
return render(XHome, {
props: { user, disableNotes: true },
props: { user: user as Misskey.entitites.UserDetailed, disableNotes: true },
global: { directives, components },
});
};
@@ -41,7 +42,7 @@ describe('XHome', () => {
const anchor = home.container.querySelector<HTMLAnchorElement>('a[href^="https://example.com/"]');
assert.exists(anchor, 'anchor to the remote exists');
assert.strictEqual(anchor?.href, 'https://example.com/@user/profile');
assert.strictEqual(anchor.href, 'https://example.com/@user/profile');
});
test('The remote caution should fall back to uri if url is null', async () => {
@@ -61,6 +62,6 @@ describe('XHome', () => {
const anchor = home.container.querySelector<HTMLAnchorElement>('a[href^="https://example.com/"]');
assert.exists(anchor, 'anchor to the remote exists');
assert.strictEqual(anchor?.href, 'https://example.com/@user');
assert.strictEqual(anchor.href, 'https://example.com/@user');
});
});
+3 -2
View File
@@ -4,9 +4,10 @@
*/
import { describe, test, assert, afterEach } from 'vitest';
import { render, cleanup, type RenderResult } from '@testing-library/vue';
import './init';
import * as Misskey from 'misskey-js';
import { render, cleanup } from '@testing-library/vue';
import type { RenderResult } from '@testing-library/vue';
import './init';
import { components } from '@/components/index.js';
import { directives } from '@/directives/index.js';
import MkMediaImage from '@/components/MkMediaImage.vue';
+14 -13
View File
@@ -4,7 +4,8 @@
*/
import { describe, test, assert, afterEach } from 'vitest';
import { render, cleanup, type RenderResult } from '@testing-library/vue';
import { render, cleanup } from '@testing-library/vue';
import type { RenderResult } from '@testing-library/vue';
import './init';
import type { summaly } from '@misskey-dev/summaly';
import { components } from '@/components/index.js';
@@ -35,7 +36,7 @@ describe('MkUrlPreview', () => {
});
const result = render(MkUrlPreview, {
props: { url: summary.url },
props: { url: summary.url as string },
global: { directives, components },
});
@@ -98,9 +99,9 @@ describe('MkUrlPreview', () => {
},
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.src, 'https://example.local/player?autoplay=1&auto_play=1');
assert.strictEqual(iframe.src, 'https://example.local/player?autoplay=1&auto_play=1');
assert.strictEqual(
iframe?.sandbox.toString(),
iframe.sandbox.toString(),
'allow-popups allow-popups-to-escape-sandbox allow-scripts allow-storage-access-by-user-activation allow-same-origin',
);
});
@@ -116,7 +117,7 @@ describe('MkUrlPreview', () => {
},
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.allow, 'fullscreen;web-share');
assert.strictEqual(iframe.allow, 'fullscreen;web-share');
});
test('A Summaly proxy response without allow falls back to the default', async () => {
@@ -130,7 +131,7 @@ describe('MkUrlPreview', () => {
},
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.allow, 'autoplay;encrypted-media;fullscreen');
assert.strictEqual(iframe.allow, 'autoplay;encrypted-media;fullscreen');
});
test('Filtering the allow list from the Summaly proxy', async () => {
@@ -144,7 +145,7 @@ describe('MkUrlPreview', () => {
},
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.allow, 'autoplay;fullscreen');
assert.strictEqual(iframe.allow, 'autoplay;fullscreen');
});
test('Having a player width should keep the fixed aspect ratio', async () => {
@@ -158,7 +159,7 @@ describe('MkUrlPreview', () => {
},
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.parentElement?.style.paddingTop, '50%');
assert.strictEqual(iframe.parentElement?.style.paddingTop, '50%');
});
test('Having a player width should keep the fixed height', async () => {
@@ -172,7 +173,7 @@ describe('MkUrlPreview', () => {
},
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.parentElement?.style.paddingTop, '200px');
assert.strictEqual(iframe.parentElement?.style.paddingTop, '200px');
});
test('Loading a tweet in iframe', async () => {
@@ -180,8 +181,8 @@ describe('MkUrlPreview', () => {
url: 'https://twitter.com/i/web/status/1685072521782325249',
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.getAttribute('allow'), 'fullscreen;web-share');
assert.strictEqual(iframe?.getAttribute('sandbox'), 'allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin');
assert.strictEqual(iframe.getAttribute('allow'), 'fullscreen;web-share');
assert.strictEqual(iframe.getAttribute('sandbox'), 'allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin');
});
test('Loading a post in iframe', async () => {
@@ -189,7 +190,7 @@ describe('MkUrlPreview', () => {
url: 'https://x.com/i/web/status/1685072521782325249',
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.getAttribute('allow'), 'fullscreen;web-share');
assert.strictEqual(iframe?.getAttribute('sandbox'), 'allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin');
assert.strictEqual(iframe.getAttribute('allow'), 'fullscreen;web-share');
assert.strictEqual(iframe.getAttribute('sandbox'), 'allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin');
});
});