Skip to content

Commit 61010ac

Browse files
committed
🆕 Added Biome. Formatted and made code suggestions
1 parent 0908d54 commit 61010ac

19 files changed

+351
-124
lines changed

.editorconfig

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ indent_style = tab
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true
10-
insert_final_newline = false
1110

1211
[package.json]
1312
indent_style = space

.prettierrc

-6
This file was deleted.

.vscode/extensions.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"biomejs.biome",
4+
"streetsidesoftware.code-spell-checker",
5+
"davidanson.vscode-markdownlint"
6+
]
7+
}

.vscode/settings.json

+16-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,26 @@
1818
"statusBar.foreground": "#FFF",
1919
"statusBar.border": "#586573"
2020
},
21-
"cSpell.words": [
21+
"cSpell.words": [
2222
"Asana",
23+
"biomejs",
2324
"Dominik",
2425
"doubleclick",
26+
"hideothers",
27+
"keychain",
2528
"keystorename",
2629
"keytar",
30+
"loginbutton",
31+
"loginform",
32+
"loginkeys",
33+
"loginpassword",
34+
"loginsubmitted",
35+
"loginusername",
36+
"Nuxt",
37+
"Omnibutton",
2738
"Schmitt",
28-
"Taskana"
39+
"selectall",
40+
"Taskana",
41+
"Topbar"
2942
]
30-
}
43+
}

biome.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3+
"files": {
4+
"ignore": ["dist/**/*"]
5+
},
6+
"organizeImports": {
7+
"enabled": true
8+
},
9+
"formatter": {
10+
"enabled": true,
11+
"useEditorconfig": true,
12+
"indentStyle": "tab",
13+
"indentWidth": 4,
14+
"lineEnding": "lf",
15+
"lineWidth": 80,
16+
"attributePosition": "auto"
17+
},
18+
"linter": {
19+
"enabled": true,
20+
"rules": {
21+
"recommended": true,
22+
"complexity": { "noForEach": "off" }
23+
}
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"jsxQuoteStyle": "single",
28+
"quoteProperties": "asNeeded",
29+
"trailingCommas": "es5",
30+
"semicolons": "always",
31+
"arrowParentheses": "always",
32+
"bracketSpacing": true,
33+
"bracketSameLine": false,
34+
"quoteStyle": "single",
35+
"attributePosition": "auto"
36+
}
37+
},
38+
"vcs": {
39+
"enabled": true,
40+
"clientKind": "git",
41+
"useIgnoreFile": true
42+
}
43+
}

browser.cjs

+17-17
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ ipcRenderer.on('new-task', () => {
88
});
99

1010
ipcRenderer.on('show-preferences', () => {
11-
document.querySelector('.TopbarSettingsMenuButton').click();
12-
document.querySelector('.TopbarSettingsMenu-settings').click();
11+
document.querySelector('.TopbarSettingsMenuButton')?.click();
12+
document.querySelector('.TopbarSettingsMenu-settings')?.click();
1313
});
1414

