Skip to content

Commit 265bd27

Browse files
Update and fix vite react app
1 parent b5e3152 commit 265bd27

File tree

17 files changed

+5872
-22407
lines changed

17 files changed

+5872
-22407
lines changed

demo/vite-react-app/.eslintrc.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
require("@rushstack/eslint-patch/modern-module-resolution");
2+
3+
module.exports = {
4+
extends: ["@toruslabs/react"],
5+
parserOptions: {
6+
parser: "@typescript-eslint/parser",
7+
ecmaVersion: 2022,
8+
sourceType: "module",
9+
project: "./tsconfig.json",
10+
},
11+
ignorePatterns: ["*.cjs", "*.config.js", "vite.config.mts", "importLocales.js", "__generated__", ".eslintrc.js"],
12+
rules: {
13+
"@typescript-eslint/no-explicit-any": 1,
14+
"import/order": 0,
15+
"class-methods-use-this": 0,
16+
camelcase: 0,
17+
"@typescript-eslint/naming-convention": [
18+
"error",
19+
{
20+
selector: "typeLike",
21+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
22+
},
23+
],
24+
"no-console": 2,
25+
"mocha/no-global-tests": ["off"],
26+
"prettier/prettier": [
27+
2,
28+
{
29+
singleQuote: false,
30+
printWidth: 150,
31+
semi: true,
32+
trailingComma: "es5",
33+
},
34+
],
35+
"import/extensions": [
36+
"error",
37+
"ignorePackages",
38+
{
39+
js: "never",
40+
jsx: "never",
41+
ts: "never",
42+
tsx: "never",
43+
},
44+
],
45+
"no-underscore-dangle": 0,
46+
"no-restricted-exports": 0,
47+
"no-param-reassign": [2, { props: false }],
48+
"vue/v-on-event-hyphenation": 0,
49+
},
50+
settings: {
51+
"import/resolver": {
52+
typescript: {
53+
project: "./tsconfig.json",
54+
},
55+
},
56+
},
57+
};

demo/vite-react-app/index.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,27 @@
22
Migrate from react-app to vite by following this guide
33
https://www.freecodecamp.org/news/how-to-migrate-from-create-react-app-to-vite/
44
-->
5-
<!DOCTYPE html>
5+
<!doctype html>
66
<html lang="en">
77
<head>
88
<meta charset="utf-8" />
99
<link rel="icon" href="/favicon.ico" />
1010
<meta name="viewport" content="width=device-width, initial-scale=1" />
1111
<meta name="theme-color" content="#000000" />
12-
<meta
13-
name="description"
14-
content="Web site created using create-react-app"
15-
/>
12+
<meta name="description" content="Web site created using create-react-app" />
1613
<link rel="apple-touch-icon" href="/logo192.png" />
1714
<!--
1815
manifest.json provides metadata used when your web app is installed on a
1916
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
2017
-->
2118
<link rel="manifest" href="/manifest.json" />
19+
<script type="module">
20+
import { Buffer } from "buffer";
21+
import process from "process";
22+
// window.global ||= window;
23+
window.Buffer = Buffer;
24+
window.process = process;
25+
</script>
2226
<title>React App</title>
2327
</head>
2428
<body>

0 commit comments

Comments
 (0)