diff --git a/.config/tsconfig.base.json b/.config/tsconfig.base.json index 2860c04b..8a0e1e04 100644 --- a/.config/tsconfig.base.json +++ b/.config/tsconfig.base.json @@ -27,6 +27,6 @@ "resolveJsonModule": true, "composite": true, "isolatedModules": true, - "outDir": "dist", + "outDir": "dist" } } diff --git a/bin/cli.mts b/bin/cli.mts index 8e173ece..ad31b0d2 100644 --- a/bin/cli.mts +++ b/bin/cli.mts @@ -107,8 +107,8 @@ function printItems(items: Item[]): void { console.log( ` - hover.text: ${truncate( item.ui.hover?.text.trim().replace(/(\s|\n)+/g, ' '), - 100 - )}` + 100, + )}`, ) } if (item.ai?.content) { @@ -157,7 +157,7 @@ try { config = loadConfig() } catch (e) { usageFatal( - 'Error: invalid OPENCTX_CONFIG env var. Must be one of:\n- JSON object of config\n- Path to JSON config\n- Provider URI\n- Path to provider bundle' + 'Error: invalid OPENCTX_CONFIG env var. Must be one of:\n- JSON object of config\n- Path to JSON config\n- Provider URI\n- Path to provider bundle', ) } diff --git a/bin/package.json b/bin/package.json index 7e80f998..ebbd1efd 100644 --- a/bin/package.json +++ b/bin/package.json @@ -14,9 +14,7 @@ "bin": { "openctx": "dist/cli.mjs" }, - "files": [ - "dist/cli.mjs" - ], + "files": ["dist/cli.mjs"], "scripts": { "openctx": "pnpm run --silent bundle && node --no-warnings=ExperimentalWarning --experimental-network-imports dist/cli.mjs", "bundle": "tsc --build && esbuild --log-level=error --platform=node --bundle --outdir=dist --format=esm --out-extension:.js=.mjs cli.mts", diff --git a/biome.json b/biome.json index 3382abb6..31016231 100644 --- a/biome.json +++ b/biome.json @@ -8,17 +8,15 @@ "rules": { "recommended": true, "nursery": { - "useExportType": "error", - "useImportType": "error", - "useGroupedTypeImport": "error", - "noUnusedImports": "error", - "noUnusedPrivateClassMembers": "error", - "noInvalidUseBeforeDeclaration": "error", - "noUselessTernary": "error", "noDuplicateJsonKeys": "error" }, + "correctness": { + "noUnusedImports": "error", + "noUnusedPrivateClassMembers": "error" + }, "suspicious": { - "noExplicitAny": "off" + "noExplicitAny": "off", + "noExportsInTest": "off" }, "style": { "noNonNullAssertion": "off", @@ -38,15 +36,40 @@ "semicolons": "asNeeded", "quoteStyle": "single", "arrowParentheses": "asNeeded", - "trailingComma": "es5" + "trailingCommas": "all" + } + }, + "json": { + "parser": { + "allowComments": true, + "allowTrailingCommas": true + } + }, + "css": { + "parser": { + "cssModules": true + }, + "formatter": { + "enabled": true + }, + "linter": { + "enabled": true } }, "files": { - "ignore": ["node_modules/", "out/", "dist/", "testdata/", ".vscode-test/", ".vscode-test-web/"] + "ignore": [ + "node_modules/", + "out/", + "dist/", + "testdata/", + ".vscode-test/", + ".vscode-test-web/", + "package.json" + ] }, "overrides": [ { - "include": [".vscode/*.json"], + "include": ["./.vscode/*.json", "tsconfig.json"], "json": { "parser": { "allowComments": true, diff --git a/client/browser/src/background/background.main.ts b/client/browser/src/background/background.main.ts index 25f91020..4164c39c 100644 --- a/client/browser/src/background/background.main.ts +++ b/client/browser/src/background/background.main.ts @@ -23,8 +23,8 @@ function getBuiltinProvider(uri: string): Provider { if (!mod) { throw new Error( `Only HTTP endpoint providers and the following built-in providers are supported: ${Object.keys( - BUILTIN_PROVIDER_MODULES - ).join(', ')}. See https://openctx.org/docs/clients/browser-extension#known-issues.` + BUILTIN_PROVIDER_MODULES, + ).join(', ')}. See https://openctx.org/docs/clients/browser-extension#known-issues.`, ) } return mod @@ -44,7 +44,7 @@ function main(): void { subscriptions.add( addMessageListenersForBackgroundApi({ annotationsChanges: (...args) => client.annotationsChanges(...args), - }) + }), ) self.addEventListener('unload', () => subscriptions.unsubscribe(), { once: true }) diff --git a/client/browser/src/browser-extension/web-extension-api/ExtensionStorageSubject.ts b/client/browser/src/browser-extension/web-extension-api/ExtensionStorageSubject.ts index f808d8c1..927e34dd 100644 --- a/client/browser/src/browser-extension/web-extension-api/ExtensionStorageSubject.ts +++ b/client/browser/src/browser-extension/web-extension-api/ExtensionStorageSubject.ts @@ -11,7 +11,7 @@ export class ExtensionStorageSubject { constructor( private key: T, - defaultValue: LocalStorageItems[T] + defaultValue: LocalStorageItems[T], ) { super(subscriber => { subscriber.next(this.value) diff --git a/client/browser/src/browser-extension/web-extension-api/fromBrowserEvent.ts b/client/browser/src/browser-extension/web-extension-api/fromBrowserEvent.ts index 0dff31dc..9ebec028 100644 --- a/client/browser/src/browser-extension/web-extension-api/fromBrowserEvent.ts +++ b/client/browser/src/browser-extension/web-extension-api/fromBrowserEvent.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs' * The handler will always return `void`. */ export const fromBrowserEvent = void>( - emitter: browser.CallbackEventEmitter + emitter: browser.CallbackEventEmitter, ): Observable> => // Do not use fromEventPattern() because of https://github.com/ReactiveX/rxjs/issues/4736 new Observable(subscriber => { diff --git a/client/browser/src/browser-extension/web-extension-api/rpc.ts b/client/browser/src/browser-extension/web-extension-api/rpc.ts index 98fbc337..013f1e32 100644 --- a/client/browser/src/browser-extension/web-extension-api/rpc.ts +++ b/client/browser/src/browser-extension/web-extension-api/rpc.ts @@ -85,11 +85,11 @@ function callBackgroundMethodReturningObservable(method: string, args: unknown[] * Create a proxy for an Observable-returning background API method. */ export function proxyBackgroundMethodReturningObservable( - method: M + method: M, ): BackgroundApi[M] { if (isBackground) { throw new Error( - 'tried to call background service worker function from background service worker itself' + 'tried to call background service worker function from background service worker itself', ) } return (...args: any[]) => @@ -108,7 +108,7 @@ export function addMessageListenersForBackgroundApi(api: BackgroundApi): Unsubsc const handler = ( { streamId, method, args }: RequestMessage, - sender: browser.runtime.MessageSender + sender: browser.runtime.MessageSender, ): Promise => { if (streamId === undefined) { throw new Error('non-Observable-returning RPC calls are not yet implemented') diff --git a/client/browser/src/browser-extension/web-extension-api/storage.ts b/client/browser/src/browser-extension/web-extension-api/storage.ts index f4a80d35..0bc3957f 100644 --- a/client/browser/src/browser-extension/web-extension-api/storage.ts +++ b/client/browser/src/browser-extension/web-extension-api/storage.ts @@ -18,7 +18,7 @@ export const storage: { onChanged: browser.CallbackEventEmitter< ( changes: browser.storage.ChangeDict, - areaName: browser.storage.AreaName + areaName: browser.storage.AreaName, ) => void > } = globalThis.browser && browser.storage @@ -28,7 +28,7 @@ export const observeStorageKey = < K extends keyof ExtensionStorageItems[A], >( areaName: A, - key: K + key: K, ): Observable => { if (platform !== 'chrome-extension' && areaName === 'managed') { // Accessing managed storage throws an error on Firefox and on Safari. @@ -38,8 +38,8 @@ export const observeStorageKey = < // Start with current value of the item defer(() => from( - (storage[areaName] as browser.storage.StorageArea).get(key) - ).pipe(map(items => (items as ExtensionStorageItems[A])[key])) + (storage[areaName] as browser.storage.StorageArea).get(key), + ).pipe(map(items => (items as ExtensionStorageItems[A])[key])), ), // Emit every new value from change events that affect that item fromBrowserEvent(storage.onChanged).pipe( @@ -47,12 +47,12 @@ export const observeStorageKey = < map(([changes]) => changes), filter( ( - changes + changes, ): changes is { [k in K]: browser.storage.StorageChange - } => Object.prototype.hasOwnProperty.call(changes, key) + } => Object.prototype.hasOwnProperty.call(changes, key), ), - map(changes => changes[key].newValue) - ) + map(changes => changes[key].newValue), + ), ) } diff --git a/client/browser/src/browser-extension/web-extension-api/types.ts b/client/browser/src/browser-extension/web-extension-api/types.ts index 46e1728a..97a9d9d1 100644 --- a/client/browser/src/browser-extension/web-extension-api/types.ts +++ b/client/browser/src/browser-extension/web-extension-api/types.ts @@ -30,6 +30,6 @@ export interface BackgroundApi extends Pick, 'annotationsChanges'> export type BackgroundApiHandlers = { [M in keyof BackgroundApi]: ( args: Parameters, - sender: browser.runtime.MessageSender + sender: browser.runtime.MessageSender, ) => ReturnType } diff --git a/client/browser/src/configuration.ts b/client/browser/src/configuration.ts index c1efd199..315fd544 100644 --- a/client/browser/src/configuration.ts +++ b/client/browser/src/configuration.ts @@ -51,10 +51,10 @@ const DEFAULT_CONFIG: ClientConfiguration = { export const configurationStringChanges: Observable = observeStorageKey( 'sync', - 'configuration' + 'configuration', ).pipe( map(c => c ?? { jsonc: JSON.stringify(DEFAULT_CONFIG, null, 2) }), - map(({ jsonc: jsoncStr }) => jsoncStr) + map(({ jsonc: jsoncStr }) => jsoncStr), ) export const configurationChanges: Observable = configurationStringChanges.pipe( @@ -67,5 +67,5 @@ export const configurationChanges: Observable = configurati console.error('Error parsing configuration (as JSONC):', errors) } return obj - }) + }), ) diff --git a/client/browser/src/contentScript/contentScript.main.css b/client/browser/src/contentScript/contentScript.main.css index a1bbe98c..920e0623 100644 --- a/client/browser/src/contentScript/contentScript.main.css +++ b/client/browser/src/contentScript/contentScript.main.css @@ -8,7 +8,7 @@ font-family: system-ui, sans-serif; } -html[data-color-mode='light'] { +html[data-color-mode="light"] { & .octx-chip { background: #00000011; border: solid 1px #00000019; @@ -24,7 +24,7 @@ html[data-color-mode='light'] { } } -html[data-color-mode='dark'] { +html[data-color-mode="dark"] { & .octx-chip { background: #ffffff3a; border: solid 1px #ffffff55; diff --git a/client/browser/src/contentScript/contentScript.main.ts b/client/browser/src/contentScript/contentScript.main.ts index 2e09fcb7..749684a1 100644 --- a/client/browser/src/contentScript/contentScript.main.ts +++ b/client/browser/src/contentScript/contentScript.main.ts @@ -23,8 +23,8 @@ const INJECTORS: Injector[] = [injectOnGitHubCodeView, injectOnGitHubPullRequest const subscription = locationChanges .pipe( mergeMap(location => - combineLatest(INJECTORS.map(injector => injector(location, annotationsChanges))) - ) + combineLatest(INJECTORS.map(injector => injector(location, annotationsChanges))), + ), ) .subscribe() window.addEventListener('unload', () => subscription.unsubscribe()) @@ -38,6 +38,6 @@ function annotationsChanges(params: AnnotationsParams): Observable console.count('itemsChanges count') console.log(items) console.groupEnd() - }) + }), ) } diff --git a/client/browser/src/contentScript/github/codeView.ts b/client/browser/src/contentScript/github/codeView.ts index 4434583f..14484fac 100644 --- a/client/browser/src/contentScript/github/codeView.ts +++ b/client/browser/src/contentScript/github/codeView.ts @@ -16,7 +16,7 @@ import { LINE_CHIPS_CLASSNAME, annsByLine, styledChipListParams } from '../openC */ export function injectOnGitHubCodeView( location: URL, - annotationsChanges: (params: AnnotationsParams) => Observable + annotationsChanges: (params: AnnotationsParams) => Observable, ): Observable { // All GitHub code view URLs contain `/blob/` in the path. (But not all URLs with `/blob/` are code // views, so we still need to check for the presence of DOM elements below. For example, there @@ -57,7 +57,7 @@ export function injectOnGitHubCodeView( console.count('significantCodeViewChanges count') console.log(viewState) console.groupEnd() - }) + }), ), ]).pipe( tap(([anns]) => { @@ -70,9 +70,9 @@ export function injectOnGitHubCodeView( console.timeEnd('redraw') } }), - map(() => undefined) + map(() => undefined), ) - }) + }), ) } @@ -98,7 +98,7 @@ function redraw(anns: Annotation[]): void { if (!lineNumberStr) { throw new Error('unable to determine line number') } - const line = parseInt(lineNumberStr, 10) - 1 + const line = Number.parseInt(lineNumberStr, 10) - 1 const lineAnns = byLine.find(i => i.line === line)?.anns if (lineAnns !== undefined) { @@ -123,7 +123,7 @@ function redraw(anns: Annotation[]): void { const chipList = createChipList( styledChipListParams({ annotations: anns, - }) + }), ) lineEl.append(chipList) } @@ -194,13 +194,13 @@ function isElementInViewport(el: HTMLElement): boolean { function lineNumbersFromReactFileLines(reactFileLineEls: HTMLElement[]): number[] { return reactFileLineEls - .map(el => (el.dataset.lineNumber ? parseInt(el.dataset.lineNumber, 10) - 1 : null)) + .map(el => (el.dataset.lineNumber ? Number.parseInt(el.dataset.lineNumber, 10) - 1 : null)) .filter((line): line is number => line !== null) } function getReactFileLine(lineNumber: number): HTMLDivElement { const el = document.querySelector( - `.react-file-line[data-line-number="${lineNumber + 1}"]` + `.react-file-line[data-line-number="${lineNumber + 1}"]`, ) if (!el) { throw new Error(`no .react-file-line for line number ${lineNumber}`) diff --git a/client/browser/src/contentScript/github/pullRequestFilesView.ts b/client/browser/src/contentScript/github/pullRequestFilesView.ts index 150c81e3..e4c9e8a5 100644 --- a/client/browser/src/contentScript/github/pullRequestFilesView.ts +++ b/client/browser/src/contentScript/github/pullRequestFilesView.ts @@ -26,7 +26,7 @@ import { LINE_CHIPS_CLASSNAME, annsByLine, styledChipListParams } from '../openC */ export function injectOnGitHubPullRequestFilesView( location: URL, - annotationsChanges: (params: AnnotationsParams) => Observable + annotationsChanges: (params: AnnotationsParams) => Observable, ): Observable { // All GitHub PR file view URLs contain `/pull/` and `/files` in the path. if (!location.pathname.includes('/pull/') && !location.pathname.endsWith('/files')) { @@ -56,12 +56,12 @@ export function injectOnGitHubPullRequestFilesView( console.error(error) } }), - map(() => undefined) - ) - ) + map(() => undefined), + ), + ), ) }), - map(() => undefined) + map(() => undefined), ) } @@ -72,7 +72,7 @@ function getChipListElementsAtEndOfLine(lineEl: HTMLElement): HTMLElement[] { lineEl.childNodes.item(lineEl.childNodes.length - 2) as ChildNode | undefined, lineEl.childNodes.item(lineEl.childNodes.length - 1) as ChildNode | undefined, ].filter((el): el is HTMLElement => - Boolean(el instanceof HTMLElement && el.classList.contains(LINE_CHIPS_CLASSNAME)) + Boolean(el instanceof HTMLElement && el.classList.contains(LINE_CHIPS_CLASSNAME)), ) } @@ -95,7 +95,7 @@ function redraw(file: DiffViewFileVersionData, anns: Annotation[]): void { const chipList = createChipList( styledChipListParams({ annotations: lineItems, - }) + }), ) lineEl.append(chipList) } @@ -125,12 +125,12 @@ const clicksThatInvalidateDiffViewData: Observable = fromEvent(document.bo for (const el of els) { el.classList.add('octx-seen') } - }) - ) + }), + ), ), map(() => undefined), - debugTap(() => console.log('clicksThatInvalidateDiffViewData')) + debugTap(() => console.log('clicksThatInvalidateDiffViewData')), ) interface DiffViewData { diff --git a/client/browser/src/contentScript/locationChanges.ts b/client/browser/src/contentScript/locationChanges.ts index 1836fa52..f74d0650 100644 --- a/client/browser/src/contentScript/locationChanges.ts +++ b/client/browser/src/contentScript/locationChanges.ts @@ -31,5 +31,5 @@ export const locationChanges: Observable = new Observable(observer => emitCurrentLocation() }).pipe( distinctUntilChanged((a, b) => a.toString() === b.toString()), - debugTap(url => console.log('locationChanges', url.toString())) + debugTap(url => console.log('locationChanges', url.toString())), ) diff --git a/client/browser/src/contentScript/openCtxUtil.ts b/client/browser/src/contentScript/openCtxUtil.ts index 9308ec14..46e869a0 100644 --- a/client/browser/src/contentScript/openCtxUtil.ts +++ b/client/browser/src/contentScript/openCtxUtil.ts @@ -21,7 +21,7 @@ export function styledChipListParams( params: Omit< Parameters[0], 'className' | 'chipClassName' | 'popoverClassName' - > + >, ): Parameters[0] { return { ...params, diff --git a/client/browser/src/options/OptionsPage.tsx b/client/browser/src/options/OptionsPage.tsx index d8d582ef..7d061227 100644 --- a/client/browser/src/options/OptionsPage.tsx +++ b/client/browser/src/options/OptionsPage.tsx @@ -43,7 +43,7 @@ export const OptionsPage: FunctionComponent = () => { }) } }, - [configuration, pendingConfig] + [configuration, pendingConfig], ) const isDirty = pendingConfig !== undefined && pendingConfig !== configuration @@ -65,7 +65,7 @@ export const OptionsPage: FunctionComponent = () => { onSubmit(event) } }, - [formDisabled, isDirty, onSubmit] + [formDisabled, isDirty, onSubmit], ) return ( diff --git a/client/browser/src/options/options.main.tsx b/client/browser/src/options/options.main.tsx index 6c86f3eb..07e7bf55 100644 --- a/client/browser/src/options/options.main.tsx +++ b/client/browser/src/options/options.main.tsx @@ -12,5 +12,5 @@ document.body.append(root) ReactDOM.createRoot(root).render( - + , ) diff --git a/client/browser/src/types/webextension-polyfill/index.d.ts b/client/browser/src/types/webextension-polyfill/index.d.ts index b6b10d81..17807e7f 100644 --- a/client/browser/src/types/webextension-polyfill/index.d.ts +++ b/client/browser/src/types/webextension-polyfill/index.d.ts @@ -96,7 +96,7 @@ declare namespace browser.bookmarks { query?: string url?: string title?: string - } + }, ): Promise function update(id: string, changes: { title: string; url: string }): Promise @@ -108,7 +108,7 @@ declare namespace browser.bookmarks { parentId: string index: number node: BookmarkTreeNode - } + }, ) => void > const onChanged: CallbackEventEmitter< @@ -117,7 +117,7 @@ declare namespace browser.bookmarks { changeInfo: { title: string url?: string - } + }, ) => void > const onMoved: CallbackEventEmitter< @@ -128,7 +128,7 @@ declare namespace browser.bookmarks { index: number oldParentId: string oldIndex: number - } + }, ) => void > } @@ -297,7 +297,7 @@ declare namespace browser.menus { type?: ItemType visible?: boolean }, - callback?: () => void + callback?: () => void, ): number | string function getTargetElement(targetElementId: number): object | null @@ -322,7 +322,7 @@ declare namespace browser.menus { title?: string type?: ItemType visible?: boolean - } + }, ): Promise const onClicked: CallbackEventEmitter<(info: OnClickData, tab: tabs.Tab) => void> @@ -356,7 +356,7 @@ declare namespace browser.contextualIdentities { name: string color: IdentityColor icon: IdentityIcon - } + }, ): Promise function remove(cookieStoreId: string): Promise } @@ -430,7 +430,7 @@ declare namespace browser.contentScripts { } function register( - contentScriptOptions: RegisteredContentScriptOptions + contentScriptOptions: RegisteredContentScriptOptions, ): Promise } @@ -1210,12 +1210,12 @@ declare namespace browser.runtime { function sendMessage( message: any, - options?: { includeTlsChannelId?: boolean; toProxyScript?: boolean } + options?: { includeTlsChannelId?: boolean; toProxyScript?: boolean }, ): Promise function sendMessage( extensionId: string, message: any, - options?: { includeTlsChannelId?: boolean; toProxyScript?: boolean } + options?: { includeTlsChannelId?: boolean; toProxyScript?: boolean }, ): Promise function sendNativeMessage(application: string, message: object): Promise @@ -1427,7 +1427,7 @@ declare namespace browser.tabs { function duplicate(tabId: number): Promise function executeScript( tabId: number | undefined, - details: extensionTypes.InjectDetails + details: extensionTypes.InjectDetails, ): Promise function get(tabId: number): Promise // deprecated: function getAllInWindow(): x; @@ -1442,7 +1442,7 @@ declare namespace browser.tabs { // }): Promise; function insertCSS( tabId: number | undefined, - details: extensionTypes.InjectDetailsCSS + details: extensionTypes.InjectDetailsCSS, ): Promise function removeCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise function move( @@ -1450,7 +1450,7 @@ declare namespace browser.tabs { moveProperties: { windowId?: number index: number - } + }, ): Promise function print(): Promise function printPreview(): Promise @@ -1476,12 +1476,12 @@ declare namespace browser.tabs { function reload(tabId?: number, reloadProperties?: { bypassCache?: boolean }): Promise function remove(tabIds: number | number[]): Promise function saveAsPDF( - pageSettings: PageSettings + pageSettings: PageSettings, ): Promise<'saved' | 'replaced' | 'canceled' | 'not_saved' | 'not_replaced'> function sendMessage( tabId: number, message: T, - options?: { frameId?: number } + options?: { frameId?: number }, ): Promise // deprecated: function sendRequest(): x; function setZoom(tabId: number | undefined, zoomFactor: number): Promise @@ -1511,7 +1511,7 @@ declare namespace browser.tabs { attachInfo: { newWindowId: number newPosition: number - } + }, ) => void > const onCreated: EventEmitter @@ -1521,7 +1521,7 @@ declare namespace browser.tabs { detachInfo: { oldWindowId: number oldPosition: number - } + }, ) => void > const onHighlighted: EventEmitter<{ windowId: number; tabIds: number[] }> @@ -1532,7 +1532,7 @@ declare namespace browser.tabs { windowId: number fromIndex: number toIndex: number - } + }, ) => void > const onRemoved: CallbackEventEmitter< @@ -1541,7 +1541,7 @@ declare namespace browser.tabs { removeInfo: { windowId: number isWindowClosing: boolean - } + }, ) => void > const onReplaced: CallbackEventEmitter<(addedTabId: number, removedTabId: number) => void> @@ -1558,7 +1558,7 @@ declare namespace browser.tabs { title?: string url?: string }, - tab: Tab + tab: Tab, ) => void > const onZoomChanged: EventEmitter<{ @@ -1607,7 +1607,7 @@ declare namespace browser.webNavigation { callback: (arg: T) => void, filter?: { url: events.UrlFilter[] - } + }, ) => void removeListener: (callback: (arg: T) => void) => void hasListener: (callback: (arg: T) => void) => boolean @@ -1743,7 +1743,7 @@ declare namespace browser.webRequest { addListener: ( callback: (arg: T) => void, filter: RequestFilter, - extraInfoSpec?: U[] + extraInfoSpec?: U[], ) => BlockingResponse | Promise removeListener: (callback: (arg: T) => void) => void hasListener: (callback: (arg: T) => void) => boolean @@ -1953,7 +1953,7 @@ declare namespace browser.windows { getInfo?: { populate?: boolean windowTypes?: WindowType[] - } + }, ): Promise function getCurrent(getInfo?: { populate?: boolean; windowTypes?: WindowType[] }): Promise @@ -1991,7 +1991,7 @@ declare namespace browser.windows { focused?: boolean drawAttention?: boolean state?: WindowState - } + }, ): Promise function remove(windowId: number): Promise diff --git a/client/browser/tsconfig.json b/client/browser/tsconfig.json index a0721e39..870a7264 100644 --- a/client/browser/tsconfig.json +++ b/client/browser/tsconfig.json @@ -6,9 +6,9 @@ "jsx": "react-jsx", "lib": ["ESNext", "DOM"], "types": ["vite/client", "chrome"], - "resolveJsonModule": true, + "resolveJsonModule": true }, "include": ["src", "*.config.ts", "package.json"], "exclude": ["dist"], - "references": [{ "path": "../../lib/client" }, { "path": "../../lib/ui-react" }], + "references": [{ "path": "../../lib/client" }, { "path": "../../lib/ui-react" }] } diff --git a/client/codemirror/demo/tsconfig.json b/client/codemirror/demo/tsconfig.json index 9fa5ca0b..3a8d3aba 100644 --- a/client/codemirror/demo/tsconfig.json +++ b/client/codemirror/demo/tsconfig.json @@ -3,13 +3,13 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["DOM"], + "lib": ["DOM"] }, "include": ["*.ts"], "exclude": ["dist"], "references": [ { - "path": "../", - }, - ], + "path": "../" + } + ] } diff --git a/client/codemirror/package.json b/client/codemirror/package.json index 435eefb9..743f3132 100644 --- a/client/codemirror/package.json +++ b/client/codemirror/package.json @@ -12,11 +12,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "README.md", - "dist", - "!**/*.test.*" - ], + "files": ["README.md", "dist", "!**/*.test.*"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/client/codemirror/src/blockWidget.ts b/client/codemirror/src/blockWidget.ts index 921d53a3..1f1d278f 100644 --- a/client/codemirror/src/blockWidget.ts +++ b/client/codemirror/src/blockWidget.ts @@ -12,7 +12,7 @@ class BlockWidget extends WidgetType { constructor( private readonly anns: Annotation[], private readonly indent: string | undefined, - private readonly config: OpenCtxDecorationsConfig + private readonly config: OpenCtxDecorationsConfig, ) { super() } @@ -43,7 +43,7 @@ class BlockWidget extends WidgetType { function computeDecorations( state: EditorState, anns: Annotation[], - config: OpenCtxDecorationsConfig + config: OpenCtxDecorationsConfig, ): DecorationSet { const builder = new RangeSetBuilder() @@ -66,7 +66,7 @@ function computeDecorations( line.from, Decoration.widget({ widget: new BlockWidget(anns, indent, config), - }) + }), ) } diff --git a/client/codemirror/src/extension.ts b/client/codemirror/src/extension.ts index 3951f2b3..a9f6c0d8 100644 --- a/client/codemirror/src/extension.ts +++ b/client/codemirror/src/extension.ts @@ -13,7 +13,7 @@ export interface OpenCtxDecorationsConfig { indent: string | undefined anns: Annotation[] - } + }, ) => { destroy?: () => void } visibility: boolean diff --git a/client/codemirror/src/useOpenCtxExtension.tsx b/client/codemirror/src/useOpenCtxExtension.tsx index 1260d30b..6bb0b3a4 100644 --- a/client/codemirror/src/useOpenCtxExtension.tsx +++ b/client/codemirror/src/useOpenCtxExtension.tsx @@ -29,7 +29,7 @@ export function useOpenCtxExtension({ chipClassName="octx-chip" popoverClassName="octx-chip-popover" /> - + , ) return { destroy() { @@ -40,6 +40,6 @@ export function useOpenCtxExtension({ }), ] : [], - [visibility, anns] + [visibility, anns], ) } diff --git a/client/codemirror/tsconfig.json b/client/codemirror/tsconfig.json index 16182f20..8e854cf5 100644 --- a/client/codemirror/tsconfig.json +++ b/client/codemirror/tsconfig.json @@ -4,16 +4,16 @@ "rootDir": "src", "outDir": "dist", "jsx": "react-jsx", - "lib": ["DOM"], + "lib": ["DOM"] }, "include": ["src"], "exclude": ["dist"], "references": [ { - "path": "../../lib/client", + "path": "../../lib/client" }, { - "path": "../../lib/ui-react", - }, - ], + "path": "../../lib/ui-react" + } + ] } diff --git a/client/monaco-editor/demo/tsconfig.json b/client/monaco-editor/demo/tsconfig.json index 9fa5ca0b..3a8d3aba 100644 --- a/client/monaco-editor/demo/tsconfig.json +++ b/client/monaco-editor/demo/tsconfig.json @@ -3,13 +3,13 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["DOM"], + "lib": ["DOM"] }, "include": ["*.ts"], "exclude": ["dist"], "references": [ { - "path": "../", - }, - ], + "path": "../" + } + ] } diff --git a/client/monaco-editor/package.json b/client/monaco-editor/package.json index ea53bc2c..0edb5b1a 100644 --- a/client/monaco-editor/package.json +++ b/client/monaco-editor/package.json @@ -12,11 +12,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "README.md", - "dist", - "!**/*.test.*" - ], + "files": ["README.md", "dist", "!**/*.test.*"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/client/monaco-editor/src/index.ts b/client/monaco-editor/src/index.ts index 4121be5e..babd478e 100644 --- a/client/monaco-editor/src/index.ts +++ b/client/monaco-editor/src/index.ts @@ -61,8 +61,8 @@ export function createExtension(client: Client): MonacoExtension { OPEN_URL_COMMAND, (_accessor: unknown, url: string | monaco.Uri) => { window.open(url.toString(), '_blank') - } - ) + }, + ), ) disposables.push( @@ -83,7 +83,7 @@ export function createExtension(client: Client): MonacoExtension { dispose: () => {}, } }, - }) + }), ) return { diff --git a/client/monaco-editor/tsconfig.json b/client/monaco-editor/tsconfig.json index 16182f20..8e854cf5 100644 --- a/client/monaco-editor/tsconfig.json +++ b/client/monaco-editor/tsconfig.json @@ -4,16 +4,16 @@ "rootDir": "src", "outDir": "dist", "jsx": "react-jsx", - "lib": ["DOM"], + "lib": ["DOM"] }, "include": ["src"], "exclude": ["dist"], "references": [ { - "path": "../../lib/client", + "path": "../../lib/client" }, { - "path": "../../lib/ui-react", - }, - ], + "path": "../../lib/ui-react" + } + ] } diff --git a/client/vscode-lib/package.json b/client/vscode-lib/package.json index 50ac0399..18754f74 100644 --- a/client/vscode-lib/package.json +++ b/client/vscode-lib/package.json @@ -11,11 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "README.md", - "dist", - "!**/*.test.*" - ], + "files": ["README.md", "dist", "!**/*.test.*"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/client/vscode-lib/src/configuration.ts b/client/vscode-lib/src/configuration.ts index 11d48ffc..982d7014 100644 --- a/client/vscode-lib/src/configuration.ts +++ b/client/vscode-lib/src/configuration.ts @@ -8,7 +8,7 @@ import * as vscode from 'vscode' */ export function getClientConfiguration( scope?: vscode.ConfigurationScope, - __mock__getConfiguration?: typeof vscode.workspace.getConfiguration + __mock__getConfiguration?: typeof vscode.workspace.getConfiguration, ): ClientConfiguration & { debug?: boolean } { const config = (__mock__getConfiguration ?? vscode.workspace.getConfiguration)('openctx', scope) return { @@ -27,7 +27,7 @@ export function getClientConfiguration( */ function resolveProviderUrisInConfig( config: vscode.WorkspaceConfiguration, - scope?: vscode.ConfigurationScope + scope?: vscode.ConfigurationScope, ): ClientConfiguration['providers'] { const info = config.inspect('providers') if (!info) { @@ -42,7 +42,7 @@ function resolveProviderUrisInConfig( */ function rewriteProviderRelativeFilePaths( providers: ClientConfiguration['providers'], - fromUri?: vscode.Uri + fromUri?: vscode.Uri, ): ClientConfiguration['providers'] { if (!providers || !fromUri) { return undefined @@ -60,7 +60,7 @@ function resolveProviderUrisInConfig( .toString() } return [providerUri, settings] - }) + }), ) } @@ -84,7 +84,7 @@ function resolveProviderUrisInConfig( if (info.workspaceFolderValue) { Object.assign( merged, - rewriteProviderRelativeFilePaths(info.workspaceFolderValue, workspaceFolderSettingsFileUri) + rewriteProviderRelativeFilePaths(info.workspaceFolderValue, workspaceFolderSettingsFileUri), ) } if (info.defaultLanguageValue) { @@ -96,7 +96,7 @@ function resolveProviderUrisInConfig( if (info.workspaceLanguageValue && workspaceFile) { Object.assign( merged, - rewriteProviderRelativeFilePaths(info.workspaceLanguageValue, workspaceFile) + rewriteProviderRelativeFilePaths(info.workspaceLanguageValue, workspaceFile), ) } if (info.workspaceFolderLanguageValue) { @@ -104,8 +104,8 @@ function resolveProviderUrisInConfig( merged, rewriteProviderRelativeFilePaths( info.workspaceFolderLanguageValue, - workspaceFolderSettingsFileUri - ) + workspaceFolderSettingsFileUri, + ), ) } diff --git a/client/vscode-lib/src/controller.ts b/client/vscode-lib/src/controller.ts index 1400a3bf..f3a8d36e 100644 --- a/client/vscode-lib/src/controller.ts +++ b/client/vscode-lib/src/controller.ts @@ -33,11 +33,11 @@ export interface Controller { items: VSCodeClient['items'] observeAnnotations( - doc: Pick + doc: Pick, ): ReturnType annotations( doc: Pick, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): ReturnType } @@ -75,7 +75,7 @@ export function createController({ // Watch for changes that could possibly affect configuration. This is overbroad because it does // not specify a config scope. const configOrSecretsChanged = toEventEmitter( - combineLatest([globalConfigurationChanges, secrets]).pipe(map(() => undefined)) + combineLatest([globalConfigurationChanges, secrets]).pipe(map(() => undefined)), ) disposables.push(configOrSecretsChanged) @@ -95,7 +95,7 @@ export function createController({ ? vscode.Uri.parse(resource) : vscode.workspace.workspaceFolders?.[0]?.uri return observeWorkspaceConfigurationChanges('openctx', scope).pipe( - map(() => getClientConfiguration(scope)) + map(() => getClientConfiguration(scope)), ) }, authInfo: getAuthInfo @@ -118,7 +118,7 @@ export function createController({ // skipIfImplicitAction) const errorReporter = new ErrorReporterController( createErrorNotifier(outputChannel, extensionId, client), - errorLog + errorLog, ) disposables.push(errorReporter) @@ -133,7 +133,7 @@ export function createController({ const clientAnnotations = errorReporter.wrapPromise(UserAction.Implicit, client.annotations) const clientAnnotationsChanges = errorReporter.wrapObservable( UserAction.Implicit, - client.annotationsChanges + client.annotationsChanges, ) /** @@ -158,7 +158,7 @@ export function createController({ uri: doc.uri.toString(), content: doc.getText(), }, - opts + opts, ) }, observeAnnotations(doc: vscode.TextDocument, opts?: ProviderMethodOptions) { @@ -171,7 +171,7 @@ export function createController({ uri: doc.uri.toString(), content: doc.getText(), }, - opts + opts, ) }, } @@ -189,7 +189,7 @@ export function createController({ hoverProvider, quickPickCommand, vscode.languages.registerCodeLensProvider({ scheme: '*' }, codeLensProvider), - vscode.languages.registerHoverProvider({ scheme: '*' }, hoverProvider) + vscode.languages.registerHoverProvider({ scheme: '*' }, hoverProvider), ) } @@ -214,7 +214,7 @@ function makeRange(range: Range): vscode.Range { function createErrorNotifier( outputChannel: vscode.OutputChannel, extensionId: string, - client: Pick + client: Pick, ) { // Fetching the name can be slow or fail. So we use a cache + timeout when // getting the name of a provider. diff --git a/client/vscode-lib/src/ui/editor/codeLens.test.ts b/client/vscode-lib/src/ui/editor/codeLens.test.ts index 8c56868c..32a0410b 100644 --- a/client/vscode-lib/src/ui/editor/codeLens.test.ts +++ b/client/vscode-lib/src/ui/editor/codeLens.test.ts @@ -34,7 +34,7 @@ vi.mock( workspace: { onDidCloseTextDocument: vi.fn(), }, - }) satisfies RecursivePartial + }) satisfies RecursivePartial, ) function fixtureAnn(label: string): EachWithProviderUri[]>[0] { @@ -72,7 +72,7 @@ describe('createCodeLensProvider', () => { return cold[]>>('a', { a: [fixtureAnn('a')], }) - } + }, ) expectObservable(provider.observeCodeLenses(doc)).toBe('a', { a: [ @@ -85,7 +85,7 @@ describe('createCodeLensProvider', () => { } satisfies Record) }) expect( - await provider.provideCodeLenses(doc, null as unknown as vscode.CancellationToken) + await provider.provideCodeLenses(doc, null as unknown as vscode.CancellationToken), ).toStrictEqual([ { isResolved: true, @@ -124,7 +124,7 @@ describe('createCodeLensProvider', () => { } satisfies Record) }) expect( - await provider.provideCodeLenses(doc, null as unknown as vscode.CancellationToken) + await provider.provideCodeLenses(doc, null as unknown as vscode.CancellationToken), ).toStrictEqual([ { isResolved: true, @@ -147,7 +147,7 @@ describe('createCodeLensProvider', () => { item: { title: 'A', ui: { hover: { text: 'D' } } }, }, ], - }) + }), ) expectObservable(provider.observeCodeLenses(doc)).toBe('a', { a: [ @@ -185,7 +185,7 @@ describe('createCodeLensProvider', () => { presentationHints: ['prefer-link-over-detail'], }, ], - }) + }), ) expectObservable(provider.observeCodeLenses(doc)).toBe('a', { a: [ diff --git a/client/vscode-lib/src/ui/editor/codeLens.ts b/client/vscode-lib/src/ui/editor/codeLens.ts index 2412e527..ca39a00f 100644 --- a/client/vscode-lib/src/ui/editor/codeLens.ts +++ b/client/vscode-lib/src/ui/editor/codeLens.ts @@ -27,7 +27,7 @@ export function createCodeLensProvider(controller: Controller): vscode.CodeLensP entry.subscription.unsubscribe() codeLensByDoc.delete(doc.uri.toString()) } - }) + }), ) disposables.push({ dispose: () => { @@ -49,10 +49,10 @@ export function createCodeLensProvider(controller: Controller): vscode.CodeLensP const observable = controller.observeAnnotations(doc).pipe( map(anns => prepareAnnotationsForPresentation(anns ?? []).map(item => - annotationCodeLens(doc, item, showHover) - ) + annotationCodeLens(doc, item, showHover), + ), ), - shareReplay({ bufferSize: 1, refCount: true }) + shareReplay({ bufferSize: 1, refCount: true }), ) const subscription = observable.subscribe({ next: () => changeCodeLenses.fire(), @@ -80,7 +80,7 @@ export function createCodeLensProvider(controller: Controller): vscode.CodeLensP function annotationCodeLens( doc: vscode.TextDocument, ann: AnnotationWithRichRange, - showHover: ReturnType + showHover: ReturnType, ): CodeLens { const range = ann.range ?? new vscode.Range(0, 0, 0, 0) return { @@ -100,7 +100,7 @@ function annotationCodeLens( function createShowHoverCommand(): { createCommandArgs: ( uri: vscode.Uri, - pos: vscode.Position + pos: vscode.Position, ) => Pick } & vscode.Disposable { const COMMAND_ID = 'openctx._showHover' @@ -113,7 +113,7 @@ function createShowHoverCommand(): { } editor.selections = [new vscode.Selection(pos, pos)] void vscode.commands.executeCommand('editor.action.showHover') - } + }, ) return { createCommandArgs(uri, pos) { diff --git a/client/vscode-lib/src/ui/editor/hover.ts b/client/vscode-lib/src/ui/editor/hover.ts index 8bb8f453..afd21a7f 100644 --- a/client/vscode-lib/src/ui/editor/hover.ts +++ b/client/vscode-lib/src/ui/editor/hover.ts @@ -10,13 +10,13 @@ export function createHoverProvider(controller: Controller): vscode.HoverProvide controller.observeAnnotations(doc).pipe( map(anns => { const containedByAnns = anns?.filter(ann => - (ann.range ?? ZERO_RANGE).contains(pos) + (ann.range ?? ZERO_RANGE).contains(pos), ) return containedByAnns && containedByAnns.length > 0 ? createHover(containedByAnns) : null - }) - ) + }), + ), ) }, dispose() { diff --git a/client/vscode-lib/src/ui/fileItemsList.ts b/client/vscode-lib/src/ui/fileItemsList.ts index 682cf0e8..0c1954e6 100644 --- a/client/vscode-lib/src/ui/fileItemsList.ts +++ b/client/vscode-lib/src/ui/fileItemsList.ts @@ -50,7 +50,7 @@ async function showQuickPick(controller: Controller): Promise { vscode.window.showErrorMessage('Error loading OpenCtx annotations') disposeAll() }, - () => disposeAll() + () => disposeAll(), ) disposables.push({ dispose: () => subscription.unsubscribe() }) @@ -60,14 +60,14 @@ async function showQuickPick(controller: Controller): Promise { if (activeItem?.ann?.range) { editor.revealRange( activeItem.ann.range, - vscode.TextEditorRevealType.InCenterIfOutsideViewport + vscode.TextEditorRevealType.InCenterIfOutsideViewport, ) editor.selection = new vscode.Selection( activeItem.ann.range.start, - activeItem.ann.range.end + activeItem.ann.range.end, ) } - }) + }), ) disposables.push( @@ -81,7 +81,7 @@ async function showQuickPick(controller: Controller): Promise { } quickPick.hide() disposeAll() - }) + }), ) disposables.push( @@ -90,14 +90,14 @@ async function showQuickPick(controller: Controller): Promise { vscode.commands.executeCommand('vscode.open', e.item.ann.item.url) } disposeAll() - }) + }), ) disposables.push( quickPick.onDidHide(() => { disposeAll() subscription.unsubscribe() - }) + }), ) } @@ -118,7 +118,7 @@ function toQuickPickItems(anns: Annotation[]): QuickPickItem[] { }) } return qpItems.sort((a, b) => - (a.ann.range ?? ZERO_RANGE).start.compareTo((b.ann.range ?? ZERO_RANGE).start) + (a.ann.range ?? ZERO_RANGE).start.compareTo((b.ann.range ?? ZERO_RANGE).start), ) } diff --git a/client/vscode-lib/src/ui/statusBarItem.ts b/client/vscode-lib/src/ui/statusBarItem.ts index 0fb7cdb7..0b83913f 100644 --- a/client/vscode-lib/src/ui/statusBarItem.ts +++ b/client/vscode-lib/src/ui/statusBarItem.ts @@ -24,7 +24,7 @@ export function createStatusBarItem(): vscode.Disposable { if (e.affectsConfiguration('openctx.enable')) { update() } - }) + }), ) update() statusItem.show() diff --git a/client/vscode-lib/src/util/cache.ts b/client/vscode-lib/src/util/cache.ts index 8245b0a6..8ed41c11 100644 --- a/client/vscode-lib/src/util/cache.ts +++ b/client/vscode-lib/src/util/cache.ts @@ -28,7 +28,7 @@ export async function bestEffort( opts: { defaultValue: T delay: number - } + }, ): Promise { let id: ReturnType | undefined const timeout = new Promise((resolve, _) => { diff --git a/client/vscode-lib/src/util/errorReporter.ts b/client/vscode-lib/src/util/errorReporter.ts index 9d1f2c12..a469f5c6 100644 --- a/client/vscode-lib/src/util/errorReporter.ts +++ b/client/vscode-lib/src/util/errorReporter.ts @@ -32,7 +32,7 @@ export class ErrorReporterController implements vscode.Disposable { constructor( private showErrorNotification: (providerUri: string | undefined, error: any) => Thenable, - private errorLog: (error: any) => void + private errorLog: (error: any) => void, ) {} /** @@ -40,7 +40,7 @@ export class ErrorReporterController implements vscode.Disposable { */ public wrapObservable( userAction: UserAction, - providerMethod: (params: T, opts?: ProviderMethodOptions) => Observable + providerMethod: (params: T, opts?: ProviderMethodOptions) => Observable, ) { return (params: T, opts?: ProviderMethodOptions) => { const errorReporter = this.getErrorReporter(userAction, opts) @@ -72,7 +72,7 @@ export class ErrorReporterController implements vscode.Disposable { */ public wrapPromise( userAction: UserAction, - providerMethod: (params: T, opts?: ProviderMethodOptions) => Promise + providerMethod: (params: T, opts?: ProviderMethodOptions) => Promise, ) { return async (params: T, opts?: ProviderMethodOptions) => { const errorReporter = this.getErrorReporter(userAction, opts) @@ -192,7 +192,7 @@ export class ErrorReporterController implements vscode.Disposable { // If providerUri is the empty string communicate that via undefined this.showErrorNotification(providerUri === '' ? undefined : providerUri, error).then( onfinally, - onfinally + onfinally, ) } @@ -206,7 +206,7 @@ export class ErrorReporterController implements vscode.Disposable { function withErrorHook( opts: ProviderMethodOptions | undefined, - errorHook: (providerUri: string, err: any) => void + errorHook: (providerUri: string, err: any) => void, ): ProviderMethodOptions { const parent = opts?.errorHook return { diff --git a/client/vscode-lib/src/util/errorWaiter.ts b/client/vscode-lib/src/util/errorWaiter.ts index 90b13d0c..f3726ee4 100644 --- a/client/vscode-lib/src/util/errorWaiter.ts +++ b/client/vscode-lib/src/util/errorWaiter.ts @@ -36,7 +36,7 @@ export function createErrorWaiter(delay: number, errorCountThreshold: number): E delay, 'ms before retrying.', errorCount, - errorCountThreshold + errorCountThreshold, ) if (timeoutHandle === undefined) { timeoutHandle = setTimeout(() => { diff --git a/client/vscode-lib/src/util/esmToCommonJS.ts b/client/vscode-lib/src/util/esmToCommonJS.ts index 42b23fb6..83e052f1 100644 --- a/client/vscode-lib/src/util/esmToCommonJS.ts +++ b/client/vscode-lib/src/util/esmToCommonJS.ts @@ -11,15 +11,15 @@ export function esmToCommonJS(esm: string): string { let cjs = esm.replace(/(?<=^|\b)import\s+(\w+)\s+from\s+['"](.+)['"]/gm, "const $1 = require('$2');") cjs = cjs.replace( /(?<=^|\b)import\s+\{\s+([\w\d]+)\s+as\s+([\w\d]+)\s+\}\s+from\s+['"](.+)['"]/gm, - "const $2 = require('$3').$1;" + "const $2 = require('$3').$1;", ) cjs = cjs.replace( /(?<=^|\b)import\s*\{\s*([\w\s,]+)\s*\}\s+from\s+['"](.+)['"]/gm, - "const { $1} = require('$2');" + "const { $1} = require('$2');", ) cjs = cjs.replace( /(?<=^|\b)import\s+\*\s+as\s+(\w+)\s+from\s+['"](.+)['"]/gm, - "const $1 = require('$2');" + "const $1 = require('$2');", ) // Convert export default statements. @@ -28,13 +28,13 @@ export function esmToCommonJS(esm: string): string { // Convert named export statements. cjs = cjs.replace( /(?<=^|\b)export\s*\{\s*(?:[^},]*,\s*)*([\w\s,]+) as default\s*\}/gm, - 'module.exports = $1;' + 'module.exports = $1;', ) cjs = cjs.replace(/(?<=^|\b)export\s*\{\s*([\w\s,]+)\s*\}/gm, 'module.exports = { $1};') cjs = cjs.replace(/(?<=^|\b)export\s+const\s+(\w+)\s*=\s*(.+);/gm, 'exports.$1 = $2;') cjs = cjs.replace( /(?<=^|\b)export\s+function\s+(\w+)\s*\((.*)\)\s*\{/gm, - 'exports.$1 = function $1($2) {' + 'exports.$1 = function $1($2) {', ) cjs = cjs.replace(/(?<=^|\b)export\s+class\s+(\w+)\s*\{/gm, 'exports.$1 = class $1 {') diff --git a/client/vscode-lib/src/util/observable.ts b/client/vscode-lib/src/util/observable.ts index d566c8f4..f6ca4c55 100644 --- a/client/vscode-lib/src/util/observable.ts +++ b/client/vscode-lib/src/util/observable.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode' export function observeWorkspaceConfigurationChanges( section: string, - scope?: vscode.ConfigurationScope + scope?: vscode.ConfigurationScope, ): Observable { return new Observable(observer => { const disposable = vscode.workspace.onDidChangeConfiguration(e => { @@ -17,7 +17,7 @@ export function observeWorkspaceConfigurationChanges( } export function toEventEmitter( - observable: Observable + observable: Observable, ): vscode.EventEmitter & vscode.Disposable { const emitter = new vscode.EventEmitter() const sub = observable.subscribe({ next: v => emitter.fire(v) }) diff --git a/client/vscode-lib/src/util/vscode.test.ts b/client/vscode-lib/src/util/vscode.test.ts index a8b55999..374e57e7 100644 --- a/client/vscode-lib/src/util/vscode.test.ts +++ b/client/vscode-lib/src/util/vscode.test.ts @@ -23,7 +23,7 @@ export function createRange( startLine: number, startCharacter: number, endLine: number, - endCharacter: number + endCharacter: number, ): vscode.Range { return { start: { diff --git a/client/vscode-lib/tsconfig.json b/client/vscode-lib/tsconfig.json index da982cf3..48e262dd 100644 --- a/client/vscode-lib/tsconfig.json +++ b/client/vscode-lib/tsconfig.json @@ -3,13 +3,13 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "lib": ["ESNext", "DOM"], + "lib": ["ESNext", "DOM"] }, "include": ["src"], "exclude": ["dist"], "references": [ { - "path": "../../lib/client", - }, - ], + "path": "../../lib/client" + } + ] } diff --git a/client/vscode/dev/release.mts b/client/vscode/dev/release.mts index d641650f..3052cf64 100644 --- a/client/vscode/dev/release.mts +++ b/client/vscode/dev/release.mts @@ -1,4 +1,4 @@ -import { execFileSync } from 'child_process' +import { execFileSync } from 'node:child_process' import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' @@ -26,8 +26,8 @@ const packageJSONVersion = semver.valid(packageJSONVersionString) if (!packageJSONVersion) { console.error( `Invalid version in package.json: ${JSON.stringify( - packageJSONVersionString - )}. Versions must be valid semantic version strings.` + packageJSONVersionString, + )}. Versions must be valid semantic version strings.`, ) process.exit(1) } @@ -44,8 +44,8 @@ function validateReleaseType(releaseType: string | undefined): asserts releaseTy if (!releaseType || !Object.values(ReleaseType).includes(releaseType as ReleaseType)) { console.error( `Invalid release type ${JSON.stringify(releaseType)}. Valid values are: ${JSON.stringify( - Object.values(ReleaseType) - )}. Specify a a release type in the RELEASE_TYPE env var.` + Object.values(ReleaseType), + )}. Specify a a release type in the RELEASE_TYPE env var.`, ) process.exit(1) } @@ -92,7 +92,7 @@ execFileSync( ], { stdio: 'inherit', - } + }, ) // Publish the extension. @@ -112,7 +112,7 @@ if (dryRun) { { env: { ...process.env, VSCE_PAT: tokens.vscode }, stdio: 'inherit', - } + }, ) // Publish to the Open VSX Registry. @@ -128,7 +128,7 @@ if (dryRun) { ], { stdio: 'inherit', - } + }, ) } diff --git a/client/vscode/dev/tsconfig.json b/client/vscode/dev/tsconfig.json index 016a5e15..7b6f454d 100644 --- a/client/vscode/dev/tsconfig.json +++ b/client/vscode/dev/tsconfig.json @@ -4,7 +4,7 @@ "rootDir": ".", "outDir": "dist", "noEmit": true, - "esModuleInterop": true, + "esModuleInterop": true }, - "include": ["*.ts", "release.mts", "build.mts"], + "include": ["*.ts", "release.mts", "build.mts"] } diff --git a/client/vscode/package.json b/client/vscode/package.json index b10d816b..68cb36a7 100644 --- a/client/vscode/package.json +++ b/client/vscode/package.json @@ -35,17 +35,9 @@ "test:e2e": "bash test/e2e.sh", "vscode:prepublish": "pnpm -s run build" }, - "categories": [ - "Programming Languages", - "Linters", - "Snippets", - "Education" - ], + "categories": ["Programming Languages", "Linters", "Snippets", "Education"], "preview": true, - "keywords": [ - "openctx", - "metadata" - ], + "keywords": ["openctx", "metadata"], "repository": { "type": "git", "url": "https://github.com/sourcegraph/openctx", @@ -61,9 +53,7 @@ "type": "module", "main": "dist/extension.node.cjs", "browser": "dist/extension.web.js", - "activationEvents": [ - "onStartupFinished" - ], + "activationEvents": ["onStartupFinished"], "contributes": { "configuration": { "type": "object", @@ -82,10 +72,7 @@ "propertyNames": { "description": "The OpenCtx provider's URL (or relative file path).", "type": "string", - "format": [ - "uri", - "uri-reference" - ] + "format": ["uri", "uri-reference"] }, "additionalProperties": { "oneOf": [ @@ -181,9 +168,7 @@ "untrustedWorkspaces": { "supported": "limited", "description": "OpenCtx only uses providers (configured in `openctx.providers`) from trusted workspaces because providers may execute arbitrary code.", - "restrictedConfigurations": [ - "openctx.providers" - ] + "restrictedConfigurations": ["openctx.providers"] }, "virtualWorkspaces": true }, diff --git a/client/vscode/src/authInfo.ts b/client/vscode/src/authInfo.ts index 0223798e..0dbd4792 100644 --- a/client/vscode/src/authInfo.ts +++ b/client/vscode/src/authInfo.ts @@ -27,7 +27,7 @@ export function secretsChanges(secrets: vscode.SecretStorage): { if (e.key.startsWith(SECRET_STORAGE_KEY_PREFIX)) { subject.next(secrets) } - }) + }), ) disposables.push( @@ -37,7 +37,7 @@ export function secretsChanges(secrets: vscode.SecretStorage): { } await vscode.window.showInformationMessage('Cleared OpenCtx authentication.') promptedForAuthInfo.clear() // reset prompts - }) + }), ) return { disposable: vscode.Disposable.from(...disposables), observable: subject } @@ -45,7 +45,7 @@ export function secretsChanges(secrets: vscode.SecretStorage): { export async function getAuthInfo( secrets: vscode.SecretStorage, - providerUri: string + providerUri: string, ): Promise { const hostname = new URL(providerUri).hostname if (!HOSTNAMES_NEEDING_ACCESS_TOKENS.includes(hostname)) { @@ -67,7 +67,7 @@ const promptedForAuthInfo = new Map() async function promptForAuthInfo( secrets: vscode.SecretStorage, - hostname: string + hostname: string, ): Promise { const alreadyPrompted = promptedForAuthInfo.get(hostname) if (alreadyPrompted) { diff --git a/client/vscode/src/extension.ts b/client/vscode/src/extension.ts index d397deb8..95213038 100644 --- a/client/vscode/src/extension.ts +++ b/client/vscode/src/extension.ts @@ -6,7 +6,7 @@ import { getAuthInfo, secretsChanges } from './authInfo.js' * Start the extension, watching all relevant configuration and secrets for changes. */ export function activate( - context: Pick + context: Pick, ): ExtensionApiForTesting | null { const extensionId = context.extension.id diff --git a/client/vscode/test/fixtures/workspace/.vscode/settings.json b/client/vscode/test/fixtures/workspace/.vscode/settings.json index 501bb015..1c3e4159 100644 --- a/client/vscode/test/fixtures/workspace/.vscode/settings.json +++ b/client/vscode/test/fixtures/workspace/.vscode/settings.json @@ -13,7 +13,7 @@ "type": "docs", "preview": true, "path": "**/*.ts?(x)", - "pattern": "eventLogger\\.", + "pattern": "eventLogger\\." }, { "title": "CSS in client/web", @@ -21,23 +21,23 @@ "type": "docs", "preview": true, "path": "**/*.ts?(x)", - "pattern": "^import styles from", + "pattern": "^import styles from" }, { "title": "Bazel at Sourcegraph", "url": "https://docs.sourcegraph.com/dev/background-information/bazel#bazel-at-sourcegraph", "type": "docs", "preview": true, - "path": "**/{BUILD.bazel,*.bzl,*.bazelrc,WORKSPACE}", + "path": "**/{BUILD.bazel,*.bzl,*.bazelrc,WORKSPACE}" }, { "title": "View all Storybooks", "url": "https://www.chromatic.com/library?appId=5f0f381c0e50750022dc6bf7", "type": "docs", "description": "On Chromatic", - "path": "**/{*.{stories,story}.ts?(x),.storybook/**}", - }, - ], - }, - }, + "path": "**/{*.{stories,story}.ts?(x),.storybook/**}" + } + ] + } + } } diff --git a/client/vscode/test/fixtures/workspace/tsconfig.json b/client/vscode/test/fixtures/workspace/tsconfig.json index 607ac76e..20c8895e 100644 --- a/client/vscode/test/fixtures/workspace/tsconfig.json +++ b/client/vscode/test/fixtures/workspace/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "jsx": "preserve", - "noEmit": true, + "noEmit": true }, - "include": ["*"], + "include": ["*"] } diff --git a/client/vscode/test/integration/api.test.cts b/client/vscode/test/integration/api.test.cts index 6c7eea5a..c848b77c 100644 --- a/client/vscode/test/integration/api.test.cts +++ b/client/vscode/test/integration/api.test.cts @@ -24,13 +24,13 @@ suite('API', () => { debug: true, providers: { [vscode.Uri.file( - path.join(openctxDir, 'provider/hello-world/dist/index.js') + path.join(openctxDir, 'provider/hello-world/dist/index.js'), ).toString()]: true, }, }) assert.deepEqual( (await api.items({})).map(item => item.title), - ['✨ Hello, world!'] + ['✨ Hello, world!'], ) }) @@ -46,7 +46,7 @@ suite('API', () => { const origProviderPath = path.join( openctxDir, 'lib/client/src/providerClient/transport/testdata', - providerFilename + providerFilename, ) const providerPath = path.join(scratchDir, providerFilename) @@ -62,7 +62,7 @@ suite('API', () => { assert.deepEqual( (await api.meta({})).map(meta => meta.name), - ['foo'] + ['foo'], ) }) } diff --git a/client/vscode/test/integration/index.cts b/client/vscode/test/integration/index.cts index 5e04a236..7ac78c92 100644 --- a/client/vscode/test/integration/index.cts +++ b/client/vscode/test/integration/index.cts @@ -27,7 +27,7 @@ export async function run(): Promise { reject(new Error(`${failures} tests failed.`)) } resolve() - }) + }), ) } catch (error) { console.error(error) diff --git a/client/vscode/test/integration/main.cts b/client/vscode/test/integration/main.cts index ca2d8d96..bc1e16d8 100644 --- a/client/vscode/test/integration/main.cts +++ b/client/vscode/test/integration/main.cts @@ -18,7 +18,7 @@ async function main(): Promise { 'tsc', 'test', 'integration', - 'index.cjs' + 'index.cjs', ) let exitCode: number diff --git a/client/vscode/test/integration/tsconfig.json b/client/vscode/test/integration/tsconfig.json index 7a4efd8a..3f853f83 100644 --- a/client/vscode/test/integration/tsconfig.json +++ b/client/vscode/test/integration/tsconfig.json @@ -6,8 +6,8 @@ "esModuleInterop": true, "rootDir": ".", "outDir": "../../dist/tsc/test/integration", - "types": ["mocha", "node"], + "types": ["mocha", "node"] }, "include": ["*.cts"], - "references": [{ "path": "../../" }], + "references": [{ "path": "../../" }] } diff --git a/client/vscode/tsconfig.json b/client/vscode/tsconfig.json index 785805e9..2fdf2104 100644 --- a/client/vscode/tsconfig.json +++ b/client/vscode/tsconfig.json @@ -4,13 +4,13 @@ "sourceMap": true, "rootDir": ".", "outDir": "dist/tsc", - "lib": ["ESNext", "DOM"], + "lib": ["ESNext", "DOM"] }, "include": ["src"], "exclude": ["dist", "testadata"], "references": [ { - "path": "../../lib/client", - }, - ], + "path": "../../lib/client" + } + ] } diff --git a/client/web-playground/src/AnnotatedEditor.tsx b/client/web-playground/src/AnnotatedEditor.tsx index 662d3b74..31b24dce 100644 --- a/client/web-playground/src/AnnotatedEditor.tsx +++ b/client/web-playground/src/AnnotatedEditor.tsx @@ -66,7 +66,7 @@ export const AnnotatedEditor: React.FunctionComponent<{ makeRange: r => r, logger: console.error, }), - [settings] + [settings], ) const [error, setError] = useState() @@ -80,12 +80,12 @@ export const AnnotatedEditor: React.FunctionComponent<{ next: () => setError(undefined), error: error => setError(error.message ?? `${error}`), }), - catchError(() => of([])) + catchError(() => of([])), ) : NEVER, - [client, value, resourceUri] + [client, value, resourceUri], ), - [] + [], ) const octxExtension = useOpenCtxExtension({ @@ -94,7 +94,7 @@ export const AnnotatedEditor: React.FunctionComponent<{ }) const extensions = useMemo( () => [javascript({ jsx: true, typescript: true }), octxExtension], - [octxExtension] + [octxExtension], ) return ( @@ -122,7 +122,7 @@ export const AnnotatedEditor: React.FunctionComponent<{ searchKeymap: false, }, }, - codeMirrorProps + codeMirrorProps, )} /> diff --git a/client/web-playground/src/codemirror.ts b/client/web-playground/src/codemirror.ts index e4f07f32..cb34a5d2 100644 --- a/client/web-playground/src/codemirror.ts +++ b/client/web-playground/src/codemirror.ts @@ -2,7 +2,7 @@ import type { ReactCodeMirrorProps } from '@uiw/react-codemirror' export function mergeCodeMirrorProps( defaults: Omit, - props: Omit | undefined + props: Omit | undefined, ): Omit { return { ...defaults, diff --git a/client/web-playground/src/demo.tsx b/client/web-playground/src/demo.tsx index dfc233fc..3d828912 100644 --- a/client/web-playground/src/demo.tsx +++ b/client/web-playground/src/demo.tsx @@ -6,5 +6,5 @@ import { DemoApp } from './demo/DemoApp.js' ReactDOM.createRoot(document.querySelector('#root') as HTMLElement).render( - + , ) diff --git a/client/web-playground/src/demo/main.tsx b/client/web-playground/src/demo/main.tsx index bfc8969d..4cf830e4 100644 --- a/client/web-playground/src/demo/main.tsx +++ b/client/web-playground/src/demo/main.tsx @@ -6,5 +6,5 @@ import './main.css' ReactDOM.createRoot(document.querySelector('#root') as HTMLElement).render( - + , ) diff --git a/client/web-playground/src/demo/settings.ts b/client/web-playground/src/demo/settings.ts index 97cededb..4d37ac37 100644 --- a/client/web-playground/src/demo/settings.ts +++ b/client/web-playground/src/demo/settings.ts @@ -40,7 +40,7 @@ async function getProviders(): Promise( '../../../../provider/*/index.ts', - { query: '?url' } + { query: '?url' }, ) for (const [path, urlModule] of Object.entries(providerModules)) { const providerUri = new URL((await urlModule()).default, import.meta.url).toString() diff --git a/client/web-playground/tsconfig.json b/client/web-playground/tsconfig.json index f1b6e459..5c1b9e0e 100644 --- a/client/web-playground/tsconfig.json +++ b/client/web-playground/tsconfig.json @@ -17,6 +17,6 @@ { "path": "../codemirror" }, { "path": "../../lib/client" }, { "path": "../../lib/ui-react" }, - { "path": "../../provider/links" }, - ], + { "path": "../../provider/links" } + ] } diff --git a/lib/client/package.json b/lib/client/package.json index cecf097c..3e76ed02 100644 --- a/lib/client/package.json +++ b/lib/client/package.json @@ -11,12 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "!**/*.test.*", - "!**/testdata/**" - ], + "files": ["dist", "src", "!**/*.test.*", "!**/testdata/**"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/lib/client/src/api.test.ts b/lib/client/src/api.test.ts index 870f4343..8d887733 100644 --- a/lib/client/src/api.test.ts +++ b/lib/client/src/api.test.ts @@ -79,8 +79,8 @@ describe('observeItems', () => { ], }), FIXTURE_ITEMS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a', { a: [fixtureItem('a', 'a')] } satisfies Record) }) }) @@ -93,8 +93,8 @@ describe('observeItems', () => { a: [], }), FIXTURE_ITEMS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a', { a: [] } satisfies Record) }) }) @@ -124,8 +124,8 @@ describe('observeItems', () => { ], }), FIXTURE_ITEMS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a', { a: [fixtureItem('a', 'a'), fixtureItem('b', 'b')], } satisfies Record) @@ -182,8 +182,8 @@ describe('observeItems', () => { ], }), FIXTURE_ITEMS_PARAMS, - optsExpectingError - ) + optsExpectingError, + ), ).toBe('a', { a: [fixtureItem('b', 'a')], b: [], @@ -228,8 +228,8 @@ describe('observeItems', () => { ], }), FIXTURE_ITEMS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a-b', { a: [fixtureItem('a', 'a')], b: [fixtureItem('a', 'a'), fixtureItem('b', 'b')], @@ -258,8 +258,8 @@ describe('observeAnnotations', () => { ], }), FIXTURE_ANNOTATIONS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a', { a: [fixtureAnn('a', 'a')] } satisfies Record< string, EachWithProviderUri @@ -275,8 +275,8 @@ describe('observeAnnotations', () => { a: [], }), FIXTURE_ANNOTATIONS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a', { a: [] } satisfies Record) }) }) @@ -306,8 +306,8 @@ describe('observeAnnotations', () => { ], }), FIXTURE_ANNOTATIONS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a', { a: [fixtureAnn('a', 'a'), fixtureAnn('b', 'b')] } satisfies Record< string, Annotation[] @@ -365,8 +365,8 @@ describe('observeAnnotations', () => { ], }), FIXTURE_ANNOTATIONS_PARAMS, - optsExpectingError - ) + optsExpectingError, + ), ).toBe('a', { a: [fixtureAnn('b', 'a')], b: [], @@ -412,8 +412,8 @@ describe('observeAnnotations', () => { ], }), FIXTURE_ANNOTATIONS_PARAMS, - OPTS - ) + OPTS, + ), ).toBe('a-b', { a: [fixtureAnn('a', 'a')], b: [fixtureAnn('a', 'a'), fixtureAnn('b', 'b')], diff --git a/lib/client/src/api.ts b/lib/client/src/api.ts index 0a2e8335..93a767e8 100644 --- a/lib/client/src/api.ts +++ b/lib/client/src/api.ts @@ -69,7 +69,7 @@ export type EachWithProviderUri = ((T extends readonly (inf function observeProviderCall( providerClients: Observable, fn: (provider: ProviderClientWithSettings) => Observable, - { emitPartial, errorHook, logger }: Pick, 'logger'> & ObserveOptions + { emitPartial, errorHook, logger }: Pick, 'logger'> & ObserveOptions, ): Observable> { return providerClients.pipe( mergeMap(providerClients => @@ -87,23 +87,23 @@ function observeProviderCall( console.error(error) } return of(null) - }) + }), ) .pipe( map(items => - (items || []).map(item => ({ ...item, providerUri: uri })) - ) - ) - ) + (items || []).map(item => ({ ...item, providerUri: uri })), + ), + ), + ), ) - : of([]) + : of([]), ), map(result => result.filter((v): v is EachWithProviderUri => v !== null).flat()), tap(items => { if (LOG_VERBOSE) { logger?.(`got ${items.length} results: ${JSON.stringify(items)}`) } - }) + }), ) } @@ -113,13 +113,13 @@ function observeProviderCall( export function observeMeta( providerClients: Observable, params: MetaParams, - opts: Pick, 'logger'> & ObserveOptions + opts: Pick, 'logger'> & ObserveOptions, ): Observable> { return observeProviderCall( providerClients, ({ providerClient, settings }) => from(providerClient.meta(params, settings)).pipe(map(result => [result])), - opts + opts, ) } @@ -129,12 +129,12 @@ export function observeMeta( export function observeMentions( providerClients: Observable, params: MentionsParams, - opts: Pick, 'logger'> & ObserveOptions + opts: Pick, 'logger'> & ObserveOptions, ): Observable> { return observeProviderCall( providerClients, ({ providerClient, settings }) => from(providerClient.mentions(params, settings)), - opts + opts, ) } @@ -144,12 +144,12 @@ export function observeMentions( export function observeItems( providerClients: Observable, params: ItemsParams, - opts: Pick, 'logger'> & ObserveOptions + opts: Pick, 'logger'> & ObserveOptions, ): Observable> { return observeProviderCall( providerClients, ({ providerClient, settings }) => from(providerClient.items(params, settings)), - opts + opts, ) } @@ -164,7 +164,7 @@ export function observeAnnotations( makeRange, emitPartial, errorHook, - }: Pick, 'logger' | 'makeRange'> & ObserveOptions + }: Pick, 'logger' | 'makeRange'> & ObserveOptions, ): Observable[]>> { return observeProviderCall( providerClients, @@ -186,10 +186,10 @@ export function observeAnnotations( (a.range?.start.character ?? 0) - (b.range?.start.character ?? 0) ) }) - : null - ) + : null, + ), ), - { logger, emitPartial, errorHook } + { logger, emitPartial, errorHook }, ) } diff --git a/lib/client/src/client/client.test.ts b/lib/client/src/client/client.test.ts index 00b10c31..d7b6aa8e 100644 --- a/lib/client/src/client/client.test.ts +++ b/lib/client/src/client/client.test.ts @@ -31,7 +31,7 @@ function fixtureAnn(label: string): Annotation { } function createTestClient( - env: Partial> & Required, 'configuration'>> + env: Partial> & Required, 'configuration'>>, ): Client { return createClient({ authInfo: () => of(null), @@ -86,7 +86,7 @@ describe('Client', () => { ]), }), }, - }).itemsChanges(FIXTURE_ITEMS_PARAMS) + }).itemsChanges(FIXTURE_ITEMS_PARAMS), ).toBe('(0a)', { '0': [], a: [{ ...fixtureItem('a'), providerUri: testdataFileUri('simple.js') }], @@ -134,7 +134,7 @@ describe('Client', () => { __mock__: { getProviderClient: () => ({ annotations: () => of([fixtureAnn('a')]) }), }, - }).annotationsChanges(FIXTURE_ANNOTATIONS_PARAMS) + }).annotationsChanges(FIXTURE_ANNOTATIONS_PARAMS), ).toBe('(0a)', { '0': [], a: [{ ...fixtureAnn('a'), providerUri: testdataFileUri('simple.js') }], diff --git a/lib/client/src/client/client.ts b/lib/client/src/client/client.ts index 8766674c..ceb7f587 100644 --- a/lib/client/src/client/client.ts +++ b/lib/client/src/client/client.ts @@ -172,7 +172,7 @@ export interface Client { */ metaChanges( params: MetaParams, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): Observable> /** @@ -185,7 +185,7 @@ export interface Client { */ mentions( params: MentionsParams, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): Promise> /** @@ -196,7 +196,7 @@ export interface Client { */ mentionsChanges( params: MentionsParams, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): Observable> /** @@ -217,7 +217,7 @@ export interface Client { */ itemsChanges( params: ItemsParams, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): Observable> /** @@ -230,7 +230,7 @@ export interface Client { */ annotations( params: AnnotationsParams, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): Promise[]>> /** @@ -241,7 +241,7 @@ export interface Client { */ annotationsChanges( params: AnnotationsParams, - opts?: ProviderMethodOptions + opts?: ProviderMethodOptions, ): Observable[]>> /** @@ -264,7 +264,7 @@ export function createClient(env: ClientEnv): Client { const debug = from(env.configuration()).pipe( map(config => configurationFromUserInput(config).debug), distinctUntilChanged(), - shareReplay(1) + shareReplay(1), ) subscriptions.push(debug.subscribe()) const logger: Logger = message => { @@ -285,7 +285,7 @@ export function createClient(env: ClientEnv): Client { config = { ...config, providers: {} } } return configurationFromUserInput(config, env.providers) - }) + }), ) .pipe( mergeMap(configuration => @@ -298,44 +298,43 @@ export function createClient(env: ClientEnv): Client { providerClient: env.__mock__?.getProviderClient ? env.__mock__.getProviderClient() : providerCache.getOrCreate( - { providerUri, authInfo: authInfo ?? undefined }, - { - providerBaseUri: env.providerBaseUri, - logger, - importProvider: env.importProvider, - }, - env.providers?.find( - provider => - provider.providerUri === providerUri - )?.provider - ), + { providerUri, authInfo: authInfo ?? undefined }, + { + providerBaseUri: env.providerBaseUri, + logger, + importProvider: env.importProvider, + }, + env.providers?.find( + provider => provider.providerUri === providerUri, + )?.provider, + ), settings, })), catchError(error => { logger( - `Error creating provider client for ${providerUri}: ${error}` + `Error creating provider client for ${providerUri}: ${error}`, ) return of(null) - }) - ) - ) + }), + ), + ), ) - : of([]) + : of([]), ), // Filter out null clients. map(providerClients => providerClients.filter( (providerClient): providerClient is ProviderClientWithSettings => - providerClient !== null - ) - ) + providerClient !== null, + ), + ), ) } const filterProviders = ( providersObservable: Observable, - opts: Pick + opts: Pick, ): Observable => { const uri = opts.providerUri if (!uri) { @@ -343,7 +342,7 @@ export function createClient(env: ClientEnv): Client { } return providersObservable.pipe( - map(providers => providers.filter(provider => provider.uri === uri)) + map(providers => providers.filter(provider => provider.uri === uri)), ) } @@ -351,7 +350,7 @@ export function createClient(env: ClientEnv): Client { const metaChanges = ( params: MetaParams, - opts: ChangesOpts + opts: ChangesOpts, ): Observable> => { return observeMeta(filterProviders(providerClientsWithSettings(undefined), opts), params, { ...opts, @@ -361,7 +360,7 @@ export function createClient(env: ClientEnv): Client { const mentionsChanges = ( params: MentionsParams, - opts: ChangesOpts + opts: ChangesOpts, ): Observable> => { return observeMentions(filterProviders(providerClientsWithSettings(undefined), opts), params, { ...opts, @@ -371,7 +370,7 @@ export function createClient(env: ClientEnv): Client { const itemsChanges = ( params: ItemsParams, - opts: ChangesOpts + opts: ChangesOpts, ): Observable> => { return observeItems(filterProviders(providerClientsWithSettings(undefined), opts), params, { ...opts, @@ -381,7 +380,7 @@ export function createClient(env: ClientEnv): Client { const annotationsChanges = ( params: AnnotationsParams, - opts: ChangesOpts + opts: ChangesOpts, ): Observable[]>> => { return observeAnnotations( filterProviders(providerClientsWithSettings(params.uri), opts), @@ -390,7 +389,7 @@ export function createClient(env: ClientEnv): Client { ...opts, logger: env.logger, makeRange: env.makeRange, - } + }, ) } @@ -439,7 +438,7 @@ function createProviderPool(): { getOrCreate: ( key: ProviderCacheKey, env: Pick, 'providerBaseUri' | 'logger' | 'importProvider'>, - provider?: Provider + provider?: Provider, ) => ProviderClient } { function cacheKey(key: ProviderCacheKey): string { @@ -467,7 +466,7 @@ function createProviderPool(): { logger: env.logger, importProvider: env.importProvider, }, - provider + provider, ) cache.set(cacheKey(key), c) return c diff --git a/lib/client/src/configuration.test.ts b/lib/client/src/configuration.test.ts index 41701e8d..a9bfed7e 100644 --- a/lib/client/src/configuration.test.ts +++ b/lib/client/src/configuration.test.ts @@ -19,7 +19,7 @@ describe('configurationFromUserInput', () => { 'https://example.com/c': false, 'https://example.com/a': {}, }, - }) + }), ).toStrictEqual({ enable: false, debug: true, diff --git a/lib/client/src/configuration.ts b/lib/client/src/configuration.ts index b01cc9ae..ed05ab00 100644 --- a/lib/client/src/configuration.ts +++ b/lib/client/src/configuration.ts @@ -33,7 +33,7 @@ export interface ImportedProviderConfiguration { */ export function configurationFromUserInput( raw: ConfigurationUserInput, - providers: ImportedProviderConfiguration[] = [] + providers: ImportedProviderConfiguration[] = [], ): Configuration { return { enable: raw.enable ?? true, @@ -49,11 +49,11 @@ export function configurationFromUserInput( } function providersFromUserInput( - providers: ConfigurationUserInput['providers'] + providers: ConfigurationUserInput['providers'], ): Configuration['providers'] { return Object.entries(providers ?? []) .map(([providerUri, settings]) => - settings ? { providerUri, settings: settings === true ? {} : settings } : null + settings ? { providerUri, settings: settings === true ? {} : settings } : null, ) .filter((v): v is Configuration['providers'][number] => v !== null) .sort((a, b) => a.providerUri.localeCompare(b.providerUri)) diff --git a/lib/client/src/providerClient/createProviderClient.test.ts b/lib/client/src/providerClient/createProviderClient.test.ts index cd42c4aa..5656113c 100644 --- a/lib/client/src/providerClient/createProviderClient.test.ts +++ b/lib/client/src/providerClient/createProviderClient.test.ts @@ -20,7 +20,7 @@ describe('createProviderClient', () => { // File URI that satisfies the provider's selector. expect( - await pc.annotations({ uri: 'file:///foo', content: 'A\nB\nC\nD' }, settings) + await pc.annotations({ uri: 'file:///foo', content: 'A\nB\nC\nD' }, settings), ).toStrictEqual([ { uri: 'file:///foo', @@ -31,7 +31,7 @@ describe('createProviderClient', () => { // File URI that does NOT satisfy the provider's selector. expect( - await pc.annotations({ uri: 'file:///xxx', content: 'A' }, settings) + await pc.annotations({ uri: 'file:///xxx', content: 'A' }, settings), ).toStrictEqual(null) }) @@ -47,7 +47,7 @@ describe('createProviderClient', () => { const logger = vi.fn((() => {}) as Logger) const pc = createProviderClient(testdataFileUri('metaThrow.js'), { logger }) await expect(pc.annotations({ uri: 'file:///f', content: 'A' }, {})).rejects.toThrow( - 'metaThrow' + 'metaThrow', ) expect(logger.mock.lastCall?.[0]).toContain('Error: metaThrow') }) @@ -63,7 +63,7 @@ describe('createProviderClient', () => { const logger = vi.fn((() => {}) as Logger) const pc = createProviderClient(testdataFileUri('methodsThrow.js'), { logger }) await expect(pc.annotations({ uri: 'file:///f', content: 'A' }, {})).rejects.toThrow( - 'annotationsThrow' + 'annotationsThrow', ) expect(logger.mock.lastCall?.[0]).toContain('Error: annotationsThrow') }) diff --git a/lib/client/src/providerClient/createProviderClient.ts b/lib/client/src/providerClient/createProviderClient.ts index c8b61733..02205ab8 100644 --- a/lib/client/src/providerClient/createProviderClient.ts +++ b/lib/client/src/providerClient/createProviderClient.ts @@ -48,7 +48,7 @@ export interface ProviderClientOptions export function createProviderClient( providerUri: string, { logger, ...options }: ProviderClientOptions = {}, - provider?: Provider + provider?: Provider, ): ProviderClient { logger = scopedLogger(logger, `providerClient(${providerUri})`) @@ -65,7 +65,7 @@ export function createProviderClient( }, async mentions( params: MentionsParams, - settings: ProviderSettings + settings: ProviderSettings, ): Promise { try { return (await transport.mentions?.(params, settings)) || null @@ -84,7 +84,7 @@ export function createProviderClient( }, async annotations( params: AnnotationsParams, - settings: ProviderSettings + settings: ProviderSettings, ): Promise { let match: (params: AnnotationsParams) => boolean | undefined try { @@ -105,8 +105,8 @@ export function createProviderClient( if (!capable) { logger?.( `skipping items for ${JSON.stringify( - params.uri - )} because it did not match the provider's selector` + params.uri, + )} because it did not match the provider's selector`, ) return null } diff --git a/lib/client/src/providerClient/selector.ts b/lib/client/src/providerClient/selector.ts index 8ba69228..d74efbba 100644 --- a/lib/client/src/providerClient/selector.ts +++ b/lib/client/src/providerClient/selector.ts @@ -9,7 +9,7 @@ import match from 'picomatch/lib/picomatch.js' * docs for the selector specification. */ export function matchSelectors( - selectors: AnnotationSelector[] | undefined + selectors: AnnotationSelector[] | undefined, ): (params: AnnotationsParams) => boolean { if (selectors === undefined) { return ALWAYS_TRUE diff --git a/lib/client/src/providerClient/transport/cache.ts b/lib/client/src/providerClient/transport/cache.ts index fcb4bc65..386b0926 100644 --- a/lib/client/src/providerClient/transport/cache.ts +++ b/lib/client/src/providerClient/transport/cache.ts @@ -12,7 +12,7 @@ export function cachedTransport(provider: ProviderTransport): ProviderTransport args: Parameters, fn: ( ...args: Parameters - ) => Promise>> + ) => Promise>>, ): Promise>> { const fullKey = `${String(method)}:${JSON.stringify(args)}` const entry = cache.get(fullKey) as Awaited> | undefined @@ -30,13 +30,13 @@ export function cachedTransport(provider: ProviderTransport): ProviderTransport cachedMethodCall('meta', args, (params, settings) => provider.meta(params, settings)), mentions: (...args) => cachedMethodCall('mentions', args, (params, settings) => - provider.mentions(params, settings) + provider.mentions(params, settings), ), items: (...args) => cachedMethodCall('items', args, (params, settings) => provider.items(params, settings)), annotations: (...args) => cachedMethodCall('annotations', args, (params, settings) => - provider.annotations(params, settings) + provider.annotations(params, settings), ), dispose: () => { cache.clear() diff --git a/lib/client/src/providerClient/transport/createTransport.test.ts b/lib/client/src/providerClient/transport/createTransport.test.ts index b48da749..604798a4 100644 --- a/lib/client/src/providerClient/transport/createTransport.test.ts +++ b/lib/client/src/providerClient/transport/createTransport.test.ts @@ -44,7 +44,7 @@ describe('createTransport', () => { test('providerBaseUri', () => expectProviderTransport( - createTransport('esmProvider.js', { providerBaseUri: testdataFileUri('') }) + createTransport('esmProvider.js', { providerBaseUri: testdataFileUri('') }), )) }) @@ -63,7 +63,7 @@ describe('createTransport', () => { }, name: 'foo', } satisfies MetaResult, - } satisfies ResponseMessage) + } satisfies ResponseMessage), ) const provider = createTransport('https://example.com/openctx', {}) await expectProviderTransport(provider) diff --git a/lib/client/src/providerClient/transport/createTransport.ts b/lib/client/src/providerClient/transport/createTransport.ts index 3f5ed38e..3015f356 100644 --- a/lib/client/src/providerClient/transport/createTransport.ts +++ b/lib/client/src/providerClient/transport/createTransport.ts @@ -33,7 +33,7 @@ export interface ProviderTransportOptions */ export function createTransport( providerUri: string, - options: ProviderTransportOptions + options: ProviderTransportOptions, ): ProviderTransport { function doResolveProvider(providerUri: string): ProviderTransport { let url = new URL(providerUri, options.providerBaseUri) diff --git a/lib/client/src/providerClient/transport/http.ts b/lib/client/src/providerClient/transport/http.ts index 9dfa9fbd..8ef89057 100644 --- a/lib/client/src/providerClient/transport/http.ts +++ b/lib/client/src/providerClient/transport/http.ts @@ -11,7 +11,7 @@ import type { ProviderTransport, ProviderTransportOptions } from './createTransp export function createHttpTransport( providerUri: string, - { authInfo, logger }: Pick + { authInfo, logger }: Pick, ): ProviderTransport { logger = scopedLogger(logger, 'http') @@ -45,7 +45,7 @@ export function createHttpTransport( error.cause ? `cause=${error.cause}` : null, ] .filter(s => s) - .join(' ')}` + .join(' ')}`, ) } @@ -56,7 +56,7 @@ export function createHttpTransport( try { const { result, error } = (await resp.json()) as ResponseMessage logger?.( - `${req.method} response: result=${JSON.stringify(result)} error=${JSON.stringify(error)}` + `${req.method} response: result=${JSON.stringify(result)} error=${JSON.stringify(error)}`, ) if (error) { throw new Error( @@ -66,7 +66,7 @@ export function createHttpTransport( `error.code=${error.code}`, `error.message=${JSON.stringify(error.message)}`, `error.data=${JSON.stringify(error.data)}`, - ].join(' ')}` + ].join(' ')}`, ) } if (!result) { @@ -79,7 +79,7 @@ export function createHttpTransport( `providerUri=${providerUri}`, `method=${req.method}`, `error=${JSON.stringify('message' in error ? error.message : error)}`, - ].join(' ')}` + ].join(' ')}`, ) } } diff --git a/lib/client/src/providerClient/transport/module.test.ts b/lib/client/src/providerClient/transport/module.test.ts index 9bcf3860..065611c8 100644 --- a/lib/client/src/providerClient/transport/module.test.ts +++ b/lib/client/src/providerClient/transport/module.test.ts @@ -23,7 +23,7 @@ describe('fetchProviderSource', () => { }) await expect(fetchProviderSource('https://example.com/a.js')).rejects.toThrow( - /invalid Content-Type/ + /invalid Content-Type/, ) }) diff --git a/lib/client/src/providerClient/transport/module.ts b/lib/client/src/providerClient/transport/module.ts index f1ac7b89..333dc2d9 100644 --- a/lib/client/src/providerClient/transport/module.ts +++ b/lib/client/src/providerClient/transport/module.ts @@ -3,12 +3,12 @@ import type { ProviderTransport, ProviderTransportOptions } from './createTransp export function createModuleTransport( providerUri: string, - { importProvider }: Pick + { importProvider }: Pick, ): ProviderTransport { return lazyProvider( (importProvider ? importProvider(providerUri) : import(/* @vite-ignore */ providerUri)).then( - mod => providerFromModule(mod) - ) + mod => providerFromModule(mod), + ), ) } @@ -17,7 +17,7 @@ export async function fetchProviderSource(providerUri: string): Promise if (!resp.ok) { throw new Error( - `OpenCtx remote provider module URL ${providerUri} responded with HTTP error ${resp.status} ${resp.statusText}` + `OpenCtx remote provider module URL ${providerUri} responded with HTTP error ${resp.status} ${resp.statusText}`, ) } const contentType = resp.headers.get('Content-Type')?.trim()?.replace(/;.*$/, '') @@ -29,8 +29,8 @@ export async function fetchProviderSource(providerUri: string): Promise ) { throw new Error( `OpenCtx remote provider module URL ${providerUri} reported invalid Content-Type ${JSON.stringify( - contentType - )} (expected "text/javascript" or "text/plain")` + contentType, + )} (expected "text/javascript" or "text/plain")`, ) } diff --git a/lib/client/tsconfig.json b/lib/client/tsconfig.json index d067afef..ebf72712 100644 --- a/lib/client/tsconfig.json +++ b/lib/client/tsconfig.json @@ -10,5 +10,5 @@ }, "include": ["src"], "exclude": ["dist"], - "references": [{ "path": "../protocol" }, { "path": "../provider" }, { "path": "../schema" }], + "references": [{ "path": "../protocol" }, { "path": "../provider" }, { "path": "../schema" }] } diff --git a/lib/protocol/package.json b/lib/protocol/package.json index 6a1b581f..e9cdb1f6 100644 --- a/lib/protocol/package.json +++ b/lib/protocol/package.json @@ -11,10 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "sideEffects": false, "scripts": { "generate": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only ../schema/dev/generateJsonSchemaTypes.ts src/openctx-protocol.schema.json \"import type { Annotation, Item } from '@openctx/schema'\" > src/openctx-protocol.schema.ts && pnpm -w exec biome check --apply-unsafe \"$PNPM_SCRIPT_SRC_DIR/src/openctx-protocol.schema.ts\"", diff --git a/lib/protocol/tsconfig.json b/lib/protocol/tsconfig.json index 9caf1257..6af17e70 100644 --- a/lib/protocol/tsconfig.json +++ b/lib/protocol/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../.config/tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "dist", + "outDir": "dist" }, "include": ["src"], - "references": [{ "path": "../schema" }], + "references": [{ "path": "../schema" }] } diff --git a/lib/provider/package.json b/lib/provider/package.json index 09b30a65..7a4239e0 100644 --- a/lib/provider/package.json +++ b/lib/provider/package.json @@ -11,11 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "!**/*.test.*" - ], + "files": ["dist", "src", "!**/*.test.*"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/lib/provider/tsconfig.json b/lib/provider/tsconfig.json index d31f772d..e7711262 100644 --- a/lib/provider/tsconfig.json +++ b/lib/provider/tsconfig.json @@ -2,9 +2,9 @@ "extends": "../../.config/tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "dist", + "outDir": "dist" }, "include": ["src"], "exclude": ["dist"], - "references": [{ "path": "../protocol" }, { "path": "../schema" }], + "references": [{ "path": "../protocol" }, { "path": "../schema" }] } diff --git a/lib/schema/dev/tsconfig.json b/lib/schema/dev/tsconfig.json index 928dc4a8..f9dae052 100644 --- a/lib/schema/dev/tsconfig.json +++ b/lib/schema/dev/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "noEmit": true, + "noEmit": true }, - "include": ["*.ts"], + "include": ["*.ts"] } diff --git a/lib/schema/package.json b/lib/schema/package.json index deb03b46..0d7b0b6c 100644 --- a/lib/schema/package.json +++ b/lib/schema/package.json @@ -12,10 +12,7 @@ "main": "dist/index.js", "module": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "sideEffects": false, "scripts": { "generate": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only dev/generateJsonSchemaTypes.ts src/openctx.schema.json > src/openctx.schema.ts && pnpm -w exec biome check --apply-unsafe \"$PNPM_SCRIPT_SRC_DIR/src/openctx.schema.ts\"", diff --git a/lib/schema/tsconfig.json b/lib/schema/tsconfig.json index f4b8b250..3009a05d 100644 --- a/lib/schema/tsconfig.json +++ b/lib/schema/tsconfig.json @@ -2,7 +2,7 @@ "extends": "../../.config/tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "dist", + "outDir": "dist" }, - "include": ["src"], + "include": ["src"] } diff --git a/lib/ui-common/package.json b/lib/ui-common/package.json index bfdd7f17..3600a5e1 100644 --- a/lib/ui-common/package.json +++ b/lib/ui-common/package.json @@ -11,12 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "!**/*.test.*", - "dist/**/*.d.ts" - ], + "files": ["dist", "src", "!**/*.test.*", "dist/**/*.d.ts"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/lib/ui-common/src/hover.test.ts b/lib/ui-common/src/hover.test.ts index ea648a24..d5038d9c 100644 --- a/lib/ui-common/src/hover.test.ts +++ b/lib/ui-common/src/hover.test.ts @@ -10,7 +10,7 @@ describe('renderHoverToHTML', () => { expect( renderHoverToHTML({ text: 'Some **text**', - }) + }), ).toEqual({ value: 'Some **text**', format: 'text', @@ -23,7 +23,7 @@ describe('renderHoverToHTML', () => { renderHoverToHTML({ markdown: '## Header\n\n* list', text: 'foo', - }) + }), ).toEqual({ value: '

