Skip to content

Commit f5d772f

Browse files
committed
initial commit
0 parents  commit f5d772f

17 files changed

+2656
-0
lines changed

.eslintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
},
6+
extends: [
7+
'eslint:recommended',
8+
'plugin:react/recommended',
9+
'airbnb',
10+
'plugin:prettier/recommended',
11+
],
12+
parserOptions: {
13+
ecmaFeatures: {
14+
jsx: true,
15+
},
16+
ecmaVersion: 'latest',
17+
sourceType: 'module',
18+
},
19+
plugins: ['react'],
20+
rules: {},
21+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true,
4+
tabWidth: 2,
5+
endOfLine: 'auto',
6+
}

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Vite template
2+
3+
- Vite
4+
- React.js
5+
- WindiCSS
6+
- ESLint
7+
- Prettier
8+
- Husky
9+
- Lint-staged
10+
11+
## Prerequisites
12+
13+
- [`yarn`](https://classic.yarnpkg.com/en/docs/install#windows-stable)
14+
- [`git`](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
15+
16+
## Project setup
17+
18+
### Use the template
19+
20+
```bash
21+
npx degit moudev/vite-react-windi-eslint-husky my-app
22+
23+
cd my-app
24+
```
25+
26+
### Install dependencies
27+
28+
```bash
29+
yarn install
30+
```
31+
32+
### Config Git hooks (required)
33+
34+
```bash
35+
git init
36+
```
37+
38+
```bash
39+
yarn prepare
40+
```
41+
42+
### Development
43+
44+
```bash
45+
yarn dev
46+
```
47+
48+
### Build
49+
50+
```bash
51+
yarn build
52+
```
53+
54+
### Lints and fixes files
55+
56+
```bash
57+
yarn lint
58+
```

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "differenzo",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "vite build",
7+
"preview": "vite preview",
8+
"lint:fix": "eslint ./src --ext .jsx,.js --fix --ignore-path ./.gitignore",
9+
"lint:format": "prettier --write \"./**/*.{js,jsx,css,md,json}\" ",
10+
"lint": "yarn lint:format && yarn lint:fix ",
11+
"prepare": "husky install"
12+
},
13+
"dependencies": {
14+
"react": "^17.0.2",
15+
"react-dom": "^17.0.2"
16+
},
17+
"devDependencies": {
18+
"@vitejs/plugin-react": "^1.0.7",
19+
"eslint": "^8.7.0",
20+
"eslint-config-airbnb": "^19.0.4",
21+
"eslint-config-prettier": "^8.3.0",
22+
"eslint-plugin-import": "^2.25.4",
23+
"eslint-plugin-jsx-a11y": "^6.5.1",
24+
"eslint-plugin-prettier": "^4.0.0",
25+
"eslint-plugin-react": "^7.28.0",
26+
"eslint-plugin-react-hooks": "^4.3.0",
27+
"husky": "^7.0.4",
28+
"lint-staged": "^12.2.0",
29+
"prettier": "^2.5.1",
30+
"vite": "^2.7.2",
31+
"vite-plugin-windicss": "^1.6.3",
32+
"windicss": "^3.4.3"
33+
},
34+
"lint-staged": {
35+
"*.{js,jsx}": "eslint --cache --fix",
36+
"*.{css,md,json}": "prettier --write"
37+
}
38+
}

src/App.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
height: 40vmin;
7+
pointer-events: none;
8+
}
9+
10+
@media (prefers-reduced-motion: no-preference) {
11+
.App-logo {
12+
animation: App-logo-spin infinite 20s linear;
13+
}
14+
}
15+
16+
.App-header {
17+
background-color: #282c34;
18+
min-height: 100vh;
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
justify-content: center;
23+
font-size: calc(10px + 2vmin);
24+
color: white;
25+
}
26+
27+
.App-link {
28+
color: #61dafb;
29+
}
30+
31+
@keyframes App-logo-spin {
32+
from {
33+
transform: rotate(0deg);
34+
}
35+
to {
36+
transform: rotate(360deg);
37+
}
38+
}
39+
40+
button {
41+
font-size: calc(10px + 2vmin);
42+
}

src/App.jsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React, { useState } from 'react'
2+
import logo from './logo.svg'
3+
import './App.css'
4+
5+
function App() {
6+
const [count, setCount] = useState(0)
7+
8+
return (
9+
<div className="App">
10+
<header className="App-header">
11+
<img src={logo} className="App-logo mb-4" alt="logo" />
12+
<p className="mb-16">
13+
Vite + React.js + WindiCSS + ESLint + Prettier + Husky + Lint-staged
14+
</p>
15+
<p className="mb-4">
16+
<button
17+
type="button"
18+
onClick={() => setCount((prevCount) => prevCount + 1)}
19+
className="border border-white border-2 rounded-lg px-4 py-1 mb-16 bg-[#646CFF]"
20+
>
21+
count is: {count}
22+
</button>
23+
</p>
24+
<p>
25+
<a
26+
className="App-link"
27+
href="https://reactjs.org"
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
>
31+
Learn React
32+
</a>
33+
{' | '}
34+
<a
35+
className="App-link"
36+
href="https://vitejs.dev/guide/features.html"
37+
target="_blank"
38+
rel="noopener noreferrer"
39+
>
40+
Vite Docs
41+
</a>
42+
</p>
43+
</header>
44+
</div>
45+
)
46+
}
47+
48+
export default App

src/favicon.svg

Lines changed: 15 additions & 0 deletions
Loading

src/index.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
body {
2+
margin: 0;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5+
sans-serif;
6+
-webkit-font-smoothing: antialiased;
7+
-moz-osx-font-smoothing: grayscale;
8+
}
9+
10+
code {
11+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12+
monospace;
13+
}

src/logo.svg

Lines changed: 7 additions & 0 deletions
Loading

src/main.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
// eslint-disable-next-line import/no-unresolved
4+
import 'virtual:windi.css'
5+
6+
import './index.css'
7+
import App from './App'
8+
9+
ReactDOM.render(
10+
<React.StrictMode>
11+
<App />
12+
</React.StrictMode>,
13+
document.getElementById('root')
14+
)

vite.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import { defineConfig } from 'vite'
3+
import react from '@vitejs/plugin-react'
4+
import WindiCSS from 'vite-plugin-windicss'
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig({
8+
plugins: [react(), WindiCSS()],
9+
})

windi.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import { defineConfig } from 'windicss/helpers'
3+
4+
// https://windicss.org/guide/configuration.html
5+
export default defineConfig({})

0 commit comments

Comments
 (0)