Skip to content

Commit

Permalink
Merge pull request #485 from MH4GF/upgrade-eslint-9
Browse files Browse the repository at this point in the history
upgrade to eslint 9
  • Loading branch information
MH4GF authored Nov 4, 2024
2 parents 582d29d + ad77e39 commit 2dd0571
Show file tree
Hide file tree
Showing 9 changed files with 420 additions and 247 deletions.
2 changes: 1 addition & 1 deletion app/__vrt__/vrt.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// biome-ignore lint/correctness/noNodejsModules: テストファイルのため
import fs from "node:fs";

import AxeBuilder from "@axe-core/playwright";
import { AxeBuilder } from "@axe-core/playwright";
import type { Page, TestInfo } from "@playwright/test";
import { expect, test } from "@playwright/test";
import { createHtmlReport } from "axe-html-reporter";
Expand Down
2 changes: 1 addition & 1 deletion app/_components/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Command = forwardRef<
));
Command.displayName = CommandPrimitive.displayName;

interface CommandDialogProps extends DialogProps {}
type CommandDialogProps = DialogProps;

const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
return (
Expand Down
6 changes: 5 additions & 1 deletion app/_features/command/items/CommandLinkItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export function CommandLinkItem({ href, children, ...props }: Props) {
const router = useViewTransitionRouter();

const handleKeydown = useCallback(() => {
isSameOrigin(href) ? router.push(href) : window.open(href, "_blank");
if (isSameOrigin(href)) {
router.push(href);
} else {
window.open(href, "_blank");
}
close();
}, [router, href, close]);

Expand Down
2 changes: 1 addition & 1 deletion app/_features/markdownRenderer/elements/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const maybeSingleUrl = (_children: ReactNode): string | null => {
if (!(children.length === 1 && isValidElement(children[0]))) {
return null;
}
// @ts-expect-error ... FIXME
// @ts-expect-error ... FIXME
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const urlChildren = Children.toArray(children[0].props?.children ?? []);

Expand Down
1 change: 0 additions & 1 deletion app/_features/richLinkCard/__tests__/getOGP.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { setupServer } from "msw/node";
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";

Expand Down
4 changes: 3 additions & 1 deletion app/_features/viewTransition/isSameOrigin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const sameOriginPrefixes = [
"#", // 同一ページ内リンク
] as const;

const baseOrigin = new URL(`https://${process.env.VERCEL_URL}` || "http://localhost:3000").origin;
const baseOrigin = new URL(
process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "http://localhost:3000",
).origin;

type Href = LinkProps["href"];

Expand Down
31 changes: 31 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import mh4gf from "@mh4gf/eslint-config";
import eslintPluginNext from "@next/eslint-plugin-next";
import eslintPluginReact from "eslint-plugin-react";
import eslintPluginReactHooks from "eslint-plugin-react-hooks";

export default [
...mh4gf.configs.recommended,
...mh4gf.configs.typescript,
{
...eslintPluginReact.configs.flat.recommended,
...eslintPluginReact.configs.flat["jsx-runtime"],
plugins: {
"react-hooks": eslintPluginReactHooks,
"@next/next": eslintPluginNext,
},
rules: {
...eslintPluginReact.configs["jsx-runtime"].rules,
...eslintPluginReactHooks.configs.recommended.rules,
...eslintPluginNext.configs.recommended.rules,
...eslintPluginNext.configs["core-web-vitals"].rules,
"@next/next/no-img-element": "error",
},
},
{
languageOptions: {
parserOptions: {
project: "./tsconfig.json",
},
},
},
];
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@
"@markuplint/ml-config": "4.8.4",
"@markuplint/react-spec": "4.5.12",
"@mh4gf/configs": "0.3.0",
"@mh4gf/eslint-config": "0.5.2",
"@mh4gf/eslint-config": "0.6.1",
"@next/eslint-plugin-next": "15.0.2",
"@playwright/test": "1.48.2",
"@tsconfig/next": "2.0.3",
"@tsconfig/strictest": "2.0.5",
"@types/eslint__js": "8.42.3",
"@types/node": "20.17.6",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"@types/rss": "0.0.32",
"autoprefixer": "10.4.20",
"axe-html-reporter": "2.2.11",
"dependency-cruiser": "16.5.0",
"eslint": "8.57.1",
"eslint": "9.14.0",
"eslint-config-next": "15.0.2",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "5.0.0",
"lost-pixel": "3.21.0",
"markuplint": "4.11.2",
"msw": "2.6.0",
Expand Down
Loading

0 comments on commit 2dd0571

Please sign in to comment.