chore: configure & format

This commit is contained in:
Paul Pan 2023-07-16 19:33:43 +08:00
parent 2bc86ca7d7
commit e964fc8fff
9 changed files with 2830 additions and 126 deletions

View File

@ -1,27 +1,28 @@
/* eslint-env node */ /* eslint-env node */
module.exports = { module.exports = {
root: true, root: true,
env: { browser: true, es2020: true }, env: { browser: true, es2020: true },
extends: [ extends: [
'eslint:recommended', "eslint:recommended",
'plugin:@typescript-eslint/recommended', "plugin:@typescript-eslint/recommended",
'plugin:@typescript-eslint/recommended-requiring-type-checking', "plugin:@typescript-eslint/recommended-requiring-type-checking",
'plugin:react-hooks/recommended', "plugin:react-hooks/recommended",
], "prettier",
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
], ],
'@typescript-eslint/no-non-null-assertion': 'off', parser: "@typescript-eslint/parser",
}, parserOptions: {
} ecmaVersion: "latest",
sourceType: "module",
project: true,
tsconfigRootDir: __dirname,
},
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"@typescript-eslint/no-non-null-assertion": "off",
},
};

3
.gitignore vendored
View File

@ -22,3 +22,6 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
# Sentry Auth Token
.env.sentry-build-plugin

3
.prettierrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"tabWidth": 4
}

View File

@ -1,13 +1,13 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WOJ</title> <title>WOJ</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx"></script>
</body> </body>
</html> </html>

View File

@ -1,28 +1,45 @@
{ {
"name": "woj-ui", "name": "woj-ui",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"react": "^18.2.0", "@sentry/react": "^7.58.1",
"react-dom": "^18.2.0" "@sentry/vite-plugin": "^2.4.0",
}, "antd": "^5.7.0",
"devDependencies": { "axios": "^1.4.0",
"@types/react": "^18.2.14", "github-markdown-css": "^5.2.0",
"@types/react-dom": "^18.2.6", "react": "^18.2.0",
"@typescript-eslint/eslint-plugin": "^5.61.0", "react-dom": "^18.2.0",
"@typescript-eslint/parser": "^5.61.0", "react-markdown": "^8.0.7",
"@vitejs/plugin-react-swc": "^3.3.2", "react-router-dom": "^6.14.1",
"eslint": "^8.44.0", "react-syntax-highlighter": "^15.5.0",
"eslint-plugin-react-hooks": "^4.6.0", "rehype-mathjax": "^4.0.2",
"eslint-plugin-react-refresh": "^0.4.1", "rehype-raw": "^6.1.1",
"typescript": "^5.0.2", "remark-emoji": "^3.1.2",
"vite": "^4.4.0" "remark-gfm": "^3.0.1",
} "remark-math": "^5.1.1"
},
"devDependencies": {
"@types/node": "^20.4.2",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/react-syntax-highlighter": "^15.5.7",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.1",
"prettier": "3.0.0",
"typescript": "^5.0.2",
"vite": "^4.4.0"
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,25 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ES2020",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
/* Linting */ /* Linting */
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true
}, },
"include": ["src"], "include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]
} }

View File

@ -1,10 +1,10 @@
{ {
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"skipLibCheck": true, "skipLibCheck": true,
"module": "ESNext", "module": "ESNext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
}, },
"include": ["vite.config.ts"] "include": ["vite.config.ts"]
} }

View File

@ -1,7 +1,16 @@
import { defineConfig } from 'vite' import { defineConfig } from "vite";
import react from '@vitejs/plugin-react-swc' import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react-swc";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], build: { sourcemap: true },
}) plugins: [
react(),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "ldcraft",
project: "woj-ui",
}),
],
});