Header

\n
    \n
  • list
  • \n
', format: 'html', @@ -35,7 +35,7 @@ describe('renderHoverToHTML', () => { renderHoverToHTML({ markdown: '**a** z x', - }) + }), ).toEqual({ value: 'a z x', format: 'html', diff --git a/lib/ui-common/src/ui.test.ts b/lib/ui-common/src/ui.test.ts index d51f48ca..61e5dda0 100644 --- a/lib/ui-common/src/ui.test.ts +++ b/lib/ui-common/src/ui.test.ts @@ -22,7 +22,7 @@ describe('prepareAnnotationsForPresentation', () => { }, item: { title: '2' }, }, - ]) + ]), ).toEqual>([ { uri: 'file:///f', diff --git a/lib/ui-common/src/ui.ts b/lib/ui-common/src/ui.ts index 4bf88125..f03c007f 100644 --- a/lib/ui-common/src/ui.ts +++ b/lib/ui-common/src/ui.ts @@ -9,10 +9,10 @@ export interface AnnotationWithRichRange extends Omit( - anns: AnnotationWithRichRange[] + anns: AnnotationWithRichRange[], ): AnnotationWithRichRange[] export function prepareAnnotationsForPresentation( - anns: AnnotationWithRichRange[] + anns: AnnotationWithRichRange[], ): AnnotationWithRichRange[] { return anns.sort((a, b) => (a.range?.start.line ?? 0) - (b.range?.start.line ?? 0)) } diff --git a/lib/ui-common/tsconfig.json b/lib/ui-common/tsconfig.json index 945de3f3..4f3b30b6 100644 --- a/lib/ui-common/tsconfig.json +++ b/lib/ui-common/tsconfig.json @@ -3,13 +3,13 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "lib": ["DOM", "ESNext"], + "lib": ["DOM", "ESNext"] }, "include": ["src"], "exclude": ["dist"], "references": [ { - "path": "../schema", - }, - ], + "path": "../schema" + } + ] } diff --git a/lib/ui-react/package.json b/lib/ui-react/package.json index 65599b3e..360b3ff0 100644 --- a/lib/ui-react/package.json +++ b/lib/ui-react/package.json @@ -11,14 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "!**/*.test.*", - "!**/*.story.*", - "!dist/**/*.ts?(x)", - "dist/**/*.d.ts" - ], + "files": ["dist", "src", "!**/*.test.*", "!**/*.story.*", "!dist/**/*.ts?(x)", "dist/**/*.d.ts"], "sideEffects": false, "scripts": { "prebuild": "mkdir -p dist && cp -R src/* dist/ && find dist/ -name '*.tsx' -delete", diff --git a/lib/ui-react/src/chip/BaseChip.module.css b/lib/ui-react/src/chip/BaseChip.module.css index 51281d16..39ab822e 100644 --- a/lib/ui-react/src/chip/BaseChip.module.css +++ b/lib/ui-react/src/chip/BaseChip.module.css @@ -25,7 +25,7 @@ z-index: 1; /* Just in case `pointer-events: none` is set on a parent. */ pointer-events: auto; - content: ''; + content: ""; } .popover-content { diff --git a/lib/ui-react/tsconfig.json b/lib/ui-react/tsconfig.json index 39941ae9..7181f9db 100644 --- a/lib/ui-react/tsconfig.json +++ b/lib/ui-react/tsconfig.json @@ -4,19 +4,19 @@ "rootDir": "src", "outDir": "dist", "jsx": "react-jsx", - "lib": ["DOM", "ESNext"], + "lib": ["DOM", "ESNext"] }, "include": ["src"], "exclude": ["dist"], "references": [ { - "path": "../schema", + "path": "../schema" }, { - "path": "../ui-standalone", + "path": "../ui-standalone" }, { - "path": "../ui-common", - }, - ], + "path": "../ui-common" + } + ] } diff --git a/lib/ui-standalone/package.json b/lib/ui-standalone/package.json index 7f02fd57..afa6110d 100644 --- a/lib/ui-standalone/package.json +++ b/lib/ui-standalone/package.json @@ -11,14 +11,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "!**/*.test.*", - "!**/*.story.*", - "!dist/**/*.ts?(x)", - "dist/**/*.d.ts" - ], + "files": ["dist", "src", "!**/*.test.*", "!**/*.story.*", "!dist/**/*.ts?(x)", "dist/**/*.d.ts"], "sideEffects": false, "scripts": { "prebuild": "mkdir -p dist && cp -R src/* dist/ && find dist/ -name '*.ts' -not -name '*.d.ts' -delete", diff --git a/lib/ui-standalone/src/chip/BaseChip.module.css b/lib/ui-standalone/src/chip/BaseChip.module.css index 898b2828..c5e8dd5d 100644 --- a/lib/ui-standalone/src/chip/BaseChip.module.css +++ b/lib/ui-standalone/src/chip/BaseChip.module.css @@ -25,7 +25,7 @@ z-index: 1; /* Just in case `pointer-events: none` is set on a parent. */ pointer-events: auto; - content: ''; + content: ""; } .popover { diff --git a/lib/ui-standalone/src/chip/popover.ts b/lib/ui-standalone/src/chip/popover.ts index 434ffc53..7786e2a7 100644 --- a/lib/ui-standalone/src/chip/popover.ts +++ b/lib/ui-standalone/src/chip/popover.ts @@ -9,7 +9,7 @@ type PRect = Partial & { export function getPopoverDimensions( targetEl: HTMLElement, - popoverEl: HTMLElement + popoverEl: HTMLElement, ): { top: string; left: string } { return positionTopStart(targetEl.getBoundingClientRect(), popoverEl.getBoundingClientRect()) } @@ -30,7 +30,7 @@ function getCollisions( targetRect: PRect, popoverRect: PRect, offsetLeft = 0, - offsetBottom = 0 + offsetBottom = 0, ): { directionRight: boolean directionLeft: boolean diff --git a/lib/ui-standalone/tsconfig.json b/lib/ui-standalone/tsconfig.json index ae10c77b..209c817e 100644 --- a/lib/ui-standalone/tsconfig.json +++ b/lib/ui-standalone/tsconfig.json @@ -3,16 +3,16 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "lib": ["DOM", "ESNext"], + "lib": ["DOM", "ESNext"] }, "include": ["src"], "exclude": ["dist"], "references": [ { - "path": "../schema", + "path": "../schema" }, { - "path": "../ui-common", - }, - ], + "path": "../ui-common" + } + ] } diff --git a/package.json b/package.json index 285c6a01..008f3d46 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,13 @@ "generate": "pnpm run --recursive generate", "check": "pnpm run -s biome && pnpm run -s check:css", "check:css": "stylelint --quiet --cache '**/*.css'", - "biome": "biome check --apply --error-on-warnings .", + "biome": "biome check --write --error-on-warnings .", "test": "vitest", "test:unit": "vitest run", "test:integration": "pnpm -C vscode test:integration" }, "devDependencies": { - "@biomejs/biome": "1.5.3", + "@biomejs/biome": "1.8.3", "@storybook/addon-essentials": "^7.6.7", "@storybook/html": "^7.6.7", "@storybook/html-vite": "^7.6.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df4e6e02..422305ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,8 @@ importers: .: devDependencies: '@biomejs/biome': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.8.3 + version: 1.8.3 '@storybook/addon-essentials': specifier: ^7.6.7 version: 7.6.17(react-dom@18.2.0)(react@18.2.0) @@ -2467,88 +2467,88 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@biomejs/biome@1.5.3: - resolution: {integrity: sha512-yvZCa/g3akwTaAQ7PCwPWDCkZs3Qa5ONg/fgOUT9e6wAWsPftCjLQFPXBeGxPK30yZSSpgEmRCfpGTmVbUjGgg==} - engines: {node: '>=14.*'} + /@biomejs/biome@1.8.3: + resolution: {integrity: sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==} + engines: {node: '>=14.21.3'} hasBin: true requiresBuild: true optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.5.3 - '@biomejs/cli-darwin-x64': 1.5.3 - '@biomejs/cli-linux-arm64': 1.5.3 - '@biomejs/cli-linux-arm64-musl': 1.5.3 - '@biomejs/cli-linux-x64': 1.5.3 - '@biomejs/cli-linux-x64-musl': 1.5.3 - '@biomejs/cli-win32-arm64': 1.5.3 - '@biomejs/cli-win32-x64': 1.5.3 - dev: true - - /@biomejs/cli-darwin-arm64@1.5.3: - resolution: {integrity: sha512-ImU7mh1HghEDyqNmxEZBoMPr8SxekkZuYcs+gynKlNW+TALQs7swkERiBLkG9NR0K1B3/2uVzlvYowXrmlW8hw==} - engines: {node: '>=14.*'} + '@biomejs/cli-darwin-arm64': 1.8.3 + '@biomejs/cli-darwin-x64': 1.8.3 + '@biomejs/cli-linux-arm64': 1.8.3 + '@biomejs/cli-linux-arm64-musl': 1.8.3 + '@biomejs/cli-linux-x64': 1.8.3 + '@biomejs/cli-linux-x64-musl': 1.8.3 + '@biomejs/cli-win32-arm64': 1.8.3 + '@biomejs/cli-win32-x64': 1.8.3 + dev: true + + /@biomejs/cli-darwin-arm64@1.8.3: + resolution: {integrity: sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==} + engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@biomejs/cli-darwin-x64@1.5.3: - resolution: {integrity: sha512-vCdASqYnlpq/swErH7FD6nrFz0czFtK4k/iLgj0/+VmZVjineFPgevOb+Sr9vz0tk0GfdQO60bSpI74zU8M9Dw==} - engines: {node: '>=14.*'} + /@biomejs/cli-darwin-x64@1.8.3: + resolution: {integrity: sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==} + engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@biomejs/cli-linux-arm64-musl@1.5.3: - resolution: {integrity: sha512-DYuMizUYUBYfS0IHGjDrOP1RGipqWfMGEvNEJ398zdtmCKLXaUvTimiox5dvx4X15mBK5M2m8wgWUgOP1giUpQ==} - engines: {node: '>=14.*'} + /@biomejs/cli-linux-arm64-musl@1.8.3: + resolution: {integrity: sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==} + engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@biomejs/cli-linux-arm64@1.5.3: - resolution: {integrity: sha512-cupBQv0sNF1OKqBfx7EDWMSsKwRrBUZfjXawT4s6hKV6ALq7p0QzWlxr/sDmbKMLOaLQtw2Qgu/77N9rm+f9Rg==} - engines: {node: '>=14.*'} + /@biomejs/cli-linux-arm64@1.8.3: + resolution: {integrity: sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==} + engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@biomejs/cli-linux-x64-musl@1.5.3: - resolution: {integrity: sha512-UUHiAnlDqr2Y/LpvshBFhUYMWkl2/Jn+bi3U6jKuav0qWbbBKU/ByHgR4+NBxpKBYoCtWxhnmatfH1bpPIuZMw==} - engines: {node: '>=14.*'} + /@biomejs/cli-linux-x64-musl@1.8.3: + resolution: {integrity: sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==} + engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@biomejs/cli-linux-x64@1.5.3: - resolution: {integrity: sha512-YQrSArQvcv4FYsk7Q91Yv4uuu5F8hJyORVcv3zsjCLGkjIjx2RhjYLpTL733SNL7v33GmOlZY0eFR1ko38tuUw==} - engines: {node: '>=14.*'} + /@biomejs/cli-linux-x64@1.8.3: + resolution: {integrity: sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==} + engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@biomejs/cli-win32-arm64@1.5.3: - resolution: {integrity: sha512-HxatYH7vf/kX9nrD+pDYuV2GI9GV8EFo6cfKkahAecTuZLPxryHx1WEfJthp5eNsE0+09STGkKIKjirP0ufaZA==} - engines: {node: '>=14.*'} + /@biomejs/cli-win32-arm64@1.8.3: + resolution: {integrity: sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==} + engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@biomejs/cli-win32-x64@1.5.3: - resolution: {integrity: sha512-fMvbSouZEASU7mZH8SIJSANDm5OqsjgtVXlbUqxwed6BP7uuHRSs396Aqwh2+VoW8fwTpp6ybIUoC9FrzB0kyA==} - engines: {node: '>=14.*'} + /@biomejs/cli-win32-x64@1.8.3: + resolution: {integrity: sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==} + engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] requiresBuild: true diff --git a/provider/azure-devops-workitems/api.ts b/provider/azure-devops-workitems/api.ts index 24c7f1c9..8eabddad 100644 --- a/provider/azure-devops-workitems/api.ts +++ b/provider/azure-devops-workitems/api.ts @@ -48,7 +48,7 @@ const buildUrl = (settings: Settings, path: string, searchParams: Record => { let searchId = Number(query) if (Number.isNaN(searchId)) { @@ -82,7 +82,7 @@ ORDER BY [System.ChangedDate] DESC throw new Error( `Error fetching Azure DevOps query (${queryResponse?.status} ${ queryResponse?.statusText - }): ${await queryResponse?.text()}` + }): ${await queryResponse?.text()}`, ) } @@ -115,7 +115,7 @@ ORDER BY [System.ChangedDate] DESC throw new Error( `Error fetching Azure DevOps work items (${workItemsResponse?.status} ${ workItemsResponse?.statusText - }): ${await workItemsResponse?.text()}` + }): ${await workItemsResponse?.text()}`, ) } @@ -139,7 +139,7 @@ ORDER BY [System.ChangedDate] DESC export const fetchWorkItem = async ( workItemId: string | number, - settings: Settings + settings: Settings, ): Promise => { const fields = [ WorkItemFields.Id, @@ -165,7 +165,7 @@ export const fetchWorkItem = async ( throw new Error( `Error fetching Azure DevOps work item (${workItemResponse?.status} ${ workItemResponse?.statusText - }): ${await workItemResponse?.text()}` + }): ${await workItemResponse?.text()}`, ) } diff --git a/provider/azure-devops-workitems/index.ts b/provider/azure-devops-workitems/index.ts index 6b797c2d..a0c7f0da 100644 --- a/provider/azure-devops-workitems/index.ts +++ b/provider/azure-devops-workitems/index.ts @@ -71,7 +71,7 @@ const azureDevOps: Provider = { uri: item.url, description: item.description, data: { id: item.id }, - })) + })), ) }, diff --git a/provider/azure-devops-workitems/package.json b/provider/azure-devops-workitems/package.json index 6dc2de39..ec267cf8 100644 --- a/provider/azure-devops-workitems/package.json +++ b/provider/azure-devops-workitems/package.json @@ -13,10 +13,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/confluence/api.ts b/provider/confluence/api.ts index cdc6ca9a..e2bfecc8 100644 --- a/provider/confluence/api.ts +++ b/provider/confluence/api.ts @@ -41,7 +41,7 @@ export const listPages = async (settings: Settings, query?: string): Promise => if (!response.ok) { throw new Error( - `Error getting content (${response.status} ${response.statusText}): ${await response.text()}` + `Error getting content (${response.status} ${response.statusText}): ${await response.text()}`, ) } diff --git a/provider/confluence/package.json b/provider/confluence/package.json index 0cbf16d4..9926228c 100644 --- a/provider/confluence/package.json +++ b/provider/confluence/package.json @@ -13,10 +13,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/confluence/tsconfig.json b/provider/confluence/tsconfig.json index d4f7f956..a1d94187 100644 --- a/provider/confluence/tsconfig.json +++ b/provider/confluence/tsconfig.json @@ -1,12 +1,11 @@ { - "extends": "../../.config/tsconfig.base.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "dist", - "lib": ["ESNext"], - }, - "include": ["*.ts"], - "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], - } - \ No newline at end of file + "extends": "../../.config/tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "dist", + "lib": ["ESNext"] + }, + "include": ["*.ts"], + "exclude": ["dist", "vitest.config.ts"], + "references": [{ "path": "../../lib/provider" }] +} diff --git a/provider/devdocs/__fixtures__/index.json b/provider/devdocs/__fixtures__/index.json index 92237d62..c97e3e57 100644 --- a/provider/devdocs/__fixtures__/index.json +++ b/provider/devdocs/__fixtures__/index.json @@ -8,7 +8,11 @@ { "name": "strconv.AppendFloat()", "path": "strconv/index#AppendFloat", "type": "strconv" }, { "name": "strconv.AppendInt()", "path": "strconv/index#AppendInt", "type": "strconv" }, { "name": "strconv.AppendQuote()", "path": "strconv/index#AppendQuote", "type": "strconv" }, - { "name": "strconv.AppendQuoteRune()", "path": "strconv/index#AppendQuoteRune", "type": "strconv" }, + { + "name": "strconv.AppendQuoteRune()", + "path": "strconv/index#AppendQuoteRune", + "type": "strconv" + }, { "name": "strconv.AppendQuoteRuneToASCII()", "path": "strconv/index#AppendQuoteRuneToASCII", @@ -41,8 +45,16 @@ { "name": "strconv.IsPrint()", "path": "strconv/index#IsPrint", "type": "strconv" }, { "name": "strconv.Itoa()", "path": "strconv/index#Itoa", "type": "strconv" }, { "name": "strconv.NumError", "path": "strconv/index#NumError", "type": "strconv" }, - { "name": "strconv.NumError.Error()", "path": "strconv/index#NumError.Error", "type": "strconv" }, - { "name": "strconv.NumError.Unwrap()", "path": "strconv/index#NumError.Unwrap", "type": "strconv" }, + { + "name": "strconv.NumError.Error()", + "path": "strconv/index#NumError.Error", + "type": "strconv" + }, + { + "name": "strconv.NumError.Unwrap()", + "path": "strconv/index#NumError.Unwrap", + "type": "strconv" + }, { "name": "strconv.ParseBool()", "path": "strconv/index#ParseBool", "type": "strconv" }, { "name": "strconv.ParseComplex()", "path": "strconv/index#ParseComplex", "type": "strconv" }, { "name": "strconv.ParseFloat()", "path": "strconv/index#ParseFloat", "type": "strconv" }, @@ -62,7 +74,11 @@ "type": "strconv" }, { "name": "strconv.QuoteToASCII()", "path": "strconv/index#QuoteToASCII", "type": "strconv" }, - { "name": "strconv.QuoteToGraphic()", "path": "strconv/index#QuoteToGraphic", "type": "strconv" }, + { + "name": "strconv.QuoteToGraphic()", + "path": "strconv/index#QuoteToGraphic", + "type": "strconv" + }, { "name": "strconv.Unquote()", "path": "strconv/index#Unquote", "type": "strconv" }, { "name": "strconv.UnquoteChar()", "path": "strconv/index#UnquoteChar", "type": "strconv" } ], diff --git a/provider/devdocs/index.test.ts b/provider/devdocs/index.test.ts index f07884f4..9b82f101 100644 --- a/provider/devdocs/index.test.ts +++ b/provider/devdocs/index.test.ts @@ -28,8 +28,8 @@ describe('devdocs', () => { 'https://devdocs.io/css/', 'https://devdocs.io/typescript/', ], - } - ) + }, + ), ).toEqual({ name: 'DevDocs', mentions: { label: 'Search docs... (angular~16, css, typescript)' }, @@ -52,8 +52,8 @@ describe('devdocs', () => { 'hello world', '', ], - } - ) + }, + ), ).toEqual({ name: 'DevDocs', mentions: { label: 'Search docs... (go, 152)' }, @@ -76,7 +76,7 @@ describe('devdocs', () => { uri: url.pathToFileURL(mentionPath).toString(), }) expect(item.ai?.content).toContain( - 'Package strconv implements conversions to and from string representations of basic data types.' + 'Package strconv implements conversions to and from string representations of basic data types.', ) }) test.runIf(INTEGRATION)('integration test page type', async () => { @@ -89,7 +89,7 @@ describe('devdocs', () => { uri: 'https://devdocs.io/go/strconv/index', }) expect(item.ai?.content).toContain( - 'Package strconv implements conversions to and from string representations of basic data types.' + 'Package strconv implements conversions to and from string representations of basic data types.', ) }) @@ -114,7 +114,7 @@ describe('devdocs', () => { '}\n' + '\n' + '

