Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
printfn committed Dec 6, 2024
1 parent 6c81cec commit 50b517b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions web/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ const reactHooksPlugin = reactHooks;
const reactHooksRules = reactHooks.configs.recommended.rules;

export default tseslint.config(
{ ignores: ['dist'] },
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
reactRefresh.configs.vite,
{ ignores: ['dist', 'cloudflare', 'eslint.config.js'] },
{
extends: [js.configs.recommended, ...tseslint.configs.strictTypeChecked],
files: ['**/*.{ts,tsx}'],
},
{
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
projectService: true,
Expand All @@ -26,11 +29,10 @@ export default tseslint.config(
},
plugins: {
'react-hooks': reactHooksPlugin,
'react-refresh': reactRefresh,
},
rules: {
...reactHooksRules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/promise-function-async': 'error',
},
},
);
6 changes: 3 additions & 3 deletions web/src/components/PendingOutput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState, type Ref } from 'react';
import { startTransition, useEffect, useState, type Ref } from 'react';
import { ThreeDotsScale } from 'react-svg-spinners';
import { fend } from '../lib/fend';

Expand All @@ -12,14 +12,14 @@ type Props = {
export default function PendingOutput({ ref, currentInput, variables, isPending }: Props) {
const [hint, setHint] = useState('');
useEffect(() => {
void (async () => {
startTransition(async () => {
const result = await fend(currentInput, 100, variables);
if (!result.ok) {
setHint('');
} else {
setHint(result.result);
}
})();
});
}, [currentInput, variables]);

return (
Expand Down
4 changes: 2 additions & 2 deletions web/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

Expand Down

0 comments on commit 50b517b

Please sign in to comment.