Skip to content

Commit 30ccae1

Browse files
Finish fixing JS lint
1 parent 97bbf81 commit 30ccae1

14 files changed

Lines changed: 59 additions & 43 deletions

File tree

app/components/about.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class AboutComponent extends Component<AboutSignature> {
2323

2424
this.ipcRenderer = ipcRenderer;
2525

26-
this.ipcRenderer.invoke('getAppVersion').then((version: string) => {
26+
void this.ipcRenderer.invoke('getAppVersion').then((version: string) => {
2727
this.version = version;
2828
});
2929
}
@@ -34,7 +34,7 @@ export default class AboutComponent extends Component<AboutSignature> {
3434
event.preventDefault();
3535

3636
if (typeof requireNode !== 'undefined') {
37-
requireNode('electron').shell.openExternal('https://swach.io/');
37+
void this.ipcRenderer.invoke('open-external', 'https://swach.io/');
3838
}
3939
}
4040
}

app/components/animated-drag-sort-list.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default class AnimatedDragSortList extends DragSortList {
1717
@action
1818
rules(): unknown {
1919
if (!this.didDrag) {
20+
// eslint-disable-next-line @typescript-eslint/unbound-method
2021
return this.transition;
2122
}
2223

@@ -25,6 +26,7 @@ export default class AnimatedDragSortList extends DragSortList {
2526
return null;
2627
}
2728

29+
// eslint-disable-next-line require-yield
2830
*transition({
2931
keptSprites,
3032
insertedSprites,

app/components/color-picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class ColorPickerComponent extends Component<ColorPickerSignature
9393

9494
this.undoManager.setupUndoRedo();
9595
} else {
96-
this.args.saveColor(this._selectedColor?.hex);
96+
await this.args.saveColor(this._selectedColor?.hex);
9797
}
9898

9999
this.args.toggleIsShown();

app/components/colors-list.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
4646
return undefined;
4747
}
4848

49+
// eslint-disable-next-line require-yield
4950
*transition({
5051
keptSprites,
5152
insertedSprites,
@@ -73,7 +74,7 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
7374
}
7475

7576
@action
76-
async deleteColor(color: ColorModel): Promise<void> {
77+
async deleteColor(color: ColorModel){
7778
const { palette } = this.args;
7879

7980
if (color && palette && !palette.isLocked) {

app/components/contrast-checker.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type Owner from '@ember/owner';
33
import Component from '@glimmer/component';
44
import { tracked } from '@glimmer/tracking';
55

6+
import { type IroColorValue } from '@irojs/iro-core';
67
import iro from '@jaames/iro';
78
import type { IpcRenderer } from 'electron';
89
import { hex, score } from 'wcag-contrast';
@@ -37,13 +38,19 @@ export default class ContrastChecker extends Component<ContrastCheckerSignature>
3738

3839
this.ipcRenderer = ipcRenderer;
3940

40-
this.ipcRenderer.on('pickContrastBgColor', async (_event, color) => {
41-
this.setBgColor(color);
42-
});
41+
this.ipcRenderer.on(
42+
'pickContrastBgColor',
43+
(_event, color: IroColorValue) => {
44+
this.setBgColor(color);
45+
},
46+
);
4347

44-
this.ipcRenderer.on('pickContrastFgColor', async (_event, color) => {
45-
this.setFgColor(color);
46-
});
48+
this.ipcRenderer.on(
49+
'pickContrastFgColor',
50+
(_event, color: IroColorValue) => {
51+
this.setFgColor(color);
52+
},
53+
);
4754
}
4855
}
4956

@@ -139,16 +146,14 @@ export default class ContrastChecker extends Component<ContrastCheckerSignature>
139146

140147
@action
141148
onBlurBg(ev: Event) {
142-
this.setBgColor((ev.target as HTMLInputElement).value);
149+
this.setBgColor((ev.target as HTMLInputElement).value as IroColorValue);
143150
}
144151

145-
// TODO: correctly type this instead of using `any`
146-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
147-
setBgColor(color: any) {
152+
setBgColor(color: IroColorValue) {
148153
try {
149154
this.bgPickr.setColors([color]);
150155
this.backgroundColor = this.bgPickr.color.hexString;
151-
} catch (err) {
156+
} catch {
152157
// TODO: maybe mention the color is invalid here?
153158
}
154159
}
@@ -158,13 +163,11 @@ export default class ContrastChecker extends Component<ContrastCheckerSignature>
158163
this.setFgColor((ev.target as HTMLInputElement).value);
159164
}
160165

161-
// TODO: correctly type this instead of using `any`
162-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
163-
setFgColor(color: any) {
166+
setFgColor(color: IroColorValue) {
164167
try {
165168
this.fgPickr.setColors([color]);
166169
this.foregroundColor = this.fgPickr.color.hexString;
167-
} catch (err) {
170+
} catch {
168171
// TODO: maybe mention the color is invalid here?
169172
}
170173
}

app/components/loading-button.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface LoadingButtonSignature {
88
};
99
}
1010

11+
// eslint-disable-next-line ember/no-empty-glimmer-component-classes
1112
export default class LoadingButton extends Component<LoadingButtonSignature> {}
1213

1314
declare module '@glint/environment-ember-loose/registry' {

app/controllers/application.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export default class ApplicationController extends Controller {
109109
const addedColor = await this.addColor(color);
110110

111111
if (addedColor) {
112-
this.colorUtils.copyColorToClipboard(addedColor);
112+
await this.colorUtils.copyColorToClipboard(addedColor);
113113
}
114114
},
115115
);
@@ -122,7 +122,10 @@ export default class ApplicationController extends Controller {
122122
'openSharedPalette',
123123
// eslint-disable-next-line @typescript-eslint/no-misused-promises
124124
async (_event: unknown, query: string) => {
125-
const data = JSON.parse(decodeURIComponent(query));
125+
const data = JSON.parse(decodeURIComponent(query)) as {
126+
colors?: { name: string; hex: string }[];
127+
name?: string;
128+
};
126129
const colors = data?.colors ?? [];
127130
const name = data?.name ?? 'Palette';
128131

app/utils/view-transitions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export default function viewTransitions() {
44
}
55

66
return new Promise<void>((resolve) => {
7+
// eslint-disable-next-line @typescript-eslint/require-await
78
document.startViewTransition(async () => {
89
resolve();
910
});

electron-app/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const Sentry = require('@sentry/electron');
22
const { ipcMain, nativeTheme } = require('electron');
33
const isDev = require('electron-is-dev');
44
const Store = require('electron-store');
5+
// eslint-disable-next-line no-redeclare
56
const { menubar } = require('menubar');
67
const { basename, dirname, join, resolve } = require('path');
78
const { pathToFileURL } = require('url');

electron-app/src/ipc-events.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { app, clipboard, dialog, ipcMain, nativeTheme } = require('electron');
1+
const { app, clipboard, dialog, ipcMain, nativeTheme, shell } = require('electron');
22
const { download } = require('electron-dl');
33
const fs = require('fs');
44

@@ -65,6 +65,10 @@ function setupEventHandlers(mb, store) {
6565
await launchPicker(mb);
6666
});
6767

68+
ipcMain.handle('open-external', async (_event, url) => {
69+
await shell.openExternal(url);
70+
});
71+
6872
ipcMain.on('setShowDockIcon', async (channel, showDockIcon) => {
6973
store.set('showDockIcon', showDockIcon);
7074
await restartDialog();

0 commit comments

Comments
 (0)