Skip to content

Commit

Permalink
Next.js 向けの設定のテストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
susisu committed Oct 6, 2024
1 parent acf6da7 commit 29ca816
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions configtest/next/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import config from '@hatena/eslint-config-hatena/flat';
import globals from 'globals';

export default config({ next: true }, [
{
languageOptions: {
globals: { ...globals.node },
},
},
]);
5 changes: 5 additions & 0 deletions configtest/next/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

cd $(dirname "$0")
set -eux
eslint --max-warnings 0 src
18 changes: 18 additions & 0 deletions configtest/next/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export async function foo(): Promise<number> {
const x = await Promise.resolve(42);
return x;
}

// eslint-disable-next-line @typescript-eslint/no-floating-promises
foo();
foo().catch((err) => {
const msg = err.toString();
// eslint-disable-next-line no-console
console.error(msg);
});

import React from 'react';

export const Foo: React.FC = () => {
return <h1>Hello</h1>;
};
9 changes: 9 additions & 0 deletions configtest/next/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"strict": true,
"lib": ["esnext", "dom"],
"esModuleInterop": true,
"jsx": "react"
},
"include": ["src/**/*"]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"configtest:javascript": "./configtest/javascript/run.sh",
"configtest:typescript": "./configtest/typescript/run.sh",
"configtest:typescript-react": "./configtest/typescript-react/run.sh",
"configtest:next": "./configtest/next/run.sh",
"configtest:classic": "./configtest/classic/run.sh",
"prepublishOnly": "run-s format:check lint:check typecheck configtest"
},
Expand Down

0 comments on commit 29ca816

Please sign in to comment.