From 134909f7f4cec849519831df27b14801794d3bc9 Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Mon, 23 Feb 2026 15:35:09 -0500 Subject: [PATCH 1/2] style: format codebase with npm run format:all --- client/electron/types/socks/index.d.ts | 6 ++- client/web/app/app.spec.ts | 26 ++++++++--- client/web/app/environment.ts | 30 +++++++------ client/web/app/settings.spec.ts | 18 +++++--- client/web/karma.conf.js | 2 +- client/web/shared/error_reporter.ts | 43 ++++++++++++++----- client/web/types/clipboard.d.ts | 6 ++- .../server_connection_indicator/stories.ts | 18 ++++---- .../views/servers_view/server_list/stories.ts | 5 ++- commitlint.config.js | 17 +++++++- .../outline-contact-us-dialog.ts | 5 +-- 11 files changed, 122 insertions(+), 54 deletions(-) diff --git a/client/electron/types/socks/index.d.ts b/client/electron/types/socks/index.d.ts index cffdd0e190..f05a6a3da0 100644 --- a/client/electron/types/socks/index.d.ts +++ b/client/electron/types/socks/index.d.ts @@ -36,5 +36,9 @@ declare module 'socks' { callback: (err: Error, socket: net.Socket, info: SocksAddress) => void ): void; - export function createUDPFrame(target: SocksAddress, data: Buffer, frame?: number): Buffer; + export function createUDPFrame( + target: SocksAddress, + data: Buffer, + frame?: number + ): Buffer; } diff --git a/client/web/app/app.spec.ts b/client/web/app/app.spec.ts index 8f1408475a..744eb63151 100644 --- a/client/web/app/app.spec.ts +++ b/client/web/app/app.spec.ts @@ -36,20 +36,34 @@ describe('unwrapInvite', () => { it('detects ss fragment', () => { const s = 'ss://myhost.com:3333'; - expect(unwrapInvite(`https://whatever.com/invite.html#${encodeURIComponent(s)}`)).toEqual(s); + expect( + unwrapInvite(`https://whatever.com/invite.html#${encodeURIComponent(s)}`) + ).toEqual(s); }); it('handles fragment after redirect', () => { const s = 'ss://myhost.com:3333'; - expect(unwrapInvite(`https://whatever.com/invite.html#/en/invite/${encodeURIComponent(s)}`)).toEqual(s); + expect( + unwrapInvite( + `https://whatever.com/invite.html#/en/invite/${encodeURIComponent(s)}` + ) + ).toEqual(s); }); }); describe('isOutlineAccessKey', () => { it('ignores empty string', () => expect(isOutlineAccessKey('')).toBe(false)); - it('ignores garbage', () => expect(isOutlineAccessKey('i am not a outline service location')).toBe(false)); - it('ignores random https links', () => expect(isOutlineAccessKey('https://example.com')).toBe(false)); + it('ignores garbage', () => + expect(isOutlineAccessKey('i am not a outline service location')).toBe( + false + )); + it('ignores random https links', () => + expect(isOutlineAccessKey('https://example.com')).toBe(false)); - it('detects static keys', () => expect(isOutlineAccessKey('ss://myhost.com:3333')).toBe(true)); - it('detects dynamic keys', () => expect(isOutlineAccessKey('ssconf://my.cool.server.com:3423#veryfast')).toBe(true)); + it('detects static keys', () => + expect(isOutlineAccessKey('ss://myhost.com:3333')).toBe(true)); + it('detects dynamic keys', () => + expect( + isOutlineAccessKey('ssconf://my.cool.server.com:3423#veryfast') + ).toBe(true)); }); diff --git a/client/web/app/environment.ts b/client/web/app/environment.ts index 3f21114cc6..c2ffff0cdc 100644 --- a/client/web/app/environment.ts +++ b/client/web/app/environment.ts @@ -20,17 +20,19 @@ export interface EnvironmentVariables { // According to http://caniuse.com/#feat=fetch fetch didn't land iOS Safari // until v10.3 released 3/26/17, so use XMLHttpRequest instead. -export const onceEnvVars: Promise = new Promise((resolve, reject) => { - const xhr = new XMLHttpRequest(); - xhr.onload = () => { - try { - const json = JSON.parse(xhr.responseText); - console.debug('Resolving with envVars:', json); - resolve(json as EnvironmentVariables); - } catch (err) { - reject(err); - } - }; - xhr.open('GET', 'environment.json', true); - xhr.send(); -}); +export const onceEnvVars: Promise = new Promise( + (resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.onload = () => { + try { + const json = JSON.parse(xhr.responseText); + console.debug('Resolving with envVars:', json); + resolve(json as EnvironmentVariables); + } catch (err) { + reject(err); + } + }; + xhr.open('GET', 'environment.json', true); + xhr.send(); + } +); diff --git a/client/web/app/settings.spec.ts b/client/web/app/settings.spec.ts index b171f2fbe4..84171f36ba 100644 --- a/client/web/app/settings.spec.ts +++ b/client/web/app/settings.spec.ts @@ -16,7 +16,6 @@ import {InMemoryStorage} from '@outline/infrastructure/memory_storage'; import {Settings, SettingsKey} from './settings'; - const FAKE_SETTINGS_KEYS = ['key', 'key1', 'key2']; describe('Settings', () => { @@ -29,8 +28,13 @@ describe('Settings', () => { }); it('loads existing settings', () => { - const store = new Map([[Settings.STORAGE_KEY, '{"key1": "value1", "key2": "value2"}']]); - const settings = new Settings(new InMemoryStorage(store), FAKE_SETTINGS_KEYS); + const store = new Map([ + [Settings.STORAGE_KEY, '{"key1": "value1", "key2": "value2"}'], + ]); + const settings = new Settings( + new InMemoryStorage(store), + FAKE_SETTINGS_KEYS + ); expect(settings.get('key1')).toEqual('value1'); expect(settings.get('key2')).toEqual('value2'); }); @@ -69,7 +73,9 @@ describe('Settings', () => { it('is initialized with default valid keys', () => { // Constructor uses SettingKeys as the default value for valid keys. const settings = new Settings(new InMemoryStorage()); - expect(settings.isValidSetting(SettingsKey.VPN_WARNING_DISMISSED)).toBeTruthy(); + expect( + settings.isValidSetting(SettingsKey.VPN_WARNING_DISMISSED) + ).toBeTruthy(); }); it('throws when setting an invalid key', () => { @@ -80,7 +86,9 @@ describe('Settings', () => { }); it('throws when storage is corrupted', () => { - const storage = new InMemoryStorage(new Map([[Settings.STORAGE_KEY, '"malformed": "json"']])); + const storage = new InMemoryStorage( + new Map([[Settings.STORAGE_KEY, '"malformed": "json"']]) + ); expect(() => { new Settings(storage, FAKE_SETTINGS_KEYS); }).toThrowError(SyntaxError); diff --git a/client/web/karma.conf.js b/client/web/karma.conf.js index 5e17bc1bf8..937e07e56a 100644 --- a/client/web/karma.conf.js +++ b/client/web/karma.conf.js @@ -14,7 +14,7 @@ const path = require('path'); -module.exports = async function(config) { +module.exports = async function (config) { const testConfig = await import('./webpack_test.mjs'); config.set({ diff --git a/client/web/shared/error_reporter.ts b/client/web/shared/error_reporter.ts index ffbb44c9e0..4845636356 100644 --- a/client/web/shared/error_reporter.ts +++ b/client/web/shared/error_reporter.ts @@ -18,18 +18,36 @@ import {Integration as SentryIntegration} from '@sentry/types'; export type Tags = {[id: string]: string | boolean | number}; export interface OutlineErrorReporter { - report(userFeedback: string, feedbackCategory: string, userEmail?: string, tags?: Tags): Promise; + report( + userFeedback: string, + feedbackCategory: string, + userEmail?: string, + tags?: Tags + ): Promise; } export class SentryErrorReporter implements OutlineErrorReporter { - constructor(appVersion: string, dsn: string, private tags: Tags) { + constructor( + appVersion: string, + dsn: string, + private tags: Tags + ) { if (dsn) { - Sentry.init({dsn, release: appVersion, integrations: getSentryBrowserIntegrations}); + Sentry.init({ + dsn, + release: appVersion, + integrations: getSentryBrowserIntegrations, + }); } this.setUpUnhandledRejectionListener(); } - async report(userFeedback: string, feedbackCategory: string, userEmail?: string, tags?: Tags): Promise { + async report( + userFeedback: string, + feedbackCategory: string, + userEmail?: string, + tags?: Tags + ): Promise { const combinedTags = {...this.tags, ...tags}; Sentry.captureEvent({ message: userFeedback, @@ -57,18 +75,23 @@ export class SentryErrorReporter implements OutlineErrorReporter { // Chrome is the only browser that supports the unhandledrejection event. // This is fine for Android, but will not work in iOS. const unhandledRejection = 'unhandledrejection'; - window.addEventListener(unhandledRejection, (event: PromiseRejectionEvent) => { - const reason = event.reason; - const msg = reason.stack ? reason.stack : reason; - Sentry.addBreadcrumb({message: msg, category: unhandledRejection}); - }); + window.addEventListener( + unhandledRejection, + (event: PromiseRejectionEvent) => { + const reason = event.reason; + const msg = reason.stack ? reason.stack : reason; + Sentry.addBreadcrumb({message: msg, category: unhandledRejection}); + } + ); } } // Returns a list of Sentry browser integrations that maintains the default integrations, // but replaces the Breadcrumbs integration with a custom one that only collects console statements. // See https://docs.sentry.io/platforms/javascript/configuration/integrations/default/ -export function getSentryBrowserIntegrations(defaultIntegrations: SentryIntegration[]): SentryIntegration[] { +export function getSentryBrowserIntegrations( + defaultIntegrations: SentryIntegration[] +): SentryIntegration[] { const integrations = defaultIntegrations.filter(integration => { return integration.name !== 'Breadcrumbs'; }); diff --git a/client/web/types/clipboard.d.ts b/client/web/types/clipboard.d.ts index 72e0009401..d98ca9a905 100644 --- a/client/web/types/clipboard.d.ts +++ b/client/web/types/clipboard.d.ts @@ -17,7 +17,11 @@ type FailureCallback = (error: Error) => void; interface CordovaPlugins { clipboard: { - copy(text: string, onSuccess: SuccessCallback, onFailure: FailureCallback): void; + copy( + text: string, + onSuccess: SuccessCallback, + onFailure: FailureCallback + ): void; paste(onSuccess: SuccessCallback, onFailure: FailureCallback): void; }; } diff --git a/client/web/views/servers_view/server_connection_indicator/stories.ts b/client/web/views/servers_view/server_connection_indicator/stories.ts index c37569e80a..3b92b08478 100644 --- a/client/web/views/servers_view/server_connection_indicator/stories.ts +++ b/client/web/views/servers_view/server_connection_indicator/stories.ts @@ -33,11 +33,13 @@ export default { }, }; -export const Example = ({connectionState}: ServerConnectionIndicator) => - html` -
- -
- `; +export const Example = ({connectionState}: ServerConnectionIndicator) => html` +
+ +
+`; diff --git a/client/web/views/servers_view/server_list/stories.ts b/client/web/views/servers_view/server_list/stories.ts index 10da4d7376..8383388b79 100644 --- a/client/web/views/servers_view/server_list/stories.ts +++ b/client/web/views/servers_view/server_list/stories.ts @@ -52,5 +52,6 @@ export default { }, }; -export const Example = ({servers}: ServerList) => - html` `; +export const Example = ({servers}: ServerList) => html` + +`; diff --git a/commitlint.config.js b/commitlint.config.js index cdd7656aaf..303a75ddab 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -34,13 +34,26 @@ module.exports = { 'manager', 'manager/linux', 'manager/macos', - 'manager/windows' + 'manager/windows', ], ], 'type-enum': [ 2, 'always', - ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'proposal', 'refactor', 'revert', 'style', 'test'], + [ + 'build', + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'proposal', + 'refactor', + 'revert', + 'style', + 'test', + ], ], }, }; diff --git a/server_manager/www/ui_components/outline-contact-us-dialog.ts b/server_manager/www/ui_components/outline-contact-us-dialog.ts index fbf329f003..9089067ed1 100644 --- a/server_manager/www/ui_components/outline-contact-us-dialog.ts +++ b/server_manager/www/ui_components/outline-contact-us-dialog.ts @@ -57,10 +57,7 @@ const UNSUPPORTED_ISSUE_TYPE_HELPPAGES = new Map([ IssueType.CANNOT_ADD_SERVER, 'https://support.google.com/outline/answer/15331223', ], - [ - IssueType.CONNECTION, - 'https://support.google.com/outline/answer/15331126', - ], + [IssueType.CONNECTION, 'https://support.google.com/outline/answer/15331126'], ]); @customElement('outline-contact-us-dialog') From 1c9ff971dca5935d8f2720e5173b464507303ea9 Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Mon, 23 Feb 2026 16:52:37 -0500 Subject: [PATCH 2/2] build: ignore cordova build outputs in eslint --- .eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintignore b/.eslintignore index 1f57b975cd..5bb607c4e2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ /output +client/www/