Output:

some io.Reader stream to be read\n' +
-                '
' + '', ) }) test.runIf(INTEGRATION)('integration test hash type', async () => { @@ -138,7 +138,7 @@ describe('devdocs', () => { '}\n' + '\n' + '

Output:

some io.Reader stream to be read\n' +
-                '
' + '', ) }) @@ -166,7 +166,7 @@ describe('devdocs', () => { async function expectMentionItem( params: MentionsParams, settings: Settings, - mention: Mention + mention: Mention, ): Promise { const mentions = await devdocs.mentions!(params, settings) expect(mentions).toContainEqual(mention) diff --git a/provider/devdocs/index.ts b/provider/devdocs/index.ts index 1b615ed5..5a673944 100644 --- a/provider/devdocs/index.ts +++ b/provider/devdocs/index.ts @@ -154,7 +154,7 @@ function extractHashContent(content: string, hash: string): string { // "H2". However, I haven't exhaustively tested this so conservatively we // stop at any more important header or the same tagName. const stopTags = [first.tagName] - const headerNum = first.tagName.startsWith('H') ? parseInt(first.tagName.slice(1)) : 0 + const headerNum = first.tagName.startsWith('H') ? Number.parseInt(first.tagName.slice(1)) : 0 for (let i = 1; i < headerNum; i++) { stopTags.push(`H${i}`) } diff --git a/provider/devdocs/package.json b/provider/devdocs/package.json index 51754283..a207ffed 100644 --- a/provider/devdocs/package.json +++ b/provider/devdocs/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --platform=node --outfile=dist/bundle.js index.ts", diff --git a/provider/devdocs/tsconfig.json b/provider/devdocs/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/devdocs/tsconfig.json +++ b/provider/devdocs/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/devdocs/update-fixtures.ts b/provider/devdocs/update-fixtures.ts index 1cc51420..6cd8065a 100644 --- a/provider/devdocs/update-fixtures.ts +++ b/provider/devdocs/update-fixtures.ts @@ -28,7 +28,7 @@ async function main() { index.entries = index.entries.filter( entry => entry.name.toLowerCase().includes('teereader') || - entry.name.toLowerCase().includes('strconv') + entry.name.toLowerCase().includes('strconv'), ) await writeFixture('index.json', JSON.stringify(index)) diff --git a/provider/github/client.ts b/provider/github/client.ts index 2b70cda7..f46c9466 100644 --- a/provider/github/client.ts +++ b/provider/github/client.ts @@ -29,7 +29,7 @@ export class GithubClient { req: E, params: E extends keyof Endpoints ? Endpoints[E]['parameters'] & RequestParameters - : RequestParameters + : RequestParameters, ): Promise { const response = await this.octokit.request(req, params) diff --git a/provider/github/issue.ts b/provider/github/issue.ts index 4a7e720b..1009ad1b 100644 --- a/provider/github/issue.ts +++ b/provider/github/issue.ts @@ -9,7 +9,7 @@ export async function fetchIssue( githubClient: GithubClient, owner: string, repoName: string, - number: number + number: number, ): Promise { try { const issue = await githubClient.request('GET /repos/{owner}/{repo}/issues/{issue_number}', { @@ -29,7 +29,7 @@ const xmlBuilder = new XMLBuilder({ export async function getIssueItems( client: GithubClient, - { owner, repoName, issue }: { owner: string; repoName: string; issue: Issue } + { owner, repoName, issue }: { owner: string; repoName: string; issue: Issue }, ): Promise { const comments = await client .request('GET /repos/{owner}/{repo}/issues/{issue_number}/comments', { diff --git a/provider/github/package.json b/provider/github/package.json index fd7bd73b..b48b263d 100644 --- a/provider/github/package.json +++ b/provider/github/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/github/pr.ts b/provider/github/pr.ts index eaf68751..649cc0af 100644 --- a/provider/github/pr.ts +++ b/provider/github/pr.ts @@ -9,7 +9,7 @@ export async function fetchPR( githubClient: GithubClient, owner: string, repoName: string, - number: number + number: number, ): Promise { try { const pr = await githubClient.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', { @@ -29,7 +29,7 @@ const xmlBuilder = new XMLBuilder({ export async function getPullRequestItems( client: GithubClient, - { owner, repoName, pr }: { owner: string; repoName: string; pr: PR } + { owner, repoName, pr }: { owner: string; repoName: string; pr: PR }, ): Promise { const [diff, comments, reviewComments] = await Promise.all([ client diff --git a/provider/github/provider.ts b/provider/github/provider.ts index b317a317..6dc447da 100644 --- a/provider/github/provider.ts +++ b/provider/github/provider.ts @@ -102,7 +102,7 @@ export function parseQuery(query = ''): { owner: string; repoName: string; numbe if (!['issues', 'pull'].includes(kind)) { return null } - return { owner, repoName, number: parseInt(numberText) } + return { owner, repoName, number: Number.parseInt(numberText) } } } catch { let [_, owner, repoName, kind, numberText] = query.split('/') @@ -113,11 +113,11 @@ export function parseQuery(query = ''): { owner: string; repoName: string; numbe if (query.includes(':')) { const [owner, repoName] = query.substring(0, query.lastIndexOf(':')).split('/') const [_, numberText] = query.split(':') - return { owner, repoName, number: parseInt(numberText) } + return { owner, repoName, number: Number.parseInt(numberText) } } return null } - return { owner, repoName, number: parseInt(numberText) } + return { owner, repoName, number: Number.parseInt(numberText) } } return null diff --git a/provider/github/tsconfig.json b/provider/github/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/github/tsconfig.json +++ b/provider/github/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/google-docs/api.ts b/provider/google-docs/api.ts index fa40ffca..5fb54379 100644 --- a/provider/google-docs/api.ts +++ b/provider/google-docs/api.ts @@ -10,14 +10,14 @@ function validateSettings(settings: Settings): Required { const googleOAuthClient = settings.googleOAuthClient if (!googleOAuthClient) { throw new Error( - 'must provide a Google OAuth client configuration in the `googleOAuthClient` settings field' + 'must provide a Google OAuth client configuration in the `googleOAuthClient` settings field', ) } const googleOAuthCredentials = settings.googleOAuthCredentials if (!googleOAuthCredentials) { throw new Error( - 'must provide a Google OAuth credentials configuration in the `googleOAuthCredentials` settings field' + 'must provide a Google OAuth credentials configuration in the `googleOAuthCredentials` settings field', ) } diff --git a/provider/google-docs/auth.ts b/provider/google-docs/auth.ts index 8530e229..247ac7d0 100644 --- a/provider/google-docs/auth.ts +++ b/provider/google-docs/auth.ts @@ -1,6 +1,6 @@ -import http from 'http' -import type { AddressInfo } from 'net' import { readFileSync } from 'node:fs' +import http from 'node:http' +import type { AddressInfo } from 'node:net' import url from 'node:url' import dedent from 'dedent' import { OAuth2Client } from 'google-auth-library' diff --git a/provider/google-docs/package.json b/provider/google-docs/package.json index d32b3c93..98509280 100644 --- a/provider/google-docs/package.json +++ b/provider/google-docs/package.json @@ -11,10 +11,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --platform=node --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/google-docs/tsconfig.json b/provider/google-docs/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/google-docs/tsconfig.json +++ b/provider/google-docs/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/hello-world/index.test.ts b/provider/hello-world/index.test.ts index f337b79c..eb8faf43 100644 --- a/provider/hello-world/index.test.ts +++ b/provider/hello-world/index.test.ts @@ -17,8 +17,8 @@ describe('helloWorld', () => { uri: 'file:///a', content: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'].join('\n'), }, - {} - ) + {}, + ), ).toStrictEqual([ { uri: 'file:///a', diff --git a/provider/hello-world/package.json b/provider/hello-world/package.json index 6bffbdba..8ecd6139 100644 --- a/provider/hello-world/package.json +++ b/provider/hello-world/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist/index.js", - "dist/index.d.ts" - ], + "files": ["dist/index.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/provider/hello-world/tsconfig.json b/provider/hello-world/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/hello-world/tsconfig.json +++ b/provider/hello-world/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/jira/api.ts b/provider/jira/api.ts index e51a96bc..e8c3feb4 100644 --- a/provider/jira/api.ts +++ b/provider/jira/api.ts @@ -30,7 +30,7 @@ const buildUrl = (settings: Settings, path: string, searchParams: Record => { const pickerResponse = await fetch( buildUrl(settings, '/rest/api/2/issue/picker', { @@ -39,13 +39,13 @@ export const searchIssues = async ( { method: 'GET', headers: authHeaders(settings), - } + }, ) if (!pickerResponse.ok) { throw new Error( `Error fetching recent JIRA issues (${pickerResponse.status} ${ pickerResponse.statusText - }): ${await pickerResponse.text()}` + }): ${await pickerResponse.text()}`, ) } @@ -77,13 +77,13 @@ export const fetchIssue = async (issueId: string, settings: Settings): Promise fetchIssue(subtask.key, settings).then(childIssue => { return childIssue ? issueToItem(childIssue) : null - }) - ) + }), + ), ) const items = [issueToItem(issue), ...childIssues.filter((item): item is Item => item !== null)] diff --git a/provider/jira/package.json b/provider/jira/package.json index 44511cae..c98bdb91 100644 --- a/provider/jira/package.json +++ b/provider/jira/package.json @@ -13,10 +13,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/jira/tsconfig.json b/provider/jira/tsconfig.json index d4f7f956..a1d94187 100644 --- a/provider/jira/tsconfig.json +++ b/provider/jira/tsconfig.json @@ -1,12 +1,11 @@ { - "extends": "../../.config/tsconfig.base.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "dist", - "lib": ["ESNext"], - }, - "include": ["*.ts"], - "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], - } - \ No newline at end of file + "extends": "../../.config/tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "dist", + "lib": ["ESNext"] + }, + "include": ["*.ts"], + "exclude": ["dist", "vitest.config.ts"], + "references": [{ "path": "../../lib/provider" }] +} diff --git a/provider/linear-docs/auth.ts b/provider/linear-docs/auth.ts index 6ac41e28..8c7934d5 100644 --- a/provider/linear-docs/auth.ts +++ b/provider/linear-docs/auth.ts @@ -1,7 +1,7 @@ -import http from 'http' // Identical to provider/linear-issues/auth.ts. // Keep the duplicate for now to keep things simple. import { readFileSync, writeFileSync } from 'node:fs' +import http from 'node:http' import path from 'node:path' import url, { fileURLToPath } from 'node:url' import open from 'open' diff --git a/provider/linear-docs/index.ts b/provider/linear-docs/index.ts index 5ff4b398..4f4dc3e5 100644 --- a/provider/linear-docs/index.ts +++ b/provider/linear-docs/index.ts @@ -112,14 +112,14 @@ function getAccessToken(settings: Settings): string { } throw new Error( - 'must provide a Linear user credentials path in the `userCredentialsPath` settings field or an accessToken in the linearClientOptions' + 'must provide a Linear user credentials path in the `userCredentialsPath` settings field or an accessToken in the linearClientOptions', ) } async function linearApiRequest( query: string, variables: object, - settings: Settings + settings: Settings, ): Promise<{ data: any }> { const accessToken = getAccessToken(settings) const response = await fetch('https://api.linear.app/graphql', { @@ -134,7 +134,7 @@ async function linearApiRequest( if (!response.ok) { const errorBody = await response.text() console.error( - `Linear API request failed: ${response.status} - ${response.statusText}\n${errorBody}` + `Linear API request failed: ${response.status} - ${response.statusText}\n${errorBody}`, ) throw new Error(`Linear API request failed: ${response.statusText}`) } diff --git a/provider/linear-docs/package.json b/provider/linear-docs/package.json index 059900b9..f3b41e20 100644 --- a/provider/linear-docs/package.json +++ b/provider/linear-docs/package.json @@ -11,10 +11,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/provider/linear-docs/tsconfig.json b/provider/linear-docs/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/linear-docs/tsconfig.json +++ b/provider/linear-docs/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/linear-issues/auth.ts b/provider/linear-issues/auth.ts index 5e0050d0..d23a1353 100644 --- a/provider/linear-issues/auth.ts +++ b/provider/linear-issues/auth.ts @@ -1,7 +1,7 @@ -import http from 'http' // Identical to provider/linear-docs/auth.ts. // Keep the duplicate for now to keep things simple. import { readFileSync, writeFileSync } from 'node:fs' +import http from 'node:http' import path from 'node:path' import url, { fileURLToPath } from 'node:url' import open from 'open' diff --git a/provider/linear-issues/index.ts b/provider/linear-issues/index.ts index ffb85b31..f37451fd 100644 --- a/provider/linear-issues/index.ts +++ b/provider/linear-issues/index.ts @@ -130,14 +130,14 @@ async function getAccessToken(settings: Settings): Promise { } throw new Error( - 'must provide a Linear user credentials path in the `userCredentialsPath` settings field or an accessToken in the linearClientOptions' + 'must provide a Linear user credentials path in the `userCredentialsPath` settings field or an accessToken in the linearClientOptions', ) } async function linearApiRequest( query: string, variables: object, - settings: Settings + settings: Settings, ): Promise<{ data: any }> { const accessToken = await getAccessToken(settings) const response = await fetch('https://api.linear.app/graphql', { @@ -190,7 +190,7 @@ async function getAccessTokenLinearConnect(): Promise { const ext = vscode.extensions.getExtension(LINEAR_AUTHENTICATION_EXTENSION_ID) if (!ext) { vscode.window.showWarningMessage( - 'Cody requires the Linear Connect extension to be installed and activated.' + 'Cody requires the Linear Connect extension to be installed and activated.', ) await vscode.commands.executeCommand('workbench.extensions.action.showExtensionsWithIds', [ [LINEAR_AUTHENTICATION_EXTENSION_ID], @@ -200,7 +200,7 @@ async function getAccessTokenLinearConnect(): Promise { const session = await vscode.authentication.getSession( LINEAR_AUTHENTICATION_PROVIDER_ID, LINEAR_AUTHENTICATION_SCOPES, - { createIfNone: true } + { createIfNone: true }, ) if (!session) { diff --git a/provider/linear-issues/package.json b/provider/linear-issues/package.json index 39e56f9a..b75e356f 100644 --- a/provider/linear-issues/package.json +++ b/provider/linear-issues/package.json @@ -11,10 +11,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "build": "tsc --build", diff --git a/provider/linear-issues/tsconfig.json b/provider/linear-issues/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/linear-issues/tsconfig.json +++ b/provider/linear-issues/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/links/index.test.ts b/provider/links/index.test.ts index 724d83ff..0c43d8e0 100644 --- a/provider/links/index.test.ts +++ b/provider/links/index.test.ts @@ -38,8 +38,8 @@ describe('links', () => { uri: 'file:///a/b.ts', content: '0foo0\nbar\nbaz\n1foo1', }, - SETTINGS - ) + SETTINGS, + ), ).toEqual([ { uri: 'file:///a/b.ts', @@ -81,8 +81,8 @@ describe('links', () => { expect( links.annotations?.( { uri: 'file:///a/b.ts', content: 'log.Print(foo, b/a+r)' }, - settingsWithCaptureGroups - ) + settingsWithCaptureGroups, + ), ).toEqual([ { uri: 'file:///a/b.ts', diff --git a/provider/links/package.json b/provider/links/package.json index fe3fe770..433cd184 100644 --- a/provider/links/package.json +++ b/provider/links/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/links/tsconfig.json b/provider/links/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/links/tsconfig.json +++ b/provider/links/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/notion/package.json b/provider/notion/package.json index 9c7a2959..1755ac10 100644 --- a/provider/notion/package.json +++ b/provider/notion/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/notion/tsconfig.json b/provider/notion/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/notion/tsconfig.json +++ b/provider/notion/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/prometheus/index.test.ts b/provider/prometheus/index.test.ts index faab830a..3ece41c9 100644 --- a/provider/prometheus/index.test.ts +++ b/provider/prometheus/index.test.ts @@ -35,8 +35,8 @@ var histogram = promauto.NewHistogram(prometheus.HistogramOpts{ Buckets: prometheus.LinearBuckets(-3, .1, 61), })`.trim(), }, - SETTINGS - ) + SETTINGS, + ), ).toEqual([ { uri: 'file:///a/b.go', diff --git a/provider/prometheus/package.json b/provider/prometheus/package.json index 8bffaf5c..d494fc41 100644 --- a/provider/prometheus/package.json +++ b/provider/prometheus/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/prometheus/tsconfig.json b/provider/prometheus/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/prometheus/tsconfig.json +++ b/provider/prometheus/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/semgrep/api.test.ts b/provider/semgrep/api.test.ts index 3b32c67c..5389af95 100644 --- a/provider/semgrep/api.test.ts +++ b/provider/semgrep/api.test.ts @@ -6,7 +6,7 @@ describe('api urlfor', () => { test('url parameters', () => { expect(urlfor('depl', 'repo')).toEqual('https://semgrep.dev/orgs/depl/findings?repo=repo') expect(urlfor('depl', 'repo', 123)).toEqual( - 'https://semgrep.dev/orgs/depl/findings/123?repo=repo' + 'https://semgrep.dev/orgs/depl/findings/123?repo=repo', ) }) }) diff --git a/provider/semgrep/index.ts b/provider/semgrep/index.ts index f9bc30b7..eb0c2f6c 100644 --- a/provider/semgrep/index.ts +++ b/provider/semgrep/index.ts @@ -23,7 +23,7 @@ function parseUri(link: string): { deployment: string; finding: number } | null if (url.hostname.includes('semgrep.dev')) { try { const [d, f] = url.pathname.split('/orgs/')[1].split('/findings/') - return { deployment: d, finding: parseInt(f) } + return { deployment: d, finding: Number.parseInt(f) } } catch (err) { return null } diff --git a/provider/semgrep/package.json b/provider/semgrep/package.json index 3514c34c..3979002f 100644 --- a/provider/semgrep/package.json +++ b/provider/semgrep/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "test": "vitest", diff --git a/provider/semgrep/tsconfig.json b/provider/semgrep/tsconfig.json index fbca2190..65c6271d 100644 --- a/provider/semgrep/tsconfig.json +++ b/provider/semgrep/tsconfig.json @@ -4,9 +4,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext", "DOM"], + "lib": ["ESNext", "DOM"] }, "include": ["*.ts"], "exclude": ["dist", "mocks", "*.test.*", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/sentry/package.json b/provider/sentry/package.json index 256ab039..0a5c4904 100644 --- a/provider/sentry/package.json +++ b/provider/sentry/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --platform=node --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/sentry/provider.test.ts b/provider/sentry/provider.test.ts index 829b6789..872cb283 100644 --- a/provider/sentry/provider.test.ts +++ b/provider/sentry/provider.test.ts @@ -21,8 +21,8 @@ describe('parseSentryURL', () => { }) expect( parseSentryURL( - 'https://example.sentry.io/issues/9876543210/?project=1234567&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=0' - ) + 'https://example.sentry.io/issues/9876543210/?project=1234567&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=0', + ), ).toEqual({ organizationId: 'example', issueId: '9876543210', @@ -217,7 +217,7 @@ describe('provider.mentions', () => { const params = { query: 'https://sentry.io/issues/123' } const settings = {} await expect(providerImplementation.mentions(params, settings)).rejects.toThrow( - 'Must provide a Sentry API token in the `apiToken` settings field, or a path to a file with the token in the `apiTokenPath` settings field.' + 'Must provide a Sentry API token in the `apiToken` settings field, or a path to a file with the token in the `apiTokenPath` settings field.', ) }) diff --git a/provider/sentry/provider.ts b/provider/sentry/provider.ts index a9333e99..6d95ae8c 100644 --- a/provider/sentry/provider.ts +++ b/provider/sentry/provider.ts @@ -33,7 +33,7 @@ export const providerImplementation = { const accessToken = await getSentryAccessToken(settings) if (accessToken === null) { throw new Error( - 'Must provide a Sentry API token in the `apiToken` settings field, or a path to a file with the token in the `apiTokenPath` settings field.' + 'Must provide a Sentry API token in the `apiToken` settings field, or a path to a file with the token in the `apiTokenPath` settings field.', ) } diff --git a/provider/sentry/sentryapi.test.ts b/provider/sentry/sentryapi.test.ts index 9d6882cd..6aa43511 100644 --- a/provider/sentry/sentryapi.test.ts +++ b/provider/sentry/sentryapi.test.ts @@ -36,7 +36,7 @@ describe('fetchIssue', () => { global.fetch = mockFetch await expect(fetchIssue('token', 'org', '123')).rejects.toThrowError( - 'Failed to fetch issue 123 from org: 500 Internal Server Error' + 'Failed to fetch issue 123 from org: 500 Internal Server Error', ) }) @@ -56,7 +56,7 @@ describe('fetchIssue', () => { global.fetch = mockFetch await expect(fetchIssue('token', 'org', '123', 10)).rejects.toThrowError( - 'The operation was aborted' + 'The operation was aborted', ) }) }) diff --git a/provider/sentry/sentryapi.ts b/provider/sentry/sentryapi.ts index bdbc8d75..d92210cb 100644 --- a/provider/sentry/sentryapi.ts +++ b/provider/sentry/sentryapi.ts @@ -94,7 +94,7 @@ export async function fetchIssue( sentryToken: string, organizationId: string, issueId: string, - timeoutMS = 5000 + timeoutMS = 5000, ): Promise { const abortController = new AbortController() setTimeout(() => abortController.abort(), timeoutMS) @@ -106,14 +106,14 @@ export async function fetchIssue( Authorization: `Bearer ${sentryToken}`, }, signal: abortController.signal, - } + }, ) if (!resp.ok) { if (resp.status === 404) { return null } throw new Error( - `Failed to fetch issue ${issueId} from ${organizationId}: ${resp.status} ${resp.statusText}` + `Failed to fetch issue ${issueId} from ${organizationId}: ${resp.status} ${resp.statusText}`, ) } return (await resp.json()) as Issue diff --git a/provider/sentry/tsconfig.json b/provider/sentry/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/sentry/tsconfig.json +++ b/provider/sentry/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/slack/client.ts b/provider/slack/client.ts index 27669d30..9e73d7e8 100644 --- a/provider/slack/client.ts +++ b/provider/slack/client.ts @@ -28,7 +28,7 @@ export class SlackClient { public async contextCandidatesFromRecentThreads( channelId: string | undefined, - limit = 10 + limit = 10, ): Promise { if (!channelId) { return [] @@ -85,13 +85,13 @@ export class SlackClient { channelId: string | undefined, query: string, channelCandidatesLimit = 10, - workspaceCandidatesLimit = 2 + workspaceCandidatesLimit = 2, ): Promise { const searchResults = await this.getContextFromSlackSearchApi( channelId, query, channelCandidatesLimit, - workspaceCandidatesLimit + workspaceCandidatesLimit, ) if (!searchResults) { return [] @@ -145,7 +145,7 @@ export class SlackClient { channelId: string | undefined, query: string, channelLimit: number, - workspaceLimit: number + workspaceLimit: number, ) { if (channelId) { const [channelSearchResults, workspaceSearchResults] = await Promise.all([ @@ -277,7 +277,7 @@ export class SlackClient { if (user.id && (user.profile?.display_name || user.profile?.real_name)) { this.useridMapping.set( user.id, - user.profile?.real_name || user.profile?.display_name || '' + user.profile?.real_name || user.profile?.display_name || '', ) } } diff --git a/provider/slack/package.json b/provider/slack/package.json index e6fa738c..99a19388 100644 --- a/provider/slack/package.json +++ b/provider/slack/package.json @@ -11,10 +11,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --platform=node --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/slack/tsconfig.json b/provider/slack/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/slack/tsconfig.json +++ b/provider/slack/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/sourcegraph-search/graphql.ts b/provider/sourcegraph-search/graphql.ts index 39a066b7..8a0622ad 100644 --- a/provider/sourcegraph-search/graphql.ts +++ b/provider/sourcegraph-search/graphql.ts @@ -5,7 +5,7 @@ export class SourcegraphGraphQLAPIClient { public async fetchSourcegraphAPI( query: string, - variables: Record = {} + variables: Record = {}, ): Promise { const headers = new Headers() headers.set('Content-Type', 'application/json; charset=utf-8') diff --git a/provider/sourcegraph-search/index.ts b/provider/sourcegraph-search/index.ts index 043f2c5a..b0ae7fb1 100644 --- a/provider/sourcegraph-search/index.ts +++ b/provider/sourcegraph-search/index.ts @@ -37,7 +37,7 @@ const sourcegraphSearch: Provider = { } const url = `${graphqlClient.endpoint}/search?q=${encodeURIComponent( - query.sourcegraphQuery + query.sourcegraphQuery, )}&patternType=literal` return [ diff --git a/provider/sourcegraph-search/package.json b/provider/sourcegraph-search/package.json index 008eb810..90867aee 100644 --- a/provider/sourcegraph-search/package.json +++ b/provider/sourcegraph-search/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/sourcegraph-search/search.ts b/provider/sourcegraph-search/search.ts index 5a9ba5e9..5c340cca 100644 --- a/provider/sourcegraph-search/search.ts +++ b/provider/sourcegraph-search/search.ts @@ -14,7 +14,7 @@ interface Chunk { export async function searchForFileChunks( graphqlClient: GraphQLClient, - query: string + query: string, ): Promise { const results = await graphqlClient .fetchSourcegraphAPI>(SEARCH_QUERY, { @@ -30,7 +30,7 @@ export async function searchForFileChunks( return result.chunkMatches.map(chunkMatch => { const lineRange = chunkMatchContentToLineRange( chunkMatch.content, - chunkMatch.contentStart.line + chunkMatch.contentStart.line, ) return { url: `${url}?L${lineRange}`, @@ -41,7 +41,7 @@ export async function searchForFileChunks( } satisfies Chunk }) }) - }) + }), ) return results } diff --git a/provider/sourcegraph-search/tsconfig.json b/provider/sourcegraph-search/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/sourcegraph-search/tsconfig.json +++ b/provider/sourcegraph-search/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/storybook/index.test.ts b/provider/storybook/index.test.ts index 4b719e2a..8e18fbd1 100644 --- a/provider/storybook/index.test.ts +++ b/provider/storybook/index.test.ts @@ -33,7 +33,7 @@ describe('storybook', () => { thumbnail_width: 400, thumbnail_height: 300, }), - ['404 Not Found', { status: 404 }] + ['404 Not Found', { status: 404 }], ) expect( await storybook.annotations?.( @@ -49,8 +49,8 @@ export const Foo: Story = {} export const Bar: Story = {} `, }, - SETTINGS - ) + SETTINGS, + ), ).toEqual([ { uri: 'file:///a/b.story.tsx', diff --git a/provider/storybook/index.ts b/provider/storybook/index.ts index b56e1170..5fa5e0d5 100644 --- a/provider/storybook/index.ts +++ b/provider/storybook/index.ts @@ -61,7 +61,7 @@ const storybook: Provider = { if (component) { const { matches, ranges } = firstSubmatchMatches( /export const (\w+): Story/d, - contentLines + contentLines, ) for (const [i, story] of matches.entries()) { const storyName = getStoryNameAlias(story, params.content) @@ -84,7 +84,7 @@ const storybook: Provider = { // Component file. const { matches, ranges } = firstSubmatchMatches( /export const ([A-Z]\w+): (?:(?:React\.)?FC|FunctionComponent|Component|SFC)\b/d, - contentLines + contentLines, ) for (const [i, component] of matches.entries()) { const storyTitle = getStoryComponentTitleForReactComponent(params.uri, component) diff --git a/provider/storybook/package.json b/provider/storybook/package.json index c7330779..e3c023e9 100644 --- a/provider/storybook/package.json +++ b/provider/storybook/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/storybook/tsconfig.json b/provider/storybook/tsconfig.json index 113d7722..6814eaed 100644 --- a/provider/storybook/tsconfig.json +++ b/provider/storybook/tsconfig.json @@ -11,5 +11,5 @@ }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/provider/web/index.ts b/provider/web/index.ts index c6b925a2..ac5b6ad0 100644 --- a/provider/web/index.ts +++ b/provider/web/index.ts @@ -52,7 +52,7 @@ async function fetchItem(params: ItemsParams, timeoutMs?: number): Promise { const url = new URL(urlStr) if (url.protocol !== 'http:' && url.protocol !== 'https:') { diff --git a/provider/web/package.json b/provider/web/package.json index b60d5d32..ee7ec07f 100644 --- a/provider/web/package.json +++ b/provider/web/package.json @@ -12,10 +12,7 @@ "type": "module", "main": "dist/bundle.js", "types": "dist/index.d.ts", - "files": [ - "dist/bundle.js", - "dist/index.d.ts" - ], + "files": ["dist/bundle.js", "dist/index.d.ts"], "sideEffects": false, "scripts": { "bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts", diff --git a/provider/web/tsconfig.json b/provider/web/tsconfig.json index 4ff7ab81..a1d94187 100644 --- a/provider/web/tsconfig.json +++ b/provider/web/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "lib": ["ESNext"], + "lib": ["ESNext"] }, "include": ["*.ts"], "exclude": ["dist", "vitest.config.ts"], - "references": [{ "path": "../../lib/provider" }], + "references": [{ "path": "../../lib/provider" }] } diff --git a/vitest.workspace.ts b/vitest.workspace.ts index ccc26cc2..39c5521d 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -8,7 +8,7 @@ interface PnpmWorkspaceFile { function fromPnpmWorkspaceFile(filePath: string): string[] { return (load(readFileSync(filePath, 'utf8')) as PnpmWorkspaceFile).packages.map( - p => `${p}/{vitest,vite}.config.ts` + p => `${p}/{vitest,vite}.config.ts`, ) } diff --git a/web/pages/docs/+onBeforeRender.ts b/web/pages/docs/+onBeforeRender.ts index 59229542..5e03dc38 100644 --- a/web/pages/docs/+onBeforeRender.ts +++ b/web/pages/docs/+onBeforeRender.ts @@ -6,7 +6,7 @@ import { content } from './content.ts' const onBeforeRenderContent = createOnBeforeRender(content) export const onBeforeRender: OnBeforeRenderAsync = async ( - pageContext + pageContext, ): ReturnType => { const slug = slugFromPageContext(pageContext) if (slug === 'index') { diff --git a/web/pages/playground/FakeEditorWindow.tsx b/web/pages/playground/FakeEditorWindow.tsx index a58e53fd..f534d29c 100644 --- a/web/pages/playground/FakeEditorWindow.tsx +++ b/web/pages/playground/FakeEditorWindow.tsx @@ -47,7 +47,7 @@ export const FakeEditorWindow: FunctionComponent<{ className?: string }> = ({ cl className={clsx( 'min-h-[622px] rounded-lg border border-[hsla(276,50%,27%,1)] shadow-2xl shadow-muted', styles.container, - className + className, )} >
@@ -76,6 +76,7 @@ const noop = (): void => {} const AnnotatedEditor: typeof _AnnotatedEditor = props => ( <_AnnotatedEditor {...props} />, [props])} initial={
} /> diff --git a/web/pages/playground/Playground.tsx b/web/pages/playground/Playground.tsx index d90115c8..79b16a21 100644 --- a/web/pages/playground/Playground.tsx +++ b/web/pages/playground/Playground.tsx @@ -21,7 +21,7 @@ const _Playground: FunctionComponent<{ className?: string }> = ({ className }) =
= ({ className }) = export const Playground: typeof _Playground = props => ( <_Playground {...props} />, [props])} initial={
Loading...
diff --git a/web/pages/playground/Preload.tsx b/web/pages/playground/Preload.tsx index d8b797d3..08818608 100644 --- a/web/pages/playground/Preload.tsx +++ b/web/pages/playground/Preload.tsx @@ -11,7 +11,7 @@ export const Preload: FunctionComponent = () => ( ) : as === 'script' ? (