Skip to content

Commit

Permalink
style(all) 增加 prettier 配置,格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivocin committed Feb 26, 2021
1 parent 7dc0b05 commit caaf692
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 49 deletions.
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
8 changes: 4 additions & 4 deletions vite-react/src/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Menu } from "antd";
import { Link } from "react-router-dom";
import React from 'react'
import { Menu } from 'antd'
import { Link } from 'react-router-dom'

export default function Layout() {
return (
Expand All @@ -12,5 +12,5 @@ export default function Layout() {
<Link to="/app">App</Link>
</Menu.Item>
</Menu>
);
)
}
6 changes: 3 additions & 3 deletions vite-react/src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
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",
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
14 changes: 7 additions & 7 deletions vite-react/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
import Layout from "./Layout";
import App from "~/pages/app/index";
import User from "~/pages/user/index";
import "antd/dist/antd.less";
import React from 'react'
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom'
import Layout from './Layout'
import App from '~/pages/app/index'
import User from '~/pages/user/index'
import 'antd/dist/antd.less'

export default function Index() {
return (
Expand All @@ -18,5 +18,5 @@ export default function Index() {
</Route>
</Switch>
</Router>
);
)
}
12 changes: 6 additions & 6 deletions vite-react/src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import Index from "./index";
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import Index from './index'

ReactDOM.render(
<React.StrictMode>
<Index />
</React.StrictMode>,
document.getElementById("root")
);
document.getElementById('root')
)
16 changes: 8 additions & 8 deletions vite-react/src/pages/app/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from "react";
import { DatePicker, Button } from "antd";
import logo from "~/assets/logo.svg";
import "./index.css";
import React, { useState } from 'react'
import { DatePicker, Button } from 'antd'
import logo from '~/assets/logo.svg'
import './index.css'

function App() {
const [count, setCount] = useState(0);
const [count, setCount] = useState(0)

return (
<div className="App">
Expand All @@ -26,7 +26,7 @@ function App() {
>
Learn React
</a>
{" | "}
{' | '}
<a
className="App-link"
href="https://vitejs.dev/guide/features.html"
Expand All @@ -38,7 +38,7 @@ function App() {
</p>
</header>
</div>
);
)
}

export default App;
export default App
2 changes: 1 addition & 1 deletion vite-react/src/pages/user/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.User {
color: #fff;
}
}
10 changes: 3 additions & 7 deletions vite-react/src/pages/user/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from "react";
import React from 'react'
import './index.css'

export default function User(props) {
return (
<div className="User">
User Page
</div>
)
}
return <div className="User">User Page</div>
}
26 changes: 13 additions & 13 deletions vite-react/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { defineConfig } from "vite";
import reactRefresh from "@vitejs/plugin-react-refresh";
import { getThemeVariables } from "antd/dist/theme";
import path from "path";
import { defineConfig } from 'vite'
import reactRefresh from '@vitejs/plugin-react-refresh'
import { getThemeVariables } from 'antd/dist/theme'
import path from 'path'

console.log(path.resolve(__dirname, "src"));
console.log(path.resolve(__dirname, 'src'))
// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh()],
Expand All @@ -16,29 +16,29 @@ export default defineConfig({
dark: true,
}),
...{
"primary-color": "#1DA57A",
"link-color": "#1DA57A",
"border-radius-base": "2px",
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
},
},
},
},
},
server: {
proxy: {
"/api": {
target: "http://jsonplaceholder.typicode.com/",
'/api': {
target: 'http://jsonplaceholder.typicode.com/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
resolve: {
alias: [
{
find: /^~/,
replacement: path.resolve(__dirname, "src"),
replacement: path.resolve(__dirname, 'src'),
},
],
},
});
})

0 comments on commit caaf692

Please sign in to comment.