Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

feat: add type check #80

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Lint
run: nr style

- name: Type check
run: nr typecheck

- name: Build
run: nr build

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"prepare": "husky install",
"dev": "vite build --watch",
"build": "vite build",
"typecheck": "tsc --noEmit",
"style": "prettier --check \"src/**/*.{ts,tsx}\"",
"style:fix": "prettier --write \"src/**/*.{ts,tsx}\""
},
Expand Down
6 changes: 3 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ chrome.storage.local.get("types", (result) => {

const windowGroupMaps: { [key: number]: Map<string, number> } = {};

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
chrome.runtime.onMessage.addListener((message) => {
chrome.storage.local.get("types", (resultStorage) => {
if (resultStorage.types) {
types = resultStorage.types;
Expand Down Expand Up @@ -159,7 +159,7 @@ async function handleNewTab(tab: chrome.tabs.Tab) {
}

async function handleTabUpdate(
tabId: number,
_tabId: number,
changeInfo: chrome.tabs.TabChangeInfo,
tab: chrome.tabs.Tab
) {
Expand All @@ -185,7 +185,7 @@ async function handleTabUpdate(

chrome.tabs.onCreated.addListener(handleNewTab);
chrome.tabs.onUpdated.addListener(handleTabUpdate);
chrome.tabs.onDetached.addListener((tabId, detachInfo) => {
chrome.tabs.onDetached.addListener((_tabId, detachInfo) => {
const windowId = detachInfo.oldWindowId;
if (
windowGroupMaps.hasOwnProperty(windowId) &&
Expand Down
10 changes: 5 additions & 5 deletions src/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const Popup = () => {
};

const enableAutoPosition = () => {
setIsAutoPosition((isAutoGroupPosition) => {
setIsAutoPosition(() => {
setStorage("isAutoPosition", !isAutoPosition);
return !isAutoPosition;
});
Expand Down Expand Up @@ -139,8 +139,8 @@ const Popup = () => {

<button
disabled={!newType}
className="rounded-md w-fit bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline focus-visible:outline-2
className="rounded-md w-fit bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline focus-visible:outline-2
focus-visible:outline-offset-2 disabled:bg-primary/sm"
>
Add
Expand Down Expand Up @@ -177,7 +177,7 @@ const Popup = () => {
<div className="flex items-center gap-x-4">
<button
disabled={!openAIKey || !types || !types.length}
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline cursor-pointer
focus-visible:outline-2 focus-visible:outline-offset-2"
onClick={getAllTabsInfo}
Expand All @@ -187,7 +187,7 @@ const Popup = () => {
</button>

<button
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
className="inline-flex items-center rounded-md bg-primary/lg px-2.5 py-1.5 text-sm font-semibold
text-white shadow-sm hover:bg-primary focus-visible:outline cursor-pointer
focus-visible:outline-2 focus-visible:outline-offset-2"
onClick={ungroup}
Expand Down