Skip to content

Commit 424fdf3

Browse files
committed
style: reformat codebase with oxfmt
1 parent bd55cb4 commit 424fdf3

36 files changed

+2313
-2092
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
- ✨ Clean, minimal UI — feature-rich without the clutter
1818
- 🎨 Light / Dark / System theme with adjustable popup width
1919

20-
<!-- oxfmt-ignore -->
21-
| | |
22-
|---|---|
23-
| <img src=".github/assets/notifications.png" alt="Notifications" width="400"> | <img src=".github/assets/actions.gif" alt="Actions" width="400"> |
24-
| <img src=".github/assets/signin.png" alt="Sign in" width="400"> | <img src=".github/assets/settings.png" alt="Settings" width="400"> |
20+
| | |
21+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------ |
22+
| <img src=".github/assets/notifications.png" alt="Notifications" width="400"> | <img src=".github/assets/actions.gif" alt="Actions" width="400"> |
23+
| <img src=".github/assets/signin.png" alt="Sign in" width="400"> | <img src=".github/assets/settings.png" alt="Settings" width="400"> |
2524

2625
## Usage
2726

manifest-firefox.json

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,13 @@
33
"name": "GitHub Notifier Pro",
44
"version": "1.0.5",
55
"description": "GitHub notifications in the browser toolbar",
6-
"permissions": [
7-
"alarms",
8-
"storage",
9-
"notifications"
10-
],
11-
"host_permissions": [
12-
"https://api.github.com/*",
13-
"https://github.com/*"
14-
],
6+
"permissions": ["alarms", "storage", "notifications"],
7+
"host_permissions": ["https://api.github.com/*", "https://github.com/*"],
158
"content_security_policy": {
169
"extension_pages": "script-src 'self'; object-src 'self'"
1710
},
1811
"background": {
19-
"scripts": [
20-
"src/background/service-worker.js"
21-
],
12+
"scripts": ["src/background/service-worker.js"],
2213
"type": "module"
2314
},
2415
"action": {
@@ -40,9 +31,7 @@
4031
"id": "github-notifier-pro@euxx.dev",
4132
"strict_min_version": "112.0",
4233
"data_collection_permissions": {
43-
"required": [
44-
"none"
45-
],
34+
"required": ["none"],
4635
"optional": []
4736
}
4837
}

manifest.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@
44
"version": "1.0.5",
55
"description": "GitHub notifications in the browser toolbar",
66
"minimum_chrome_version": "99",
7-
"permissions": [
8-
"alarms",
9-
"storage",
10-
"notifications"
11-
],
12-
"host_permissions": [
13-
"https://api.github.com/*",
14-
"https://github.com/*"
15-
],
7+
"permissions": ["alarms", "storage", "notifications"],
8+
"host_permissions": ["https://api.github.com/*", "https://github.com/*"],
169
"content_security_policy": {
1710
"extension_pages": "script-src 'self'; object-src 'self'"
1811
},

package.json

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
{
22
"name": "github-notifier-pro",
33
"version": "1.0.5",
4-
"type": "module",
54
"description": "GitHub notifications in the browser toolbar",
5+
"keywords": [
6+
"chrome-extension",
7+
"github",
8+
"notifications",
9+
"webextension"
10+
],
11+
"license": "MIT",
12+
"author": "euxx",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/euxx/github-notifier-pro"
16+
},
17+
"type": "module",
618
"scripts": {
719
"ci": "npm run test && npm run lint && npm run format",
820
"dev": "npm run ci && npm run dev:firefox",
@@ -15,39 +27,20 @@
1527
"format:check": "oxfmt --check .",
1628
"prepare": "husky"
1729
},
18-
"lint-staged": {
19-
"*.js": [
20-
"eslint --fix",
21-
"prettier --write"
22-
],
23-
"*.{html,css}": [
24-
"prettier --write"
25-
],
26-
"*.md": [
27-
"prettier --write --prose-wrap preserve"
28-
],
29-
"*.{yml,yaml}": [
30-
"prettier --write"
31-
]
32-
},
33-
"keywords": [
34-
"github",
35-
"notifications",
36-
"chrome-extension",
37-
"webextension"
38-
],
39-
"author": "euxx",
40-
"license": "MIT",
41-
"repository": {
42-
"type": "git",
43-
"url": "https://github.com/euxx/github-notifier-pro"
44-
},
4530
"devDependencies": {
4631
"husky": "latest",
4732
"jsdom": "latest",
4833
"lint-staged": "latest",
4934
"oxfmt": "^0.42.0",
5035
"oxlint": "^1.57.0",
5136
"vitest": "latest"
37+
},
38+
"lint-staged": {
39+
"*.{js,html,css,md,yml,yaml,json}": [
40+
"oxfmt --write"
41+
],
42+
"*.js": [
43+
"oxlint"
44+
]
5245
}
5346
}

