Skip to content

Commit

Permalink
test: update configtest to use flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
susisu committed Mar 17, 2024
1 parent d3e6efc commit 66fcf70
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 18 deletions.
File renamed without changes.
5 changes: 5 additions & 0 deletions configtest/classic/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/classic/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/classic/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/**/*"]
}
9 changes: 0 additions & 9 deletions configtest/javascript/.eslintrc.cjs

This file was deleted.

10 changes: 10 additions & 0 deletions configtest/javascript/eslint.config.js
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({}, [
{
languageOptions: {
globals: { ...globals.node },
},
},
]);
10 changes: 10 additions & 0 deletions configtest/typescript-react/eslint.config.js
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({ react: true }, [
{
languageOptions: {
globals: { ...globals.node },
},
},
]);
9 changes: 0 additions & 9 deletions configtest/typescript/.eslintrc.cjs

This file was deleted.

10 changes: 10 additions & 0 deletions configtest/typescript/eslint.config.js
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({}, [
{
languageOptions: {
globals: { ...globals.node },
},
},
]);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"configtest:javascript": "./configtest/javascript/run.sh",
"configtest:typescript": "./configtest/typescript/run.sh",
"configtest:typescript-react": "./configtest/typescript-react/run.sh",
"configtest:classic": "./configtest/classic/run.sh",
"prepublishOnly": "run-s format:check lint:check typecheck build configtest"
},
"dependencies": {
Expand Down

0 comments on commit 66fcf70

Please sign in to comment.