Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export default defineConfig([
'import-x/first': [2],
'import-x/group-exports': [0],
'import-x/max-dependencies': [0],
'import-x/named': [2],
'import-x/named': [0],
'import-x/namespace': [0],
'import-x/newline-after-import': [0],
'import-x/no-absolute-path': [0],
Expand Down Expand Up @@ -987,7 +987,7 @@ export default defineConfig([
'vitest/require-to-throw-message': [0],
'vitest/require-top-level-describe': [0],
'vitest/valid-describe-callback': [2],
'vitest/valid-expect': [2],
'vitest/valid-expect': [2, {maxArgs: 2}],
'vitest/valid-title': [2],
},
},
Expand Down
8 changes: 6 additions & 2 deletions web_src/js/features/tribute.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {emojiKeys, emojiHTML, emojiString} from './emoji.ts';
import {html, htmlRaw} from '../utils/html.ts';
import type {TributeCollection} from 'tributejs';
import type {MentionValue} from '../types.ts';

export async function attachTribute(element: HTMLElement) {
const {default: Tribute} = await import(/* webpackChunkName: "tribute" */'tributejs');
Expand Down Expand Up @@ -28,7 +29,7 @@ export async function attachTribute(element: HTMLElement) {
},
};

const mentionCollection: TributeCollection<Record<string, any>> = {
const mentionCollection: TributeCollection<MentionValue> = {
values: window.config.mentionValues,
requireLeadingSpace: true,
menuItemTemplate: (item) => {
Expand All @@ -44,7 +45,10 @@ export async function attachTribute(element: HTMLElement) {
};

const tribute = new Tribute({
collection: [emojiCollection as TributeCollection<any>, mentionCollection],
collection: [
emojiCollection as TributeCollection<any>,
mentionCollection as TributeCollection<any>,
],
noMatchTemplate: () => '',
});
tribute.attach(element);
Expand Down
8 changes: 1 addition & 7 deletions web_src/js/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ interface Window {
pageData: Record<string, any>,
notificationSettings: Record<string, any>,
enableTimeTracking: boolean,
mentionValues: Array<{
key: string,
value: string,
name: string,
fullname: string,
avatar: string,
}>,
mentionValues: Array<import('./types.ts').MentionValue>,
mermaidMaxSourceCharacters: number,
i18n: Record<string, string>,
},
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/render/ansi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function renderAnsi(line: string): string {

// handle "\rReading...1%\rReading...5%\rReading...100%",
// convert it into a multiple-line string: "Reading...1%\nReading...5%\nReading...100%"
const lines = [];
const lines: Array<string> = [];
for (const part of line.split('\r')) {
if (part === '') continue;
const partHtml = ansi_up.ansi_to_html(part);
Expand Down
8 changes: 8 additions & 0 deletions web_src/js/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ export type IntervalId = ReturnType<typeof setInterval>;

export type Intent = 'error' | 'warning' | 'info';

export type MentionValue = {
key: string,
value: string,
name: string,
fullname: string,
avatar: string,
};

export type RequestData = string | FormData | URLSearchParams | Record<string, any>;

export type RequestOpts = {
Expand Down
1 change: 0 additions & 1 deletion web_src/js/utils/glob.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ test('GlobCompiler', async () => {
for (const c of golangCases) {
const compiled = globCompile(c.pattern, c.separators);
const msg = `pattern: ${c.pattern}, input: ${c.input}, separators: ${c.separators || '(none)'}, compiled: ${compiled.regexpPattern}`;
// eslint-disable-next-line vitest/valid-expect -- Unlike Jest, Vitest supports a message as the second argument
expect(compiled.regexp.test(c.input), msg).toBe(c.matched);
}

Expand Down