src/auth/device-flow.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ <h1>Authorize GitHub Notifier Pro</h1>
3030
<button class="btn-primary" id="open-github-btn">Open GitHub Authorization Page</button>
3131

3232
<div class="auth-note">
33-
<strong>💡 Tip:</strong> After entering the code, you may need to click <strong>"Request"</strong> for each
34-
organization you want notifications from.
33+
<strong>💡 Tip:</strong> After entering the code, you may need to click
34+
<strong>"Request"</strong> for each organization you want notifications from.
3535
</div>
3636

3737
<div class="status" id="status">

src/auth/device-flow.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
* Device Flow authorization page script
33
*/
44

5-
import * as storage from '../lib/storage.js';
6-
import github from '../lib/github-api.js';
7-
import { initTheme } from '../lib/theme.js';
8-
import { runtime } from '../lib/chrome-api.js';
9-
import { ANIMATION_DURATION, MESSAGE_TYPES } from '../lib/constants.js';
10-
11-
const deviceCodeEl = document.getElementById('device-code');
12-
const copyBtn = document.getElementById('copy-btn');
13-
const openGithubBtn = document.getElementById('open-github-btn');
14-
const statusEl = document.getElementById('status');
15-
const statusTextEl = document.getElementById('status-text');
16-
const countdownEl = document.getElementById('countdown');
17-
18-
let verificationUri = '';
5+
import * as storage from "../lib/storage.js";
6+
import github from "../lib/github-api.js";
7+
import { initTheme } from "../lib/theme.js";
8+
import { runtime } from "../lib/chrome-api.js";
9+
import { ANIMATION_DURATION, MESSAGE_TYPES } from "../lib/constants.js";
10+
11+
const deviceCodeEl = document.getElementById("device-code");
12+
const copyBtn = document.getElementById("copy-btn");
13+
const openGithubBtn = document.getElementById("open-github-btn");
14+
const statusEl = document.getElementById("status");
15+
const statusTextEl = document.getElementById("status-text");
16+
const countdownEl = document.getElementById("countdown");
17+
18+
let verificationUri = "";
1919
let countdownInterval = null;
2020

