diff --git a/.eslintrc.js b/.eslintrc.js index 95add4844..7eb62e767 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -115,6 +115,8 @@ module.exports = { 'space-before-blocks': 'error', 'spaced-comment': ['error', 'always'], 'keyword-spacing': ['error', { 'before': true, 'after': true }], + + '@typescript-eslint/type-annotation-spacing': ['error', { 'before': false, 'after': true }], }, 'plugins': [ 'react', diff --git a/packages/app-cli/app/services/plugins/PluginRunner.ts b/packages/app-cli/app/services/plugins/PluginRunner.ts index a1c94b733..459d07a53 100644 --- a/packages/app-cli/app/services/plugins/PluginRunner.ts +++ b/packages/app-cli/app/services/plugins/PluginRunner.ts @@ -6,12 +6,12 @@ import executeSandboxCall from '@joplin/lib/services/plugins/utils/executeSandbo import Global from '@joplin/lib/services/plugins/api/Global'; import mapEventHandlersToIds, { EventHandlers } from '@joplin/lib/services/plugins/utils/mapEventHandlersToIds'; -function createConsoleWrapper(pluginId:string) { - const wrapper:any = {}; +function createConsoleWrapper(pluginId: string) { + const wrapper: any = {}; for (const n in console) { if (!console.hasOwnProperty(n)) continue; - wrapper[n] = (...args:any[]) => { + wrapper[n] = (...args: any[]) => { const newArgs = args.slice(); newArgs.splice(0, 0, `Plugin "${pluginId}":`); return (console as any)[n](...newArgs); @@ -30,7 +30,7 @@ function createConsoleWrapper(pluginId:string) { export default class PluginRunner extends BasePluginRunner { - private eventHandlers_:EventHandlers = {}; + private eventHandlers_: EventHandlers = {}; constructor() { super(); @@ -38,13 +38,13 @@ export default class PluginRunner extends BasePluginRunner { this.eventHandler = this.eventHandler.bind(this); } - private async eventHandler(eventHandlerId:string, args:any[]) { + private async eventHandler(eventHandlerId: string, args: any[]) { const cb = this.eventHandlers_[eventHandlerId]; return cb(...args); } - private newSandboxProxy(pluginId:string, sandbox:Global) { - const target = async (path:string, args:any[]) => { + private newSandboxProxy(pluginId: string, sandbox: Global) { + const target = async (path: string, args: any[]) => { return executeSandboxCall(pluginId, sandbox, `joplin.${path}`, mapEventHandlersToIds(args, this.eventHandlers_), this.eventHandler); }; @@ -54,8 +54,8 @@ export default class PluginRunner extends BasePluginRunner { }; } - async run(plugin:Plugin, sandbox:Global):Promise { - return new Promise((resolve:Function, reject:Function) => { + async run(plugin: Plugin, sandbox: Global): Promise { + return new Promise((resolve: Function, reject: Function) => { const onStarted = () => { plugin.off('started', onStarted); resolve(); diff --git a/packages/app-cli/tests/MdToHtml.ts b/packages/app-cli/tests/MdToHtml.ts index 3eee4b242..27db12df7 100644 --- a/packages/app-cli/tests/MdToHtml.ts +++ b/packages/app-cli/tests/MdToHtml.ts @@ -5,7 +5,7 @@ const { asyncTest, setupDatabaseAndSynchronizer, switchClient } = require('./tes const shim = require('@joplin/lib/shim').default; const { themeStyle } = require('@joplin/lib/theme'); -function newTestMdToHtml(options:any = null) { +function newTestMdToHtml(options: any = null) { options = { ResourceModel: { isResourceUrl: () => false, @@ -19,7 +19,7 @@ function newTestMdToHtml(options:any = null) { describe('MdToHtml', function() { - beforeEach(async (done:Function) => { + beforeEach(async (done: Function) => { await setupDatabaseAndSynchronizer(1); await switchClient(1); done(); @@ -39,7 +39,7 @@ describe('MdToHtml', function() { // if (mdFilename !== 'sanitize_9.md') continue; - const mdToHtmlOptions:any = { + const mdToHtmlOptions: any = { bodyOnly: true, }; @@ -83,7 +83,7 @@ describe('MdToHtml', function() { })); it('should return enabled plugin assets', asyncTest(async () => { - const pluginOptions:any = {}; + const pluginOptions: any = {}; const pluginNames = MdToHtml.pluginNames(); for (const n of pluginNames) pluginOptions[n] = { enabled: false }; diff --git a/packages/app-cli/tests/fsDriver.ts b/packages/app-cli/tests/fsDriver.ts index d7f9e50c9..ff0763994 100644 --- a/packages/app-cli/tests/fsDriver.ts +++ b/packages/app-cli/tests/fsDriver.ts @@ -4,7 +4,7 @@ const { expectThrow } = require('./test-utils.js'); // On Windows, path.resolve is going to convert a path such as // /tmp/file.txt to c:\tmp\file.txt -function platformPath(path:string) { +function platformPath(path: string) { if (shim.isWindows()) { return `c:${path.replace(/\//g, '\\')}`; } else { diff --git a/packages/app-cli/tests/services/plugins/sandboxProxy.ts b/packages/app-cli/tests/services/plugins/sandboxProxy.ts index dfa89f6b6..0d9fa18bb 100644 --- a/packages/app-cli/tests/services/plugins/sandboxProxy.ts +++ b/packages/app-cli/tests/services/plugins/sandboxProxy.ts @@ -4,7 +4,7 @@ const { asyncTest, setupDatabaseAndSynchronizer, switchClient } = require('../.. describe('services_plugins_sandboxProxy', function() { - beforeEach(async (done:Function) => { + beforeEach(async (done: Function) => { await setupDatabaseAndSynchronizer(1); await switchClient(1); done(); @@ -16,9 +16,9 @@ describe('services_plugins_sandboxProxy', function() { args: any[], } - const results:Result[] = []; + const results: Result[] = []; - const target:Target = (path:string, args:any[]) => { + const target: Target = (path: string, args: any[]) => { results.push({ path, args }); }; @@ -39,9 +39,9 @@ describe('services_plugins_sandboxProxy', function() { args: any[], } - const results:Result[] = []; + const results: Result[] = []; - const target:Target = (path:string, args:any[]) => { + const target: Target = (path: string, args: any[]) => { results.push({ path, args }); }; diff --git a/packages/app-cli/tests/services_CommandService.ts b/packages/app-cli/tests/services_CommandService.ts index 9a8eb17d0..b11a379c9 100644 --- a/packages/app-cli/tests/services_CommandService.ts +++ b/packages/app-cli/tests/services_CommandService.ts @@ -10,7 +10,7 @@ interface TestCommand { runtime: CommandRuntime, } -function newService():CommandService { +function newService(): CommandService { const service = new CommandService(); const mockStore = { getState: () => { @@ -21,12 +21,12 @@ function newService():CommandService { return service; } -function createCommand(name:string, options:any):TestCommand { - const declaration:CommandDeclaration = { +function createCommand(name: string, options: any): TestCommand { + const declaration: CommandDeclaration = { name: name, }; - const runtime:CommandRuntime = { + const runtime: CommandRuntime = { execute: options.execute, }; @@ -35,7 +35,7 @@ function createCommand(name:string, options:any):TestCommand { return { declaration, runtime }; } -function registerCommand(service:CommandService, cmd:TestCommand) { +function registerCommand(service: CommandService, cmd: TestCommand) { service.registerDeclaration(cmd.declaration); service.registerRuntime(cmd.declaration.name, cmd.runtime); } @@ -55,7 +55,7 @@ describe('services_CommandService', function() { const service = newService(); const toolbarButtonUtils = new ToolbarButtonUtils(service); - const executedCommands:string[] = []; + const executedCommands: string[] = []; registerCommand(service, createCommand('test1', { execute: () => { @@ -172,9 +172,9 @@ describe('services_CommandService', function() { execute: () => {}, })); - const clickedCommands:string[] = []; + const clickedCommands: string[] = []; - const onClick = (commandName:string) => { + const onClick = (commandName: string) => { clickedCommands.push(commandName); }; @@ -234,7 +234,7 @@ describe('services_CommandService', function() { let propValue = null; registerCommand(service, createCommand('test1', { - execute: (_context:any, greeting:string) => { + execute: (_context: any, greeting: string) => { propValue = greeting; }, })); diff --git a/packages/app-cli/tests/services_InteropService.ts b/packages/app-cli/tests/services_InteropService.ts index 27305b9f3..beb593596 100644 --- a/packages/app-cli/tests/services_InteropService.ts +++ b/packages/app-cli/tests/services_InteropService.ts @@ -19,7 +19,7 @@ function exportDir() { return `${__dirname}/export`; } -function fieldsEqual(model1:any, model2:any, fieldNames:string[]) { +function fieldsEqual(model1: any, model2: any, fieldNames: string[]) { for (let i = 0; i < fieldNames.length; i++) { const f = fieldNames[i]; expect(model1[f]).toBe(model2[f], `For key ${f}`); @@ -86,7 +86,7 @@ describe('services_InteropService', function() { await service.import({ path: filePath }); const allFolders = await Folder.all(); - expect(allFolders.map((f:any) => f.title).sort().join(' - ')).toBe('folder - folder (1)'); + expect(allFolders.map((f: any) => f.title).sort().join(' - ')).toBe('folder - folder (1)'); })); it('should import folders, and only de-duplicate titles when needed', asyncTest(async () => { @@ -447,14 +447,14 @@ describe('services_InteropService', function() { sourcePath: '', }; - const module:Module = { + const module: Module = { type: ModuleType.Importer, description: 'Test Import Module', format: 'testing', fileExtensions: ['test'], isCustom: true, - onExec: async (context:CustomImportContext) => { + onExec: async (context: CustomImportContext) => { result.hasBeenExecuted = true; result.sourcePath = context.sourcePath; }, @@ -479,7 +479,7 @@ describe('services_InteropService', function() { const filePath = `${exportDir()}/example.test`; - const result:any = { + const result: any = { destPath: '', itemTypes: [], items: [], @@ -488,28 +488,28 @@ describe('services_InteropService', function() { closeCalled: false, }; - const module:Module = { + const module: Module = { type: ModuleType.Exporter, description: 'Test Export Module', format: 'testing', fileExtensions: ['test'], isCustom: true, - onInit: async (context:CustomExportContext) => { + onInit: async (context: CustomExportContext) => { result.destPath = context.destPath; }, - onProcessItem: async (_context:CustomExportContext, itemType:number, item:any) => { + onProcessItem: async (_context: CustomExportContext, itemType: number, item: any) => { result.itemTypes.push(itemType); result.items.push(item); }, - onProcessResource: async (_context:CustomExportContext, resource:any, filePath:string) => { + onProcessResource: async (_context: CustomExportContext, resource: any, filePath: string) => { result.resources.push(resource); result.filePaths.push(filePath); }, - onClose: async (_context:CustomExportContext) => { + onClose: async (_context: CustomExportContext) => { result.closeCalled = true; }, }; @@ -524,7 +524,7 @@ describe('services_InteropService', function() { expect(result.destPath).toBe(filePath); expect(result.itemTypes.sort().join('_')).toBe('1_1_2_4'); expect(result.items.length).toBe(4); - expect(result.items.map((o:any) => o.title).sort().join('_')).toBe('folder1_note1_note2_photo.jpg'); + expect(result.items.map((o: any) => o.title).sort().join('_')).toBe('folder1_note1_note2_photo.jpg'); expect(result.resources.length).toBe(1); expect(result.resources[0].title).toBe('photo.jpg'); expect(result.filePaths.length).toBe(1); diff --git a/packages/app-cli/tests/services_PluginService.ts b/packages/app-cli/tests/services_PluginService.ts index 4690e6b0d..96454675c 100644 --- a/packages/app-cli/tests/services_PluginService.ts +++ b/packages/app-cli/tests/services_PluginService.ts @@ -79,7 +79,7 @@ describe('services_PluginService', function() { const allFolders = await Folder.all(); expect(allFolders.length).toBe(2); - expect(allFolders.map((f:any) => f.title).sort().join(', ')).toBe('multi - simple1, multi - simple2'); + expect(allFolders.map((f: any) => f.title).sort().join(', ')).toBe('multi - simple1, multi - simple2'); })); it('should load plugins from JS bundles', asyncTest(async () => { diff --git a/packages/app-cli/tests/services_keychainService.ts b/packages/app-cli/tests/services_keychainService.ts index e06cf0f81..9d5166b63 100644 --- a/packages/app-cli/tests/services_keychainService.ts +++ b/packages/app-cli/tests/services_keychainService.ts @@ -4,7 +4,7 @@ import Setting from '@joplin/lib/models/Setting'; const { db, asyncTest, setupDatabaseAndSynchronizer, switchClient } = require('./test-utils.js'); -function describeIfCompatible(name:string, fn:any, elseFn:any) { +function describeIfCompatible(name: string, fn: any, elseFn: any) { if (['win32', 'darwin'].includes(shim.platformName())) { return describe(name, fn); } else { @@ -14,14 +14,14 @@ function describeIfCompatible(name:string, fn:any, elseFn:any) { describeIfCompatible('services_KeychainService', function() { - beforeEach(async (done:Function) => { + beforeEach(async (done: Function) => { await setupDatabaseAndSynchronizer(1, { keychainEnabled: true }); await switchClient(1, { keychainEnabled: true }); await Setting.deleteKeychainPasswords(); done(); }); - afterEach(async (done:Function) => { + afterEach(async (done: Function) => { await Setting.deleteKeychainPasswords(); done(); }); diff --git a/packages/app-cli/tests/services_rest_Api.ts b/packages/app-cli/tests/services_rest_Api.ts index af4f2aa4a..7c7b68f31 100644 --- a/packages/app-cli/tests/services_rest_Api.ts +++ b/packages/app-cli/tests/services_rest_Api.ts @@ -11,7 +11,7 @@ const NoteTag = require('@joplin/lib/models/NoteTag'); const ResourceService = require('@joplin/lib/services/ResourceService').default; const SearchEngine = require('@joplin/lib/services/searchengine/SearchEngine'); -async function msleep(ms:number) { +async function msleep(ms: number) { return new Promise((resolve) => { shim.setTimeout(() => { resolve(); @@ -19,7 +19,7 @@ async function msleep(ms:number) { }); } -const createFolderForPagination = async (num:number, time:number) => { +const createFolderForPagination = async (num: number, time: number) => { await Folder.save({ title: `folder${num}`, updated_time: time, @@ -27,7 +27,7 @@ const createFolderForPagination = async (num:number, time:number) => { }, { autoTimestamp: false }); }; -const createNoteForPagination = async (num:number, time:number) => { +const createNoteForPagination = async (num: number, time: number) => { await Note.save({ title: `note${num}`, body: `noteBody${num}`, @@ -36,7 +36,7 @@ const createNoteForPagination = async (num:number, time:number) => { }, { autoTimestamp: false }); }; -let api:Api = null; +let api: Api = null; describe('services_rest_Api', function() { @@ -158,7 +158,7 @@ describe('services_rest_Api', function() { })); it('should allow setting note properties', asyncTest(async () => { - let response:any = null; + let response: any = null; const f = await Folder.save({ title: 'mon carnet' }); response = await api.route(RequestMethod.POST, 'notes', null, JSON.stringify({ diff --git a/packages/app-cli/tests/synchronizer_LockHandler.ts b/packages/app-cli/tests/synchronizer_LockHandler.ts index 20b434034..a47b0cd89 100644 --- a/packages/app-cli/tests/synchronizer_LockHandler.ts +++ b/packages/app-cli/tests/synchronizer_LockHandler.ts @@ -3,7 +3,7 @@ import LockHandler, { LockType, LockHandlerOptions, Lock } from '@joplin/lib/ser const { isNetworkSyncTarget, asyncTest, fileApi, setupDatabaseAndSynchronizer, synchronizer, switchClient, msleep, expectThrow, expectNotThrow } = require('./test-utils.js'); -process.on('unhandledRejection', (reason:any, p:any) => { +process.on('unhandledRejection', (reason: any, p: any) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); }); @@ -14,13 +14,13 @@ process.on('unhandledRejection', (reason:any, p:any) => { // For that reason we add this multiplier for non-memory sync targets. const timeoutMultipler = isNetworkSyncTarget() ? 100 : 1; -let lockHandler_:LockHandler = null; +let lockHandler_: LockHandler = null; -function newLockHandler(options:LockHandlerOptions = null):LockHandler { +function newLockHandler(options: LockHandlerOptions = null): LockHandler { return new LockHandler(fileApi(), options); } -function lockHandler():LockHandler { +function lockHandler(): LockHandler { if (lockHandler_) return lockHandler_; lockHandler_ = new LockHandler(fileApi()); return lockHandler_; @@ -28,7 +28,7 @@ function lockHandler():LockHandler { describe('synchronizer_LockHandler', function() { - beforeEach(async (done:Function) => { + beforeEach(async (done: Function) => { // logger.setLevel(Logger.LEVEL_WARN); lockHandler_ = null; await setupDatabaseAndSynchronizer(1); @@ -96,8 +96,8 @@ describe('synchronizer_LockHandler', function() { }); const lock = await handler.acquireLock(LockType.Sync, 'desktop', '111'); - let autoLockError:any = null; - handler.startAutoLockRefresh(lock, (error:any) => { + let autoLockError: any = null; + handler.startAutoLockRefresh(lock, (error: any) => { autoLockError = error; }); @@ -144,8 +144,8 @@ describe('synchronizer_LockHandler', function() { const lockHandler = newLockHandler(); { - const lock1:Lock = { type: LockType.Exclusive, clientId: '1', clientType: 'd' }; - const lock2:Lock = { type: LockType.Exclusive, clientId: '2', clientType: 'd' }; + const lock1: Lock = { type: LockType.Exclusive, clientId: '1', clientType: 'd' }; + const lock2: Lock = { type: LockType.Exclusive, clientId: '2', clientType: 'd' }; await lockHandler.saveLock_(lock1); await msleep(100); await lockHandler.saveLock_(lock2); diff --git a/packages/app-cli/tests/synchronizer_MigrationHandler.ts b/packages/app-cli/tests/synchronizer_MigrationHandler.ts index 8b263c50e..f578918d1 100644 --- a/packages/app-cli/tests/synchronizer_MigrationHandler.ts +++ b/packages/app-cli/tests/synchronizer_MigrationHandler.ts @@ -15,43 +15,43 @@ const MasterKey = require('@joplin/lib/models/MasterKey'); const specTimeout = 60000 * 10; // Nextcloud tests can be slow -let lockHandler_:LockHandler = null; -let migrationHandler_:MigrationHandler = null; +let lockHandler_: LockHandler = null; +let migrationHandler_: MigrationHandler = null; -function lockHandler():LockHandler { +function lockHandler(): LockHandler { if (lockHandler_) return lockHandler_; lockHandler_ = new LockHandler(fileApi()); return lockHandler_; } -function migrationHandler(clientId:string = 'abcd'):MigrationHandler { +function migrationHandler(clientId: string = 'abcd'): MigrationHandler { if (migrationHandler_) return migrationHandler_; migrationHandler_ = new MigrationHandler(fileApi(), lockHandler(), 'desktop', clientId); return migrationHandler_; } interface MigrationTests { - [key:string]: Function; + [key: string]: Function; } -const migrationTests:MigrationTests = { +const migrationTests: MigrationTests = { 2: async function() { const items = (await fileApi().list('', { includeHidden: true })).items; - expect(items.filter((i:any) => i.path === '.resource' && i.isDir).length).toBe(1); - expect(items.filter((i:any) => i.path === 'locks' && i.isDir).length).toBe(1); - expect(items.filter((i:any) => i.path === 'temp' && i.isDir).length).toBe(1); - expect(items.filter((i:any) => i.path === 'info.json' && !i.isDir).length).toBe(1); + expect(items.filter((i: any) => i.path === '.resource' && i.isDir).length).toBe(1); + expect(items.filter((i: any) => i.path === 'locks' && i.isDir).length).toBe(1); + expect(items.filter((i: any) => i.path === 'temp' && i.isDir).length).toBe(1); + expect(items.filter((i: any) => i.path === 'info.json' && !i.isDir).length).toBe(1); const versionForOldClients = await fileApi().get('.sync/version.txt'); expect(versionForOldClients).toBe('2'); }, }; -let previousSyncTargetName:string = ''; +let previousSyncTargetName: string = ''; describe('synchronizer_MigrationHandler', function() { - beforeEach(async (done:Function) => { + beforeEach(async (done: Function) => { // To test the migrations, we have to use the filesystem sync target // because the sync target snapshots are plain files. Eventually // it should be possible to copy a filesystem target to memory @@ -65,7 +65,7 @@ describe('synchronizer_MigrationHandler', function() { done(); }); - afterEach(async (done:Function) => { + afterEach(async (done: Function) => { setSyncTargetName(previousSyncTargetName); done(); }); @@ -74,8 +74,8 @@ describe('synchronizer_MigrationHandler', function() { // Check that basic folders "locks" and "temp" are created for new sync targets. await migrationHandler().upgrade(1); const result = await fileApi().list(); - expect(result.items.filter((i:any) => i.path === Dirnames.Locks).length).toBe(1); - expect(result.items.filter((i:any) => i.path === Dirnames.Temp).length).toBe(1); + expect(result.items.filter((i: any) => i.path === Dirnames.Locks).length).toBe(1); + expect(result.items.filter((i: any) => i.path === Dirnames.Temp).length).toBe(1); }), specTimeout); it('should not allow syncing if the sync target is out-dated', asyncTest(async () => { diff --git a/packages/app-desktop/ElectronAppWrapper.ts b/packages/app-desktop/ElectronAppWrapper.ts index cb43815b8..43833f5fe 100644 --- a/packages/app-desktop/ElectronAppWrapper.ts +++ b/packages/app-desktop/ElectronAppWrapper.ts @@ -19,19 +19,19 @@ interface PluginWindows { export default class ElectronAppWrapper { - private logger_:Logger = null; - private electronApp_:any; - private env_:string; - private isDebugMode_:boolean; - private profilePath_:string; - private win_:any = null; - private willQuitApp_:boolean = false; - private tray_:any = null; - private buildDir_:string = null; - private rendererProcessQuitReply_:RendererProcessQuitReply = null; - private pluginWindows_:PluginWindows = {}; + private logger_: Logger = null; + private electronApp_: any; + private env_: string; + private isDebugMode_: boolean; + private profilePath_: string; + private win_: any = null; + private willQuitApp_: boolean = false; + private tray_: any = null; + private buildDir_: string = null; + private rendererProcessQuitReply_: RendererProcessQuitReply = null; + private pluginWindows_: PluginWindows = {}; - constructor(electronApp:any, env:string, profilePath:string, isDebugMode:boolean) { + constructor(electronApp: any, env: string, profilePath: string, isDebugMode: boolean) { this.electronApp_ = electronApp; this.env_ = env; this.isDebugMode_ = isDebugMode; @@ -42,7 +42,7 @@ export default class ElectronAppWrapper { return this.electronApp_; } - setLogger(v:Logger) { + setLogger(v: Logger) { this.logger_ = v; } @@ -65,7 +65,7 @@ export default class ElectronAppWrapper { const windowStateKeeper = require('electron-window-state'); - const stateOptions:any = { + const stateOptions: any = { defaultWidth: Math.round(0.8 * screen.getPrimaryDisplay().workArea.width), defaultHeight: Math.round(0.8 * screen.getPrimaryDisplay().workArea.height), file: `window-state-${this.env_}.json`, @@ -76,7 +76,7 @@ export default class ElectronAppWrapper { // Load the previous state with fallback to defaults const windowState = windowStateKeeper(stateOptions); - const windowOptions:any = { + const windowOptions: any = { x: windowState.x, y: windowState.y, width: windowState.width, @@ -128,7 +128,7 @@ export default class ElectronAppWrapper { }, 3000); } - this.win_.on('close', (event:any) => { + this.win_.on('close', (event: any) => { // If it's on macOS, the app is completely closed only if the user chooses to close the app (willQuitApp_ will be true) // otherwise the window is simply hidden, and will be re-open once the app is "activated" (which happens when the // user clicks on the icon in the task bar). @@ -176,7 +176,7 @@ export default class ElectronAppWrapper { } }); - ipcMain.on('asynchronous-message', (_event:any, message:string, args:any) => { + ipcMain.on('asynchronous-message', (_event: any, message: string, args: any) => { if (message === 'appCloseReply') { // We got the response from the renderer process: // save the response and try quit again. @@ -187,7 +187,7 @@ export default class ElectronAppWrapper { // This handler receives IPC messages from a plugin or from the main window, // and forwards it to the main window or the plugin window. - ipcMain.on('pluginMessage', (_event:any, message:PluginMessage) => { + ipcMain.on('pluginMessage', (_event: any, message: PluginMessage) => { if (message.target === 'mainWindow') { this.win_.webContents.send('pluginMessage', message); } @@ -216,7 +216,7 @@ export default class ElectronAppWrapper { } } - registerPluginWindow(pluginId:string, window:any) { + registerPluginWindow(pluginId: string, window: any) { this.pluginWindows_[pluginId] = window; } @@ -278,7 +278,7 @@ export default class ElectronAppWrapper { } // Note: this must be called only after the "ready" event of the app has been dispatched - createTray(contextMenu:any) { + createTray(contextMenu: any) { try { this.tray_ = new Tray(`${this.buildDir()}/icons/${this.trayIconFilename_()}`); this.tray_.setToolTip(this.electronApp_.name); diff --git a/packages/app-desktop/InteropServiceHelper.ts b/packages/app-desktop/InteropServiceHelper.ts index 5ca0d6ff9..5c6454e8c 100644 --- a/packages/app-desktop/InteropServiceHelper.ts +++ b/packages/app-desktop/InteropServiceHelper.ts @@ -23,10 +23,10 @@ interface ExportNoteOptions { export default class InteropServiceHelper { - private static async exportNoteToHtmlFile(noteId:string, exportOptions:ExportNoteOptions) { + private static async exportNoteToHtmlFile(noteId: string, exportOptions: ExportNoteOptions) { const tempFile = `${Setting.value('tempDir')}/${md5(Date.now() + Math.random())}.html`; - const fullExportOptions:ExportOptions = Object.assign({}, { + const fullExportOptions: ExportOptions = Object.assign({}, { path: tempFile, format: 'html', target: FileSystemItem.File, @@ -41,9 +41,9 @@ export default class InteropServiceHelper { return tempFile; } - private static async exportNoteTo_(target:string, noteId:string, options:ExportNoteOptions = {}) { - let win:any = null; - let htmlFile:string = null; + private static async exportNoteTo_(target: string, noteId: string, options: ExportNoteOptions = {}) { + let win: any = null; + let htmlFile: string = null; const cleanup = () => { if (win) win.destroy(); @@ -87,7 +87,7 @@ export default class InteropServiceHelper { // Maybe can be fixed by doing everything from main process? // i.e. creating a function `print()` that takes the `htmlFile` variable as input. - win.webContents.print(options, (success:boolean, reason:string) => { + win.webContents.print(options, (success: boolean, reason: string) => { // TODO: This is correct but broken in Electron 4. Need to upgrade to 5+ // It calls the callback right away with "false" even if the document hasn't be print yet. @@ -112,15 +112,15 @@ export default class InteropServiceHelper { } } - public static async exportNoteToPdf(noteId:string, options:ExportNoteOptions = {}) { + public static async exportNoteToPdf(noteId: string, options: ExportNoteOptions = {}) { return this.exportNoteTo_('pdf', noteId, options); } - public static async printNote(noteId:string, options:ExportNoteOptions = {}) { + public static async printNote(noteId: string, options: ExportNoteOptions = {}) { return this.exportNoteTo_('printer', noteId, options); } - public static async defaultFilename(noteId:string, fileExtension:string) { + public static async defaultFilename(noteId: string, fileExtension: string) { // Default filename is just the date const date = time.formatMsToLocal(new Date().getTime(), time.dateFormat()); let filename = friendlySafeFilename(`${date}`, 100); @@ -134,7 +134,7 @@ export default class InteropServiceHelper { return `${filename}.${fileExtension}`; } - public static async export(_dispatch:Function, module:Module, options:ExportNoteOptions = null) { + public static async export(_dispatch: Function, module: Module, options: ExportNoteOptions = null) { if (!options) options = {}; let path = null; @@ -157,7 +157,7 @@ export default class InteropServiceHelper { CommandService.instance().execute('showModalMessage', _('Exporting to "%s" as "%s" format. Please wait...', path, module.format)); - const exportOptions:ExportOptions = {}; + const exportOptions: ExportOptions = {}; exportOptions.path = path; exportOptions.format = module.format; exportOptions.modulePath = module.path; diff --git a/packages/app-desktop/app.ts b/packages/app-desktop/app.ts index 979dc42f1..bf0636ed0 100644 --- a/packages/app-desktop/app.ts +++ b/packages/app-desktop/app.ts @@ -118,7 +118,7 @@ export interface AppState extends State { watchedResources: any, } -const appDefaultState:AppState = { +const appDefaultState: AppState = { ...defaultState, route: { type: 'NAV_GO', @@ -154,7 +154,7 @@ class Application extends BaseApplication { return `${Setting.value('profileDir')}/log-autoupdater.txt`; } - reducer(state:AppState = appDefaultState, action:any) { + reducer(state: AppState = appDefaultState, action: any) { let newState = state; try { @@ -200,7 +200,7 @@ class Application extends BaseApplication { case 'NOTE_VISIBLE_PANES_TOGGLE': { - const getNextLayout = (currentLayout:any) => { + const getNextLayout = (currentLayout: any) => { currentLayout = panes.length === 2 ? 'both' : currentLayout[0]; let paneOptions; @@ -345,7 +345,7 @@ class Application extends BaseApplication { return newState; } - toggleDevTools(visible:boolean) { + toggleDevTools(visible: boolean) { if (visible) { bridge().openDevTools(); } else { @@ -353,7 +353,7 @@ class Application extends BaseApplication { } } - async generalMiddleware(store:any, next:any, action:any) { + async generalMiddleware(store: any, next: any, action: any) { if (action.type == 'SETTING_UPDATE_ONE' && action.key == 'locale' || action.type == 'SETTING_UPDATE_ALL') { setLocale(Setting.value('locale')); // The bridge runs within the main process, with its own instance of locale.js @@ -459,14 +459,14 @@ class Application extends BaseApplication { // The context menu must be setup in renderer process because that's where // the spell checker service lives. require('electron-context-menu')({ - shouldShowMenu: (_event:any, params:any) => { + shouldShowMenu: (_event: any, params: any) => { // params.inputFieldType === 'none' when right-clicking the text editor. This is a bit of a hack to detect it because in this // case we don't want to use the built-in context menu but a custom one. return params.isEditable && params.inputFieldType !== 'none'; }, - menu: (actions:any, props:any) => { - const spellCheckerMenuItems = SpellCheckerService.instance().contextMenuItems(props.misspelledWord, props.dictionarySuggestions).map((item:any) => new MenuItem(item)); + menu: (actions: any, props: any) => { + const spellCheckerMenuItems = SpellCheckerService.instance().contextMenuItems(props.misspelledWord, props.dictionarySuggestions).map((item: any) => new MenuItem(item)); const output = [ actions.cut(), @@ -480,7 +480,7 @@ class Application extends BaseApplication { }); } - async loadCustomCss(filePath:string) { + async loadCustomCss(filePath: string) { let cssString = ''; if (await fs.pathExists(filePath)) { try { @@ -497,7 +497,7 @@ class Application extends BaseApplication { return cssString; } - async start(argv:string[]):Promise { + async start(argv: string[]): Promise { const electronIsDev = require('electron-is-dev'); // If running inside a package, the command line, instead of being "node.exe " is "joplin.exe " so @@ -527,7 +527,7 @@ class Application extends BaseApplication { AlarmService.setDriver(new AlarmServiceDriverNode({ appName: packageInfo.build.appId })); AlarmService.setLogger(reg.logger()); - reg.setShowErrorMessageBoxHandler((message:string) => { bridge().showErrorMessageBox(message); }); + reg.setShowErrorMessageBoxHandler((message: string) => { bridge().showErrorMessageBox(message); }); if (Setting.value('flagOpenDevTools')) { bridge().openDevTools(); @@ -672,7 +672,7 @@ class Application extends BaseApplication { ExternalEditWatcher.instance().setLogger(reg.logger()); ExternalEditWatcher.instance().dispatch = this.store().dispatch; - ResourceEditWatcher.instance().initialize(reg.logger(), (action:any) => { this.store().dispatch(action); }); + ResourceEditWatcher.instance().initialize(reg.logger(), (action: any) => { this.store().dispatch(action); }); RevisionService.instance().runInBackground(); @@ -705,7 +705,7 @@ class Application extends BaseApplication { try { if (Setting.value('plugins.devPluginPaths')) { - const paths = Setting.value('plugins.devPluginPaths').split(',').map((p:string) => p.trim()); + const paths = Setting.value('plugins.devPluginPaths').split(',').map((p: string) => p.trim()); await PluginService.instance().loadAndRunPlugins(paths); } @@ -732,7 +732,7 @@ class Application extends BaseApplication { } -let application_:Application = null; +let application_: Application = null; function app() { if (!application_) application_ = new Application(); diff --git a/packages/app-desktop/bridge.ts b/packages/app-desktop/bridge.ts index 72b7f311c..555ca5152 100644 --- a/packages/app-desktop/bridge.ts +++ b/packages/app-desktop/bridge.ts @@ -11,15 +11,15 @@ interface LastSelectedPath { } interface LastSelectedPaths { - [key:string]: LastSelectedPath, + [key: string]: LastSelectedPath, } export class Bridge { - private electronWrapper_:ElectronAppWrapper; - private lastSelectedPaths_:LastSelectedPaths; + private electronWrapper_: ElectronAppWrapper; + private lastSelectedPaths_: LastSelectedPaths; - constructor(electronWrapper:ElectronAppWrapper) { + constructor(electronWrapper: ElectronAppWrapper) { this.electronWrapper_ = electronWrapper; this.lastSelectedPaths_ = { file: null, @@ -43,11 +43,11 @@ export class Bridge { return this.electronWrapper_.window(); } - showItemInFolder(fullPath:string) { + showItemInFolder(fullPath: string) { return require('electron').shell.showItemInFolder(toSystemSlashes(fullPath)); } - newBrowserWindow(options:any) { + newBrowserWindow(options: any) { return new BrowserWindow(options); } @@ -63,7 +63,7 @@ export class Bridge { return { width: s[0], height: s[1] }; } - windowSetSize(width:number, height:number) { + windowSetSize(width: number, height: number) { if (!this.window()) return; return this.window().setSize(width, height); } @@ -76,7 +76,7 @@ export class Bridge { return this.window().webContents.closeDevTools(); } - showSaveDialog(options:any) { + showSaveDialog(options: any) { const { dialog } = require('electron'); if (!options) options = {}; if (!('defaultPath' in options) && this.lastSelectedPaths_.file) options.defaultPath = this.lastSelectedPaths_.file; @@ -87,7 +87,7 @@ export class Bridge { return filePath; } - showOpenDialog(options:any) { + showOpenDialog(options: any) { const { dialog } = require('electron'); if (!options) options = {}; let fileType = 'file'; @@ -102,13 +102,13 @@ export class Bridge { } // Don't use this directly - call one of the showXxxxxxxMessageBox() instead - showMessageBox_(window:any, options:any):number { + showMessageBox_(window: any, options: any): number { const { dialog } = require('electron'); if (!window) window = this.window(); return dialog.showMessageBoxSync(window, options); } - showErrorMessageBox(message:string) { + showErrorMessageBox(message: string) { return this.showMessageBox_(this.window(), { type: 'error', message: message, @@ -116,7 +116,7 @@ export class Bridge { }); } - showConfirmMessageBox(message:string, options:any = null) { + showConfirmMessageBox(message: string, options: any = null) { if (options === null) options = {}; const result = this.showMessageBox_(this.window(), Object.assign({}, { @@ -130,7 +130,7 @@ export class Bridge { } /* returns the index of the clicked button */ - showMessageBox(message:string, options:any = null) { + showMessageBox(message: string, options: any = null) { if (options === null) options = {}; const result = this.showMessageBox_(this.window(), Object.assign({}, { @@ -142,7 +142,7 @@ export class Bridge { return result; } - showInfoMessageBox(message:string, options:any = {}) { + showInfoMessageBox(message: string, options: any = {}) { const result = this.showMessageBox_(this.window(), Object.assign({}, { type: 'info', message: message, @@ -151,7 +151,7 @@ export class Bridge { return result === 0; } - setLocale(locale:string) { + setLocale(locale: string) { setLocale(locale); } @@ -163,15 +163,15 @@ export class Bridge { return require('electron').MenuItem; } - openExternal(url:string) { + openExternal(url: string) { return require('electron').shell.openExternal(url); } - openItem(fullPath:string) { + openItem(fullPath: string) { return require('electron').shell.openItem(fullPath); } - checkForUpdates(inBackground:boolean, window:any, logFilePath:string, options:any) { + checkForUpdates(inBackground: boolean, window: any, logFilePath: string, options: any) { const { checkForUpdates } = require('./checkForUpdates.js'); checkForUpdates(inBackground, window, logFilePath, options); } @@ -188,7 +188,7 @@ export class Bridge { return nativeTheme.shouldUseDarkColors; } - addEventListener(name:string, fn:Function) { + addEventListener(name: string, fn: Function) { if (name === 'nativeThemeUpdated') { nativeTheme.on('updated', fn); } else { @@ -218,9 +218,9 @@ export class Bridge { } -let bridge_:Bridge = null; +let bridge_: Bridge = null; -export function initBridge(wrapper:ElectronAppWrapper) { +export function initBridge(wrapper: ElectronAppWrapper) { if (bridge_) throw new Error('Bridge already initialized'); bridge_ = new Bridge(wrapper); return bridge_; diff --git a/packages/app-desktop/commands/copyDevCommand.ts b/packages/app-desktop/commands/copyDevCommand.ts index 9c528af56..80d17c8a2 100644 --- a/packages/app-desktop/commands/copyDevCommand.ts +++ b/packages/app-desktop/commands/copyDevCommand.ts @@ -3,12 +3,12 @@ import { _ } from '@joplin/lib/locale'; const app = require('electron').remote.app; const { clipboard } = require('electron'); -export const declaration:CommandDeclaration = { +export const declaration: CommandDeclaration = { name: 'copyDevCommand', label: () => _('Copy dev mode command to clipboard'), }; -export const runtime = ():CommandRuntime => { +export const runtime = (): CommandRuntime => { return { execute: async () => { const appPath = app.getPath('exe'); diff --git a/packages/app-desktop/commands/focusElement.ts b/packages/app-desktop/commands/focusElement.ts index c6f55193e..d6f5add90 100644 --- a/packages/app-desktop/commands/focusElement.ts +++ b/packages/app-desktop/commands/focusElement.ts @@ -1,12 +1,12 @@ import CommandService, { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService'; -export const declaration:CommandDeclaration = { +export const declaration: CommandDeclaration = { name: 'focusElement', }; -export const runtime = ():CommandRuntime => { +export const runtime = (): CommandRuntime => { return { - execute: async (_context:any, target:string) => { + execute: async (_context: any, target: string) => { if (target === 'noteBody') return CommandService.instance().execute('focusElementNoteBody'); if (target === 'noteList') return CommandService.instance().execute('focusElementNoteList'); if (target === 'sideBar') return CommandService.instance().execute('focusElementSideBar'); diff --git a/packages/app-desktop/commands/openProfileDirectory.ts b/packages/app-desktop/commands/openProfileDirectory.ts index 71d792672..c6ac72325 100644 --- a/packages/app-desktop/commands/openProfileDirectory.ts +++ b/packages/app-desktop/commands/openProfileDirectory.ts @@ -3,12 +3,12 @@ import { _ } from '@joplin/lib/locale'; import bridge from '../services/bridge'; import Setting from '@joplin/lib/models/Setting'; -export const declaration:CommandDeclaration = { +export const declaration: CommandDeclaration = { name: 'openProfileDirectory', label: () => _('Open profile directory'), }; -export const runtime = ():CommandRuntime => { +export const runtime = (): CommandRuntime => { return { execute: async () => { bridge().openItem(Setting.value('profileDir')); diff --git a/packages/app-desktop/commands/startExternalEditing.ts b/packages/app-desktop/commands/startExternalEditing.ts index 519dac881..c489cb9f5 100644 --- a/packages/app-desktop/commands/startExternalEditing.ts +++ b/packages/app-desktop/commands/startExternalEditing.ts @@ -5,15 +5,15 @@ const Note = require('@joplin/lib/models/Note'); const ExternalEditWatcher = require('@joplin/lib/services/ExternalEditWatcher'); const bridge = require('electron').remote.require('./bridge').default; -export const declaration:CommandDeclaration = { +export const declaration: CommandDeclaration = { name: 'startExternalEditing', label: () => _('Edit in external editor'), iconName: 'icon-share', }; -export const runtime = ():CommandRuntime => { +export const runtime = (): CommandRuntime => { return { - execute: async (context:CommandContext, noteId:string = null) => { + execute: async (context: CommandContext, noteId: string = null) => { noteId = noteId || stateUtils.selectedNoteId(context.state); try { diff --git a/packages/app-desktop/commands/stopExternalEditing.ts b/packages/app-desktop/commands/stopExternalEditing.ts index fa4d23b21..d27eb1f10 100644 --- a/packages/app-desktop/commands/stopExternalEditing.ts +++ b/packages/app-desktop/commands/stopExternalEditing.ts @@ -3,15 +3,15 @@ import { _ } from '@joplin/lib/locale'; import { stateUtils } from '@joplin/lib/reducer'; const ExternalEditWatcher = require('@joplin/lib/services/ExternalEditWatcher'); -export const declaration:CommandDeclaration = { +export const declaration: CommandDeclaration = { name: 'stopExternalEditing', label: () => _('Stop external editing'), iconName: 'fa-stop', }; -export const runtime = ():CommandRuntime => { +export const runtime = (): CommandRuntime => { return { - execute: async (context:CommandContext, noteId:string = null) => { + execute: async (context: CommandContext, noteId: string = null) => { noteId = noteId || stateUtils.selectedNoteId(context.state); ExternalEditWatcher.instance().stopWatching(noteId); }, diff --git a/packages/app-desktop/commands/toggleExternalEditing.ts b/packages/app-desktop/commands/toggleExternalEditing.ts index 9097a7ded..f5d3eaf86 100644 --- a/packages/app-desktop/commands/toggleExternalEditing.ts +++ b/packages/app-desktop/commands/toggleExternalEditing.ts @@ -3,15 +3,15 @@ import { _ } from '@joplin/lib/locale'; import { stateUtils } from '@joplin/lib/reducer'; import { DesktopCommandContext } from '../services/commands/types'; -export const declaration:CommandDeclaration = { +export const declaration: CommandDeclaration = { name: 'toggleExternalEditing', label: () => _('Toggle external editing'), iconName: 'icon-share', }; -export const runtime = ():CommandRuntime => { +export const runtime = (): CommandRuntime => { return { - execute: async (context:DesktopCommandContext, noteId:string = null) => { + execute: async (context: DesktopCommandContext, noteId: string = null) => { noteId = noteId || stateUtils.selectedNoteId(context.state); if (!noteId) return; @@ -23,7 +23,7 @@ export const runtime = ():CommandRuntime => { } }, enabledCondition: 'oneNoteSelected', - mapStateToTitle: (state:any) => { + mapStateToTitle: (state: any) => { const noteId = stateUtils.selectedNoteId(state); return state.watchedNoteFiles.includes(noteId) ? _('Stop') : ''; }, diff --git a/packages/app-desktop/gui/Button/Button.tsx b/packages/app-desktop/gui/Button/Button.tsx index 81e73b6ec..633caf784 100644 --- a/packages/app-desktop/gui/Button/Button.tsx +++ b/packages/app-desktop/gui/Button/Button.tsx @@ -13,13 +13,13 @@ interface Props { title?: string, iconName?: string, level?: ButtonLevel, - className?:string, - onClick:Function, + className?: string, + onClick: Function, color?: string, iconAnimation?: string, tooltip?: string, disabled?: boolean, - style?:any, + style?: any, } const StyledTitle = styled.span` @@ -30,143 +30,143 @@ const StyledButtonBase = styled.button` display: flex; align-items: center; flex-direction: row; - height: ${(props:any) => `${props.theme.toolbarHeight}px`}; - min-height: ${(props:any) => `${props.theme.toolbarHeight}px`}; - max-height: ${(props:any) => `${props.theme.toolbarHeight}px`}; - width: ${(props:any) => props.iconOnly ? `${props.theme.toolbarHeight}px` : 'auto'}; - ${(props:any) => props.iconOnly ? `min-width: ${props.theme.toolbarHeight}px;` : ''} - ${(props:any) => !props.iconOnly ? 'min-width: 100px;' : ''} - ${(props:any) => props.iconOnly ? `max-width: ${props.theme.toolbarHeight}px;` : ''} + height: ${(props: any) => `${props.theme.toolbarHeight}px`}; + min-height: ${(props: any) => `${props.theme.toolbarHeight}px`}; + max-height: ${(props: any) => `${props.theme.toolbarHeight}px`}; + width: ${(props: any) => props.iconOnly ? `${props.theme.toolbarHeight}px` : 'auto'}; + ${(props: any) => props.iconOnly ? `min-width: ${props.theme.toolbarHeight}px;` : ''} + ${(props: any) => !props.iconOnly ? 'min-width: 100px;' : ''} + ${(props: any) => props.iconOnly ? `max-width: ${props.theme.toolbarHeight}px;` : ''} box-sizing: border-box; border-radius: 3px; border-style: solid; border-width: 1px; - font-size: ${(props:any) => props.theme.fontSize}px; - padding: 0 ${(props:any) => props.iconOnly ? 4 : 8}px; + font-size: ${(props: any) => props.theme.fontSize}px; + padding: 0 ${(props: any) => props.iconOnly ? 4 : 8}px; justify-content: center; - opacity: ${(props:any) => props.disabled ? 0.5 : 1}; + opacity: ${(props: any) => props.disabled ? 0.5 : 1}; user-select: none; `; const StyledIcon = styled(styled.span(space))` - font-size: ${(props:any) => props.theme.toolbarIconSize}px; - ${(props:any) => props.animation ? `animation: ${props.animation}` : ''}; + font-size: ${(props: any) => props.theme.toolbarIconSize}px; + ${(props: any) => props.animation ? `animation: ${props.animation}` : ''}; `; const StyledButtonPrimary = styled(StyledButtonBase)` border: none; - background-color: ${(props:any) => props.theme.backgroundColor5}; + background-color: ${(props: any) => props.theme.backgroundColor5}; &:hover { - background-color: ${(props:any) => props.theme.backgroundColorHover5}; + background-color: ${(props: any) => props.theme.backgroundColorHover5}; } &:active { - background-color: ${(props:any) => props.theme.backgroundColorActive5}; + background-color: ${(props: any) => props.theme.backgroundColorActive5}; } ${StyledIcon} { - color: ${(props:any) => props.theme.color5}; + color: ${(props: any) => props.theme.color5}; } ${StyledTitle} { - color: ${(props:any) => props.theme.color5}; + color: ${(props: any) => props.theme.color5}; } `; const StyledButtonSecondary = styled(StyledButtonBase)` - border: 1px solid ${(props:any) => props.theme.borderColor4}; - background-color: ${(props:any) => props.theme.backgroundColor4}; + border: 1px solid ${(props: any) => props.theme.borderColor4}; + background-color: ${(props: any) => props.theme.backgroundColor4}; &:hover { - background-color: ${(props:any) => props.theme.backgroundColorHover4}; + background-color: ${(props: any) => props.theme.backgroundColorHover4}; } &:active { - background-color: ${(props:any) => props.theme.backgroundColorActive4}; + background-color: ${(props: any) => props.theme.backgroundColorActive4}; } ${StyledIcon} { - color: ${(props:any) => props.theme.color4}; + color: ${(props: any) => props.theme.color4}; } ${StyledTitle} { - color: ${(props:any) => props.theme.color4}; + color: ${(props: any) => props.theme.color4}; } `; const StyledButtonTertiary = styled(StyledButtonBase)` - border: 1px solid ${(props:any) => props.theme.color3}; - background-color: ${(props:any) => props.theme.backgroundColor3}; + border: 1px solid ${(props: any) => props.theme.color3}; + background-color: ${(props: any) => props.theme.backgroundColor3}; &:hover { - background-color: ${(props:any) => props.theme.backgroundColorHoverDim3}; + background-color: ${(props: any) => props.theme.backgroundColorHoverDim3}; } &:active { - background-color: ${(props:any) => props.theme.backgroundColorActive3}; + background-color: ${(props: any) => props.theme.backgroundColorActive3}; } ${StyledIcon} { - color: ${(props:any) => props.theme.color}; + color: ${(props: any) => props.theme.color}; } ${StyledTitle} { - color: ${(props:any) => props.theme.color}; + color: ${(props: any) => props.theme.color}; opacity: 0.9; } `; const StyledButtonSideBarSecondary = styled(StyledButtonBase)` background: none; - border-color: ${(props:any) => props.theme.color2}; - color: ${(props:any) => props.theme.color2}; + border-color: ${(props: any) => props.theme.color2}; + color: ${(props: any) => props.theme.color2}; &:hover { - color: ${(props:any) => props.theme.colorHover2}; - border-color: ${(props:any) => props.theme.colorHover2}; + color: ${(props: any) => props.theme.colorHover2}; + border-color: ${(props: any) => props.theme.colorHover2}; background: none; ${StyledTitle} { - color: ${(props:any) => props.theme.colorHover2}; + color: ${(props: any) => props.theme.colorHover2}; } ${StyledIcon} { - color: ${(props:any) => props.theme.colorHover2}; + color: ${(props: any) => props.theme.colorHover2}; } } &:active { - color: ${(props:any) => props.theme.colorActive2}; - border-color: ${(props:any) => props.theme.colorActive2}; + color: ${(props: any) => props.theme.colorActive2}; + border-color: ${(props: any) => props.theme.colorActive2}; background: none; ${StyledTitle} { - color: ${(props:any) => props.theme.colorActive2}; + color: ${(props: any) => props.theme.colorActive2}; } ${StyledIcon} { - color: ${(props:any) => props.theme.colorActive2}; + color: ${(props: any) => props.theme.colorActive2}; } } ${StyledTitle} { - color: ${(props:any) => props.theme.color2}; + color: ${(props: any) => props.theme.color2}; } ${StyledIcon} { - color: ${(props:any) => props.theme.color2}; + color: ${(props: any) => props.theme.color2}; } `; -function buttonClass(level:ButtonLevel) { +function buttonClass(level: ButtonLevel) { if (level === ButtonLevel.Primary) return StyledButtonPrimary; if (level === ButtonLevel.Tertiary) return StyledButtonTertiary; if (level === ButtonLevel.SideBarSecondary) return StyledButtonSideBarSecondary; return StyledButtonSecondary; } -export default function Button(props:Props) { +export default function Button(props: Props) { const iconOnly = props.iconName && !props.title; const StyledButton = buttonClass(props.level); diff --git a/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx b/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx index 823296585..3083ac196 100644 --- a/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx +++ b/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx @@ -15,14 +15,14 @@ export const StyledRoot = styled.div` display: flex; align-items: center; padding: 10px; - background-color: ${(props:any) => props.theme.backgroundColor3}; - padding-left: ${(props:any) => props.theme.configScreenPadding}px; + background-color: ${(props: any) => props.theme.backgroundColor3}; + padding-left: ${(props: any) => props.theme.configScreenPadding}px; border-top-width: 1px; border-top-style: solid; - border-top-color: ${(props:any) => props.theme.dividerColor}; + border-top-color: ${(props: any) => props.theme.dividerColor}; `; -export default function ButtonBar(props:Props) { +export default function ButtonBar(props: Props) { function renderOkButton() { if (!props.onSaveClick) return null; return