From 126df77b1bcde109cf96a5617fef013b1c9569ba Mon Sep 17 00:00:00 2001 From: Yiqing Zhu <793831308@qq.com> Date: Wed, 7 Jun 2023 23:56:13 +1000 Subject: [PATCH] created react-ts using vite --- .eslintrc.cjs | 14 +++++++++ index.html | 13 +++++++++ package.json | 28 ++++++++++++++++++ public/vite.svg | 1 + src/App.css | 42 +++++++++++++++++++++++++++ src/App.tsx | 35 ++++++++++++++++++++++ src/assets/react.svg | 1 + src/index.css | 69 ++++++++++++++++++++++++++++++++++++++++++++ src/main.tsx | 10 +++++++ src/vite-env.d.ts | 1 + tsconfig.json | 25 ++++++++++++++++ tsconfig.node.json | 10 +++++++ vite.config.ts | 7 +++++ 13 files changed, 256 insertions(+) create mode 100644 .eslintrc.cjs create mode 100644 index.html create mode 100644 package.json create mode 100644 public/vite.svg create mode 100644 src/App.css create mode 100644 src/App.tsx create mode 100644 src/assets/react.svg create mode 100644 src/index.css create mode 100644 src/main.tsx create mode 100644 src/vite-env.d.ts create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..4020bcb --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,14 @@ +module.exports = { + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + parser: '@typescript-eslint/parser', + parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': 'warn', + }, +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..e0d1c84 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + +
+ + + +
+ Edit src/App.tsx
and save to test HMR
+
+ Click on the Vite and React logos to learn more +
+ > + ) +} + +export default App diff --git a/src/assets/react.svg b/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..2c3fac6 --- /dev/null +++ b/src/index.css @@ -0,0 +1,69 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..91c03f3 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.tsx' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( +