Skip to content

Commit

Permalink
fix: 🚨 linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecBlance committed Oct 12, 2024
1 parent 4b2ca35 commit fce2d7a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
25 changes: 13 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ['dist'] },
{ ignores: ["dist", "src/components/ui"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
"@typescript-eslint/no-explicit-any": "off",
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
)
);
12 changes: 6 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Separator } from "@/components/ui/separator";
import { Tabs, TabsList } from "@/components/ui/tabs";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { IBucketType, ILastSeen } from "./types";
import TabButton from "@/components/TabButton";
import TabBuckets from "@/components/TabBuckets";
Expand All @@ -18,27 +18,27 @@ function App() {
const { buckets, setBuckets } = useBuckets((state) => state);
const types = ["good", "bad", "error"];

const filterBuckets = async () => {
const filterBuckets = useCallback(async () => {
const { buckets } = (await chrome.storage.local.get("buckets")) as {
buckets: IBucketType;
};
setBuckets(buckets);
};
}, [setBuckets]);

const lastSeen = async () => {
const lastSeen = useCallback(async () => {
const { lastSeen } = await chrome.storage.local.get("lastSeen");
const updatedLastSeen = { ...lastSeen, good: new Date().getTime() };
chrome.storage.local.set({
lastSeen: updatedLastSeen,
});
setLastSeen(updatedLastSeen);
setCurrentLastSeen(lastSeen);
};
}, [setLastSeen]);

useEffect(() => {
filterBuckets();
lastSeen();
}, []);
}, [filterBuckets, lastSeen]);

return (
<Tabs defaultValue="good" className="w-full">
Expand Down
12 changes: 5 additions & 7 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ const recordBuckets = (
);
if (!s3) return;
getBuckets().then((buckets) => {
let { hostname, pathname } = new URL(response.url);
const url = new URL(response.url);
let hostname = url.hostname;
const pathname = url.pathname;
if (hostname === "s3.amazonaws.com") {
hostname += "/" + pathname.split("/")[1];
}
Expand All @@ -118,7 +120,7 @@ const recordBuckets = (
const noFavicon = !hostname.includes("favicon.ico");
if (!isPresent && noFavicon) {
getBucketInfo(hostname, buckets).then((permissions) => {
permissions && permissions.type === "good" && addNumber(buckets);
if (permissions && permissions.type === "good") addNumber(buckets);
});
}
});
Expand All @@ -144,11 +146,7 @@ const listener = async () => {
* @param _sender the sender of the message
* @param sendResponse the response to send back
*/
const fromPopup = (
toRecord: boolean,
_sender: chrome.runtime.MessageSender,
_sendResponse: (response?: any) => void,
) => {
const fromPopup = (toRecord: boolean) => {
if (toRecord) {
listener();
chrome.action.setBadgeText({
Expand Down
3 changes: 2 additions & 1 deletion src/components/CustomSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ const CustomSwitch = () => {
const { record } = (await chrome.storage.local.get("record")) as {
record: boolean;
};
record &&
if (record) {
chrome.action.setBadgeText({
text: "",
});
}
setChecked(record);
setIsDoneChecking(true);
};
Expand Down

0 comments on commit fce2d7a

Please sign in to comment.