commit
399f66d5f2
17 changed files with 2371 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||||
|
# Logs |
||||
|
logs |
||||
|
*.log |
||||
|
npm-debug.log* |
||||
|
yarn-debug.log* |
||||
|
yarn-error.log* |
||||
|
pnpm-debug.log* |
||||
|
lerna-debug.log* |
||||
|
|
||||
|
node_modules |
||||
|
dist |
||||
|
dist-ssr |
||||
|
*.local |
||||
|
|
||||
|
# Editor directories and files |
||||
|
.vscode/* |
||||
|
!.vscode/extensions.json |
||||
|
.idea |
||||
|
.DS_Store |
||||
|
*.suo |
||||
|
*.ntvs* |
||||
|
*.njsproj |
||||
|
*.sln |
||||
|
*.sw? |
@ -0,0 +1,50 @@ |
|||||
|
# React + TypeScript + Vite |
||||
|
|
||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
||||
|
|
||||
|
Currently, two official plugins are available: |
||||
|
|
||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh |
||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
||||
|
|
||||
|
## Expanding the ESLint configuration |
||||
|
|
||||
|
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: |
||||
|
|
||||
|
- Configure the top-level `parserOptions` property like this: |
||||
|
|
||||
|
```js |
||||
|
export default tseslint.config({ |
||||
|
languageOptions: { |
||||
|
// other options... |
||||
|
parserOptions: { |
||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'], |
||||
|
tsconfigRootDir: import.meta.dirname, |
||||
|
}, |
||||
|
}, |
||||
|
}) |
||||
|
``` |
||||
|
|
||||
|
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` |
||||
|
- Optionally add `...tseslint.configs.stylisticTypeChecked` |
||||
|
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: |
||||
|
|
||||
|
```js |
||||
|
// eslint.config.js |
||||
|
import react from 'eslint-plugin-react' |
||||
|
|
||||
|
export default tseslint.config({ |
||||
|
// Set the react version |
||||
|
settings: { react: { version: '18.3' } }, |
||||
|
plugins: { |
||||
|
// Add the react plugin |
||||
|
react, |
||||
|
}, |
||||
|
rules: { |
||||
|
// other rules... |
||||
|
// Enable its recommended rules |
||||
|
...react.configs.recommended.rules, |
||||
|
...react.configs['jsx-runtime'].rules, |
||||
|
}, |
||||
|
}) |
||||
|
``` |
@ -0,0 +1,28 @@ |
|||||
|
import js from '@eslint/js' |
||||
|
import globals from 'globals' |
||||
|
import reactHooks from 'eslint-plugin-react-hooks' |
||||
|
import reactRefresh from 'eslint-plugin-react-refresh' |
||||
|
import tseslint from 'typescript-eslint' |
||||
|
|
||||
|
export default tseslint.config( |
||||
|
{ ignores: ['dist'] }, |
||||
|
{ |
||||
|
extends: [js.configs.recommended, ...tseslint.configs.recommended], |
||||
|
files: ['**/*.{ts,tsx}'], |
||||
|
languageOptions: { |
||||
|
ecmaVersion: 2020, |
||||
|
globals: globals.browser, |
||||
|
}, |
||||
|
plugins: { |
||||
|
'react-hooks': reactHooks, |
||||
|
'react-refresh': reactRefresh, |
||||
|
}, |
||||
|
rules: { |
||||
|
...reactHooks.configs.recommended.rules, |
||||
|
'react-refresh/only-export-components': [ |
||||
|
'warn', |
||||
|
{ allowConstantExport: true }, |
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
) |
@ -0,0 +1,13 @@ |
|||||
|
<!doctype html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8" /> |
||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
|
<title>Vite + React + TS</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="root"></div> |
||||
|
<script type="module" src="/src/main.tsx"></script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,33 @@ |
|||||
|
{ |
||||
|
"name": "my-react-app", |
||||
|
"private": true, |
||||
|
"version": "0.0.0", |
||||
|
"type": "module", |
||||
|
"scripts": { |
||||
|
"dev": "vite", |
||||
|
"build": "tsc -b && vite build", |
||||
|
"lint": "eslint .", |
||||
|
"preview": "vite preview" |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"@blueprintjs/core": "^5.14.2", |
||||
|
"@blueprintjs/icons": "^5.14.0", |
||||
|
"icons": "link:@blueprintjs\\icons", |
||||
|
"normalize.css": "^8.0.1", |
||||
|
"react": "^18.3.1", |
||||
|
"react-dom": "^18.3.1" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"@eslint/js": "^9.13.0", |
||||
|
"@types/react": "^18.3.12", |
||||
|
"@types/react-dom": "^18.3.1", |
||||
|
"@vitejs/plugin-react-swc": "^3.5.0", |
||||
|
"eslint": "^9.13.0", |
||||
|
"eslint-plugin-react-hooks": "^5.0.0", |
||||
|
"eslint-plugin-react-refresh": "^0.4.14", |
||||
|
"globals": "^15.11.0", |
||||
|
"typescript": "~5.6.2", |
||||
|
"typescript-eslint": "^8.11.0", |
||||
|
"vite": "^5.4.10" |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,42 @@ |
|||||
|
#root { |
||||
|
max-width: 1280px; |
||||
|
margin: 0 auto; |
||||
|
padding: 2rem; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.logo { |
||||
|
height: 6em; |
||||
|
padding: 1.5em; |
||||
|
will-change: filter; |
||||
|
transition: filter 300ms; |
||||
|
} |
||||
|
.logo:hover { |
||||
|
filter: drop-shadow(0 0 2em #646cffaa); |
||||
|
} |
||||
|
.logo.react:hover { |
||||
|
filter: drop-shadow(0 0 2em #61dafbaa); |
||||
|
} |
||||
|
|
||||
|
@keyframes logo-spin { |
||||
|
from { |
||||
|
transform: rotate(0deg); |
||||
|
} |
||||
|
to { |
||||
|
transform: rotate(360deg); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@media (prefers-reduced-motion: no-preference) { |
||||
|
a:nth-of-type(2) .logo { |
||||
|
animation: logo-spin infinite 20s linear; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.card { |
||||
|
padding: 2em; |
||||
|
} |
||||
|
|
||||
|
.read-the-docs { |
||||
|
color: #888; |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
import { useState } from 'react' |
||||
|
import { Button, ButtonGroup, AnchorButton } from "@blueprintjs/core"; |
||||
|
|
||||
|
function App() { |
||||
|
const [count, setCount] = useState(0) |
||||
|
|
||||
|
return ( |
||||
|
<> |
||||
|
<div className="card"> |
||||
|
<Button onClick={() => setCount((count) => count + 1)}> |
||||
|
count is {count} |
||||
|
</Button> |
||||
|
<ButtonGroup> |
||||
|
<Button icon="database">Queries</Button> |
||||
|
<Button icon="function">Functions</Button> |
||||
|
<AnchorButton rightIcon="caret-down">Options</AnchorButton> |
||||
|
</ButtonGroup> |
||||
|
</div> |
||||
|
</> |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
export default App |
After Width: | Height: | Size: 4.0 KiB |
@ -0,0 +1,3 @@ |
|||||
|
@import "normalize.css"; |
||||
|
@import "@blueprintjs/core/lib/css/blueprint.css"; |
||||
|
@import "@blueprintjs/icons/lib/css/blueprint-icons.css"; |
@ -0,0 +1,10 @@ |
|||||
|
import { StrictMode } from 'react' |
||||
|
import { createRoot } from 'react-dom/client' |
||||
|
import './index.css' |
||||
|
import App from './App.tsx' |
||||
|
|
||||
|
createRoot(document.getElementById('root')!).render( |
||||
|
<StrictMode> |
||||
|
<App /> |
||||
|
</StrictMode>, |
||||
|
) |
@ -0,0 +1 @@ |
|||||
|
/// <reference types="vite/client" />
|
@ -0,0 +1,26 @@ |
|||||
|
{ |
||||
|
"compilerOptions": { |
||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", |
||||
|
"target": "ES2020", |
||||
|
"useDefineForClassFields": true, |
||||
|
"lib": ["ES2020", "DOM", "DOM.Iterable"], |
||||
|
"module": "ESNext", |
||||
|
"skipLibCheck": true, |
||||
|
|
||||
|
/* Bundler mode */ |
||||
|
"moduleResolution": "Bundler", |
||||
|
"allowImportingTsExtensions": true, |
||||
|
"isolatedModules": true, |
||||
|
"moduleDetection": "force", |
||||
|
"noEmit": true, |
||||
|
"jsx": "react-jsx", |
||||
|
|
||||
|
/* Linting */ |
||||
|
"strict": true, |
||||
|
"noUnusedLocals": true, |
||||
|
"noUnusedParameters": true, |
||||
|
"noFallthroughCasesInSwitch": true, |
||||
|
"noUncheckedSideEffectImports": true |
||||
|
}, |
||||
|
"include": ["src"] |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"files": [], |
||||
|
"references": [ |
||||
|
{ "path": "./tsconfig.app.json" }, |
||||
|
{ "path": "./tsconfig.node.json" } |
||||
|
] |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
{ |
||||
|
"compilerOptions": { |
||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", |
||||
|
"target": "ES2022", |
||||
|
"lib": ["ES2023"], |
||||
|
"module": "ESNext", |
||||
|
"skipLibCheck": true, |
||||
|
|
||||
|
/* Bundler mode */ |
||||
|
"moduleResolution": "Bundler", |
||||
|
"allowImportingTsExtensions": true, |
||||
|
"isolatedModules": true, |
||||
|
"moduleDetection": "force", |
||||
|
"noEmit": true, |
||||
|
|
||||
|
/* Linting */ |
||||
|
"strict": true, |
||||
|
"noUnusedLocals": true, |
||||
|
"noUnusedParameters": true, |
||||
|
"noFallthroughCasesInSwitch": true, |
||||
|
"noUncheckedSideEffectImports": true |
||||
|
}, |
||||
|
"include": ["vite.config.ts"] |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
import { defineConfig } from 'vite' |
||||
|
import react from '@vitejs/plugin-react-swc' |
||||
|
|
||||
|
// https://vite.dev/config/
|
||||
|
export default defineConfig({ |
||||
|
plugins: [react()], |
||||
|
}) |
Loading…
Reference in new issue