set up project

main
FrozenArcher 2024-03-13 13:33:50 +08:00
parent 9be0ab77a2
commit 26776efbff
14 changed files with 1188 additions and 564 deletions

19
.eslintignore 100644
View File

@ -0,0 +1,19 @@
config
.husky
**/.gitignore
dist/
deploy_versions/
.temp/
.rn_temp/
node_modules/
.DS_Store
.swc
.husky
.prettierignore
.env.*
**/*.json
**/*.svg
**/*.scss
**/*.md
*.config.js
index.html

9
.eslintrc 100644
View File

@ -0,0 +1,9 @@
{
"extends": ["react-app"],
"plugins": ["prettier"],
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"prettier/prettier": "error"
}
}

View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

13
.prettierignore 100644
View File

@ -0,0 +1,13 @@
.eslintignore
**/.gitignore
dist/
deploy_versions/
.temp/
.rn_temp/
node_modules/
.DS_Store
.swc
.husky
.prettierignore
.env.*
**/*.svg

12
.prettierrc 100644
View File

@ -0,0 +1,12 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"proseWrap": "preserve",
"arrowParens": "always",
"bracketSpacing": true,
"jsxSingleQuote": true,
"endOfLine": "auto"
}

1557
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,10 @@
"name": "notify-admin", "name": "notify-admin",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"author": {
"name": "EVA Tech"
},
"dependencies": { "dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.88", "@types/node": "^16.18.88",
"@types/react": "^18.2.65", "@types/react": "^18.2.65",
"@types/react-dom": "^18.2.21", "@types/react-dom": "^18.2.21",
@ -19,14 +18,8 @@
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "eject": "react-scripts eject",
"eject": "react-scripts eject" "prepare": "husky"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
@ -39,5 +32,16 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
},
"devDependencies": {
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"sass": "^1.71.1",
"stylelint": "^16.2.1"
},
"lint-staged": {
"*.ts": "prettier --write",
"*.tsx": "prettier --write"
} }
} }

View File

@ -1,38 +0,0 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@ -1,9 +0,0 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@ -1,24 +1,7 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() { function App() {
return ( return (
<div className="App"> <div>
<header className="App-header"> <p>Hello</p>
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div> </div>
); );
} }

View File

@ -1,13 +0,0 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@ -1,19 +1,18 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App'; import App from './App';
import reportWebVitals from './reportWebVitals'; import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot( const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement document.getElementById('root') as HTMLElement,
); );
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<App /> <App />
</React.StrictMode> </React.StrictMode>,
); );
// If you want to start measuring performance in your app, pass a function // If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log)) // to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals(); reportWebVitals(console.log);

View File

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

View File

@ -1,11 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "ES2017",
"lib": [ "lib": ["dom", "dom.iterable", "esnext"],
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
@ -18,9 +14,10 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"jsx": "react-jsx" "jsx": "react-jsx",
"paths": {
"@/*": ["./src/*"]
}
}, },
"include": [ "include": ["src"]
"src"
]
} }