install prettier

This commit is contained in:
Chuck Dries 2021-07-24 14:45:38 -07:00
parent 78a76f6516
commit d0073ac492
10 changed files with 46 additions and 83 deletions

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
dist
dist-ssr
*.local

1
.prettierrc.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -4,7 +4,8 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"serve": "vite preview"
"serve": "vite preview",
"format": "prettier --write ."
},
"dependencies": {
"react": "^17.0.0",
@ -16,6 +17,7 @@
"@vitejs/plugin-react-refresh": "^1.3.1",
"autoprefixer": "^10.3.1",
"postcss": "^8.3.6",
"prettier": "2.3.2",
"tailwindcss": "^2.2.7",
"typescript": "^4.3.2",
"vite": "^2.4.3"

View File

@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};

View File

@ -1,53 +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-logo.spin-reverse {
animation: App-logo-spin-reverse 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);
}
}
@keyframes App-logo-spin-reverse {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-360deg);
}
}
button {
font-size: calc(10px + 2vmin);
}

View File

@ -17,7 +17,7 @@ const Greeter: React.FC<GreeterProps> = ({ name, setName }) => {
autoFocus
type="text"
style={{
width: Math.max(100, 14 * name.length) + "px",
width: Math.max(100, 10 * name.length) + "px",
}}
value={name}
onChange={(e) => setName(e.target.value)}
@ -30,20 +30,20 @@ function App() {
const [count, setCount] = useState(0);
const [name, setName] = useState("");
return (
<div className="App">
<header className="App-header">
<img
src={logo}
className="App-logo"
alt="logo"
style={{
animationDuration: `${20 / (name.length || 1)}s`,
}}
/>
<p>Hello Vite + React!</p>
<div className="bg-regal-blue text-white bg-opacity-90 flex flex-col items-center justify-center h-screen">
<img
src={logo}
className="w-1/2"
alt="logo"
style={{
animationDuration: `${20 / (name.length || 1)}s`,
}}
/>
<div className="text-center">
<p className="text-3xl">Hello Vite + React!</p>
<p>
<button
className="bg-blue-400 bg-opacity-60 hover:bg-blue-600 p-2 rounded m-2"
className="text-xl shadow bg-blue-400 bg-opacity-60 hover:bg-blue-600 p-2 rounded m-2"
type="button"
onClick={() => setCount((count) => count + 1)}
>
@ -51,7 +51,7 @@ function App() {
</button>
</p>
<Greeter name={name} setName={setName} />
</header>
</div>
</div>
);
}

View File

@ -1,11 +1,11 @@
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
)
document.getElementById("root")
);

View File

@ -1,12 +1,16 @@
module.exports = {
mode: 'jit',
purge: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
mode: "jit",
purge: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
extend: {
colors: {
"regal-blue": "#243c5a",
},
},
},
variants: {
extend: {},
},
plugins: [],
}
};

View File

@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import reactRefresh from '@vitejs/plugin-react-refresh'
import { defineConfig } from "vite";
import reactRefresh from "@vitejs/plugin-react-refresh";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh()]
})
plugins: [reactRefresh()],
});

View File

@ -1011,6 +1011,11 @@ postcss@^8.1.6, postcss@^8.2.1, postcss@^8.3.5, postcss@^8.3.6:
nanoid "^3.1.23"
source-map-js "^0.6.2"
prettier@2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
pretty-hrtime@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1"