Skip to content

Commit 753769c

Browse files
committed
refactor: update eslint config
1 parent 437bfb7 commit 753769c

File tree

16 files changed

+323
-14
lines changed

16 files changed

+323
-14
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = defineConfig({
66
extends: [
77
"with-tsconfig",
88
"plugin:react-hooks/recommended",
9-
"plugin:@eslint-react/recommended-legacy",
9+
"plugin:@eslint-react/all-legacy",
1010
],
1111
rules: {
1212
"no-console": [
@@ -20,7 +20,6 @@ module.exports = defineConfig({
2020
},
2121
],
2222
"sonarjs/no-duplicate-string": "warn",
23-
"react/no-unused-prop-types": "off",
2423
"@typescript-eslint/no-redeclare": "off",
2524
"@typescript-eslint/explicit-module-boundary-types": "off",
2625
"tailwindcss/no-custom-classname": "off",

src/app.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { mantineTheme } from "@/theme/mantine.config";
88

99
import * as css from "./app.css";
1010

11-
const Main = lazy(() => import("./pages/Main/Main"));
12-
const About = lazy(() => import("./pages/About/About"));
13-
const Preferences = lazy(() => import("./pages/Preferences/Preferences"));
11+
const Main = lazy(() => import("./pages/main/main"));
12+
const About = lazy(() => import("./pages/about/about"));
13+
const Preferences = lazy(() => import("./pages/preferences/preferences"));
1414

15-
export const App = React.memo(() => {
15+
export const App = React.memo(function App() {
1616
const preferredColorScheme = useColorScheme();
1717

1818
const theme = useMemo(() => ({ ...mantineTheme, colorScheme: preferredColorScheme }), [preferredColorScheme]);

src/components/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type ButtonProps =
88
onClick?: () => void;
99
};
1010

11-
export const Button = React.memo(({ children, ...rest }: ButtonProps) => {
11+
export const Button = React.memo(function Button({ children, ...rest }: ButtonProps) {
1212
return (
1313
<MTButton
1414
style={{

src/components/Title/Title.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type TitleProps = {
66
children?: React.ReactNode;
77
};
88

9-
export const Title = React.memo(({ children, ...rest }: TitleProps) => {
9+
export const Title = React.memo(function Title({ children, ...rest }: TitleProps) {
1010
return (
1111
<div className={css.title} {...rest}>
1212
{children}

src/components/button/button.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Button as MTButton, type ButtonProps as MTButtonProps } from "@mantine/core";
2+
import React from "react";
3+
4+
type ButtonProps =
5+
& MTButtonProps
6+
& React.PropsWithChildren
7+
& {
8+
onClick?: () => void;
9+
};
10+
11+
export const Button = React.memo(function Button({ children, ...rest }: ButtonProps) {
12+
return (
13+
<MTButton
14+
style={{
15+
transition: "all 120ms ease-out",
16+
}}
17+
gradient={{ deg: 35, from: "#ed6ea0", to: "#ec8c69" }}
18+
size="compact-xs"
19+
variant="gradient"
20+
{...rest}
21+
>
22+
{children}
23+
</MTButton>
24+
);
25+
});

src/components/title/styles.css.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { style } from "@vanilla-extract/css";
2+
3+
export const title = style({
4+
margin: "0",
5+
padding: "0",
6+
color: "rgb(18, 18, 18)",
7+
fontWeight: "500",
8+
fontSize: "15px",
9+
10+
"@media": {
11+
"(prefers-color-scheme: dark)": {
12+
color: "rgb(240, 240, 240)",
13+
},
14+
},
15+
});

src/components/title/title.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from "react";
2+
3+
import * as css from "./styles.css";
4+
5+
type TitleProps = {
6+
children?: React.ReactNode;
7+
};
8+
9+
export const Title = React.memo(function Title({ children, ...rest }: TitleProps) {
10+
return (
11+
<div className={css.title} {...rest}>
12+
{children}
13+
</div>
14+
);
15+
});

src/pages/About/About.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { suspend } from "suspend-react";
55

66
import * as css from "./styles.css";
77

8-
const About = React.memo(() => {
8+
const About = React.memo(function App() {
99
const name = suspend(getName);
1010
const version = suspend(getVersion);
1111

src/pages/Main/Main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { useAtom, useSetAtom } from "jotai";
55
import React from "react";
66

77
import { accEnabledAtom, loadDefaultConfig, senAtom, setAccEnabledAtom, setSenAtom } from "@/atoms";
8-
import { Button } from "@/components/Button/Button";
9-
import { Title } from "@/components/Title/Title";
8+
import { Button } from "@/components/button/button";
9+
import { Title } from "@/components/title/title";
1010
import { useTranslation } from "@/hooks/useTranslation";
1111

1212
import * as css from "./styles.css";
@@ -31,7 +31,7 @@ const handleOpenPreferences = async () => {
3131
console.error("Failed to get preferences window");
3232
};
3333

34-
const Main = React.memo(() => {
34+
const Main = React.memo(function Main() {
3535
const T = useTranslation();
3636

3737
const [sen] = useAtom(senAtom);

src/pages/Preferences/Preferences.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useAtom, useSetAtom } from "jotai";
33
import React from "react";
44

55
import { launchAtLoginAtom, localeAtom } from "@/atoms";
6-
import { Title } from "@/components/Title/Title";
6+
import { Title } from "@/components/title/title";
77
import { useTranslation } from "@/hooks/useTranslation";
88
import { type Locales } from "@/i18n/i18n-types";
99
import { isLocale } from "@/i18n/i18n-util";
@@ -31,7 +31,7 @@ const languages: { label: string; value: Locales }[] = [
3131
{ label: "繁體中文", value: "zh-TW" },
3232
];
3333

34-
const Preferences = React.memo(() => {
34+
const Preferences = React.memo(function Preferences() {
3535
const T = useTranslation();
3636

3737
const [locale, setLocale] = useAtom(localeAtom);

0 commit comments

Comments
 (0)