Skip to content

Commit 4f9bb18

Browse files
Refactor shadow-dom example
1 parent a07b15e commit 4f9bb18

File tree

14 files changed

+70
-110
lines changed

14 files changed

+70
-110
lines changed

examples/react/basic/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"@types/react": "^18.2.79",
2222
"@types/react-dom": "^18.2.25",
2323
"@vitejs/plugin-react": "^4.3.1",
24-
"eslint": "^8.57.0",
2524
"typescript": "5.3.3",
2625
"vite": "^5.3.5"
2726
}

examples/react/shadow-dom/.eslintrc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { tanstackConfig } from '@tanstack/config/eslint'
2+
import pluginQuery from '@tanstack/eslint-plugin-query'
3+
import pluginReact from '@eslint-react/eslint-plugin'
4+
import pluginReactHooks from 'eslint-plugin-react-hooks'
5+
6+
export default [
7+
...tanstackConfig,
8+
...pluginQuery.configs['flat/recommended'],
9+
pluginReact.configs.recommended,
10+
{
11+
plugins: {
12+
'react-hooks': pluginReactHooks,
13+
},
14+
rules: {
15+
'react-hooks/exhaustive-deps': 'error',
16+
'react-hooks/rules-of-hooks': 'error',
17+
},
18+
},
19+
]

examples/react/shadow-dom/package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"type": "module",
55
"scripts": {
66
"dev": "vite",
7-
"build": "tsc && vite build",
8-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
9-
"preview": "vite preview"
7+
"build": "vite build",
8+
"preview": "vite preview",
9+
"test:types": "tsc"
1010
},
1111
"dependencies": {
1212
"@tanstack/react-query": "^5.52.3",
@@ -17,12 +17,7 @@
1717
"devDependencies": {
1818
"@types/react": "npm:types-react@rc",
1919
"@types/react-dom": "npm:types-react-dom@rc",
20-
"@typescript-eslint/eslint-plugin": "^7.17.0",
21-
"@typescript-eslint/parser": "^7.17.0",
2220
"@vitejs/plugin-react": "^4.3.1",
23-
"eslint": "^8.57.0",
24-
"eslint-plugin-react-hooks": "^5.1.0-rc-a19a8ab4-20240829",
25-
"eslint-plugin-react-refresh": "^0.4.9",
2621
"typescript": "5.3.3",
2722
"vite": "^5.3.5"
2823
}

examples/react/shadow-dom/src/DogList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query'
22

33
type DogsResp = {
44
message: {
5-
[dog: string]: string[]
5+
[dog: string]: Array<string>
66
}
77
}
88

@@ -22,7 +22,7 @@ export const DogList = () => {
2222

2323
if (status === 'error') return 'Error!'
2424

25-
const dogs = Object.keys(data?.message)
25+
const dogs = Object.keys(data.message)
2626

2727
return (
2828
<div>

examples/react/shadow-dom/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@
2020
"noUnusedParameters": true,
2121
"noFallthroughCasesInSwitch": true
2222
},
23-
"include": ["src"],
24-
"references": [{ "path": "./tsconfig.node.json" }]
23+
"include": ["src", "eslint.config.js"]
2524
}

examples/react/shadow-dom/tsconfig.node.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/svelte/simple/tsconfig.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"checkJs": true,
1616
"isolatedModules": true
1717
},
18-
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
19-
"references": [{ "path": "./tsconfig.node.json" }]
18+
"include": [
19+
"src/**/*.d.ts",
20+
"src/**/*.ts",
21+
"src/**/*.js",
22+
"src/**/*.svelte",
23+
"vite.config.ts"
24+
]
2025
}

examples/svelte/simple/tsconfig.node.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/vue/basic/tsconfig.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
{
22
"compilerOptions": {
3-
"target": "esnext",
4-
"module": "esnext",
5-
"moduleResolution": "node",
6-
"strict": true,
7-
"jsx": "preserve",
8-
"sourceMap": true,
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "Bundler",
11+
"allowImportingTsExtensions": true,
912
"resolveJsonModule": true,
10-
"esModuleInterop": true,
11-
"lib": ["esnext", "dom"],
12-
"types": ["vite/client"]
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
"jsx": "preserve",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
1322
},
1423
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"]
1524
}

0 commit comments

Comments
 (0)