2121
// Initialize theme
@@ -39,21 +39,21 @@ async function startDeviceFlow() {
3939
navigator.clipboard
4040
.writeText(data.user_code)
4141
.then(() => {
42-
copyBtn.textContent = '✓ Copied!';
42+
copyBtn.textContent = "✓ Copied!";
4343

4444
// Wait before opening GitHub (let user see the "Copied!" message)
4545
setTimeout(() => {
46-
window.open(verificationUri, '_blank');
46+
window.open(verificationUri, "_blank");
4747
}, ANIMATION_DURATION.GITHUB_OPEN_DELAY);
4848

4949
setTimeout(() => {
50-
copyBtn.textContent = 'Copy Code';
50+
copyBtn.textContent = "Copy Code";
5151
}, ANIMATION_DURATION.COPY_FEEDBACK);
5252
})
5353
.catch((err) => {
54-
console.error('Failed to auto-copy code:', err);
54+
console.error("Failed to auto-copy code:", err);
5555
// Still open GitHub even if copy fails
56-
window.open(verificationUri, '_blank');
56+
window.open(verificationUri, "_blank");
5757
});
5858

5959
// Start countdown
@@ -68,7 +68,7 @@ async function startDeviceFlow() {
6868
remaining--;
6969
const minutes = Math.floor(remaining / 60);
7070
const seconds = remaining % 60;
71-
countdownEl.textContent = `Expires in ${minutes}:${seconds.toString().padStart(2, '0')}`;
71+
countdownEl.textContent = `Expires in ${minutes}:${seconds.toString().padStart(2, "0")}`;
7272
}, ANIMATION_DURATION.COUNTDOWN_INTERVAL);
7373
},
7474
onProgress: (progress) => {
@@ -90,61 +90,61 @@ async function startDeviceFlow() {
9090
try {
9191
const response = await runtime.sendMessage({
9292
action: MESSAGE_TYPES.LOGIN,
93-
authMethod: 'oauth',
93+
authMethod: "oauth",
9494
token,
9595
});
9696

9797
if (!response.success) {
98-
throw new Error(response.error || 'Failed to notify background worker');
98+
throw new Error(response.error || "Failed to notify background worker");
9999
}
100100
} catch (error) {
101-
console.error('Failed to notify background worker:', error);
101+
console.error("Failed to notify background worker:", error);
102102
// Fall back to storage-only approach
103103
await storage.setToken(token);
104104
await storage.setUsername(username);
105-
await storage.setAuthMethod('oauth');
105+
await storage.setAuthMethod("oauth");
106106
}
107107

108108
// Notify user
109-
statusEl.className = 'status success';
109+
statusEl.className = "status success";
110110
statusTextEl.textContent = `✅ Successfully authorized as ${username}!`;
111-
countdownEl.textContent = 'Closing in 2 seconds...';
111+
countdownEl.textContent = "Closing in 2 seconds...";
112112

113113
// Close window and redirect to popup
114114
setTimeout(() => {
115115
window.close();
116116
// If window.close() doesn't work (some browsers block it), redirect
117117
if (!window.closed) {
118-
window.location.href = runtime.getURL('src/popup/popup.html');
118+
window.location.href = runtime.getURL("src/popup/popup.html");
119119
}
120120
}, ANIMATION_DURATION.AUTO_CLOSE);
121121
} catch (error) {
122122
if (countdownInterval) {
123123
clearInterval(countdownInterval);
124124
countdownInterval = null;
125125
}
126-
console.error('Device Flow error:', error);
127-
statusEl.className = 'status error';
126+
console.error("Device Flow error:", error);
127+
statusEl.className = "status error";
128128
statusTextEl.textContent = `❌ Error: ${error.message}`;
129-
countdownEl.textContent = '';
129+
countdownEl.textContent = "";
130130
}
131131
}
132132

133133
// Copy device code
134-
copyBtn.addEventListener('click', async () => {
134+
copyBtn.addEventListener("click", async () => {
135135
const code = deviceCodeEl.textContent;
136136
try {
137137
await navigator.clipboard.writeText(code);
138-
copyBtn.textContent = '✓ Copied!';
138+
copyBtn.textContent = "✓ Copied!";
139139
setTimeout(() => {
140-
copyBtn.textContent = 'Copy Code';
140+
copyBtn.textContent = "Copy Code";
141141
}, ANIMATION_DURATION.AUTO_CLOSE);
142142
} catch (err) {
143-
console.error('Failed to copy:', err);
143+
console.error("Failed to copy:", err);
144144
}
145145
});
146146

147147
// Open GitHub
148-
openGithubBtn.addEventListener('click', () => {
149-
window.open(verificationUri, '_blank');
148+
openGithubBtn.addEventListener("click", () => {
149+
window.open(verificationUri, "_blank");
150150
});

0 commit comments

Comments
 (0)