1515
document.addEventListener('readystatechange', async () => {
1616
const DomHooks = {
17-
'loginform': '.LoginEmailPasswordForm',
18-
'loginusername': 'input[name=e]',
19-
'loginpassword': 'input[name=p]',
20-
'loginbutton': '[role=button]'
17+
loginform: '.LoginEmailPasswordForm',
18+
loginusername: 'input[name=e]',
19+
loginpassword: 'input[name=p]',
20+
loginbutton: '[role=button]',
2121
};
2222

2323
if (document.location.pathname.endsWith('/login')) {
@@ -32,19 +32,19 @@ document.addEventListener('readystatechange', async () => {
3232
const event = new Event('HTMLEvents');
3333
event.initEvent('change', true, false);
3434

35-
if (loginkeys && loginkeys.username) {
35+
if (loginkeys?.username) {
3636
loginusername.value = loginkeys.username;
3737
loginusername.dispatchEvent(event);
3838
}
3939

40-
if (loginkeys && loginkeys.password) {
40+
if (loginkeys?.password) {
4141
loginpassword.value = loginkeys.password;
4242
loginpassword.dispatchEvent(event);
4343
}
4444

45-
const loginsubmitted = async function() {
46-
let username = loginusername.value;
47-
let password = loginpassword.value;
45+
const loginsubmitted = async () => {
46+
const username = loginusername.value;
47+
const password = loginpassword.value;
4848

4949
if (username && password) {
5050
await keyStore.deleteKeys(); // delete any exiting logins
@@ -55,14 +55,14 @@ document.addEventListener('readystatechange', async () => {
5555
// add a listener to the form to capture login details and store them
5656
// would be nice to add to just the <FORM> submit event, but React/Nuxt (used by Asana) captures the events lower in the DOM
5757
// loginform.addEventListener('submit', loginsubmitted);
58-
loginform.querySelector(DomHooks.loginbutton).addEventListener('click', loginsubmitted);
58+
loginform
59+
.querySelector(DomHooks.loginbutton)
60+
.addEventListener('click', loginsubmitted);
5961
loginusername.addEventListener('keyup', (e) => {
60-
if (e.code == 'Enter')
61-
loginsubmitted()
62+
if (e.code === 'Enter') loginsubmitted();
6263
});
6364
loginpassword.addEventListener('keyup', (e) => {
64-
if (e.code == 'Enter')
65-
loginsubmitted()
65+
if (e.code === 'Enter') loginsubmitted();
6666
});
6767
}
68-
});
68+
});

browser.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
.SidebarInvite,
55
.TopbarHelpMenuButton-button /* Most of these are in Taskana's Help menu */ {
66
display: none !important;
7-
}
7+
}

index.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { app, BrowserWindow, Menu, shell, ipcMain } from 'electron';
2-
import electronUpdater from 'electron-updater';
1+
import fs from 'node:fs';
2+
import path from 'node:path';
3+
import { BrowserWindow, Menu, app, ipcMain, shell } from 'electron';
34
import contextMenu from 'electron-context-menu';
45
import Store from 'electron-store';
5-
import path from 'node:path';
6-
import fs from 'node:fs';
6+
import electronUpdater from 'electron-updater';
77
import menu from './menu/index.js';
88

99
const config = new Store();
@@ -47,7 +47,7 @@ function updateBadgeInfo(title) {
4747
function createMainWindow() {
4848
contextMenu();
4949

50-
let opts = {
50+
const opts = {
5151
title: app.getName(),
5252
width: 1200,
5353
height: 600,
@@ -60,7 +60,7 @@ function createMainWindow() {
6060
preload: path.resolve(app.getAppPath(), 'browser.cjs'),
6161
partition: 'persist:asana',
6262
spellcheck: true,
63-
}
63+
},
6464
};
6565
Object.assign(opts, config.get('winBounds'));
6666

@@ -91,7 +91,7 @@ function createMainWindow() {
9191
return win;
9292
}
9393

94-
if ( !app.requestSingleInstanceLock() ) {
94+
if (!app.requestSingleInstanceLock()) {
9595
app.quit();
9696
}
9797

@@ -104,9 +104,11 @@ app.on('second-instance', () => {
104104

105105
ipcMain.on('update-menu', () => {
106106
Menu.setApplicationMenu(menu.slice(1));
107-
})
107+
});
108108

109-
app.on('before-quit', () => isQuitting = true);
109+
app.on('before-quit', () => {
110+
isQuitting = true;
111+
});
110112

111113
app.on('ready', () => {
112114
mainWindow = createMainWindow();
@@ -116,8 +118,7 @@ app.on('ready', () => {
116118

117119
// Open new browser window on external open
118120
page.setWindowOpenHandler(({ url }) => {
119-
if ( basicURL(url) )
120-
shell.openExternal(url);
121+
if (basicURL(url)) shell.openExternal(url);
121122

122123
return { action: 'deny' }; // prevent a new Electron window
123124
});
@@ -160,4 +161,4 @@ app.on('activate', () => {
160161
if (BrowserWindow.getAllWindows().length === 0) {
161162
createMainWindow();
162163
}
163-
});
164+
});

menu/edit.js

+36-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
export default {
22
label: 'Edit',
3-
submenu: [{
4-
label: 'Undo',
5-
accelerator: 'CommandOrControl+Z',
6-
role: 'undo'
7-
}, {
8-
label: 'Redo',
9-
accelerator: 'Shift+CommandOrControl+Z',
10-
role: 'redo'
11-
}, {
12-
type: 'separator'
13-
}, {
14-
label: 'Cut',
15-
accelerator: 'CommandOrControl+X',
16-
role: 'cut'
17-
}, {
18-
label: 'Copy',
19-
accelerator: 'CommandOrControl+C',
20-
role: 'copy'
21-
}, {
22-
label: 'Paste',
23-
accelerator: 'CommandOrControl+V',
24-
role: 'paste'
25-
}, {
26-
label: 'Select All',
27-
accelerator: 'CommandOrControl+A',
28-
role: 'selectall'
29-
}]
30-
}
3+
submenu: [
4+
{
5+
label: 'Undo',
6+
accelerator: 'CommandOrControl+Z',
7+
role: 'undo',
8+
},
9+
{
10+
label: 'Redo',
11+
accelerator: 'Shift+CommandOrControl+Z',
12+
role: 'redo',
13+
},
14+
{
15+
type: 'separator',
16+
},
17+
{
18+
label: 'Cut',
19+
accelerator: 'CommandOrControl+X',
20+
role: 'cut',
21+
},
22+
{
23+
label: 'Copy',
24+
accelerator: 'CommandOrControl+C',
25+
role: 'copy',
26+
},
27+
{
28+
label: 'Paste',
29+
accelerator: 'CommandOrControl+V',
30+
role: 'paste',
31+
},
32+
{
33+
label: 'Select All',
34+
accelerator: 'CommandOrControl+A',
35+
role: 'selectall',
36+
},
37+
],
38+
};

menu/help.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { app, shell } from 'electron';
21
import os from 'node:os';
2+
import { app, shell } from 'electron';
33

44
export default {
55
label: 'Help',
@@ -17,7 +17,10 @@ export default {
1717
},
1818
{
1919
label: 'Keyboard Shortcuts',
20-
click: () => shell.openExternal('https://asana.com/guide/help/faq/shortcuts'),
20+
click: () =>
21+
shell.openExternal(
22+
'https://asana.com/guide/help/faq/shortcuts'
23+
),
2124
},
2225
{
2326
type: 'separator',
@@ -54,7 +57,8 @@ export default {
5457
},
5558
{
5659
label: `${app.getName()} Website...`,
57-
click: () => shell.openExternal('https://mountainash.github.io/taskana/'),
60+
click: () =>
61+
shell.openExternal('https://mountainash.github.io/taskana/'),
5862
},
5963
{
6064
label: 'Report an Issue...',
@@ -65,8 +69,12 @@ export default {
6569
${app.getName()} ${app.getVersion()}
6670
${process.platform} ${process.arch} ${os.release()}`;
6771

68-
shell.openExternal(`https://github.com/mountainash/taskana/issues/new?body=${encodeURIComponent(body)}`);
72+
shell.openExternal(
73+
`https://github.com/mountainash/taskana/issues/new?body=${encodeURIComponent(
74+
body
75+
)}`
76+
);
6977
},
7078
},
7179
],
72-
};
80+
};

menu/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Menu } from 'electron';
22

3+
import edit from './edit.js';
4+
import help from './help.js';
35
import main from './main.js';
46
import tasks from './tasks.js';
5-
import edit from './edit.js';
67
import window from './window.js';
7-
import help from './help.js';
88

99
const template = [main, tasks, edit, window, help];
1010

11-
export default Menu.buildFromTemplate(template);
11+
export default Menu.buildFromTemplate(template);

menu/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ export default {
5252
click: () => app.quit(),
5353
},
5454
],
55-
};
55+
};

0 commit comments

Comments
 (0)