Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf9a040

Browse files
committed
add prettier and format
1 parent 0da0e52 commit cf9a040

File tree

21 files changed

+262
-226
lines changed

21 files changed

+262
-226
lines changed

‎.eslintrc.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module.exports = {
33
env: {
44
node: true
55
},
6-
extends: ["plugin:vue/essential","@vue/prettier"],
6+
extends: ['plugin:vue/essential','@vue/prettier'],
77
rules: {
8-
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9-
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
8+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
9+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
1010
},
1111
parserOptions: {
12-
parser: "babel-eslint"
12+
parser: 'babel-eslint'
1313
}
14-
};
14+
}

‎.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ yarn-error.log*
1313

1414
# Editor directories and files
1515
.idea
16-
.vscode
1716
*.suo
1817
*.ntvs*
1918
*.njsproj

‎.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 80,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"trailingComma": "none"
8+
}

‎.vscode/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// 编辑器保存自动格式化
3+
"editor.formatOnSave": true,
4+
// 锁紧字符
5+
"editor.tabSize": 2,
6+
// 自动在vscode顶部显示文件路径
7+
"window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
8+
// 搜索排除
9+
"search.exclude": {
10+
"**/node_modules": true,
11+
"**/bower_components": true,
12+
"**/dist": true
13+
},
14+
// 控制是否在搜索中跟踪符号链接,会导致cpu内存占有率过高
15+
"search.followSymlinks": false,
16+
// 自动fetch远程分支
17+
"git.autofetch": true,
18+
// eslint开启
19+
"eslint.enable": true,
20+
// eslint自动保存格式话
21+
"editor.codeActionsOnSave": {
22+
"source.fixAll.eslint": true
23+
},
24+
// 保存超时时长
25+
"editor.codeActionsOnSaveTimeout": 2500,
26+
// 依赖prettier配置文件来格式化
27+
"prettier.requireConfig": true
28+
}

‎babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ["@vue/app"]
3-
};
2+
presets: ['@vue/app']
3+
}

‎postcss.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module.exports = {
22
plugins: {
33
autoprefixer: {}
44
}
5-
};
5+
}

‎src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<style lang="scss">
1111
#app {
12-
font-family: "Avenir", Helvetica, Arial, sans-serif;
12+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
1313
-webkit-font-smoothing: antialiased;
1414
-moz-osx-font-smoothing: grayscale;
1515
text-align: center;

‎src/api/index.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1-
import axios from "axios";
2-
const TARGET_SERVER = process.env.VUE_ENV === "server";
1+
import axios from 'axios'
2+
const TARGET_SERVER = process.env.VUE_ENV === 'server'
33
// FOR PROXY TEST: const cnodeBaseUrl = TARGET_SERVER ? process.env.config.CNODE_HOST : "/feapi";
4-
const cnodeBaseUrl = process.env.config.CNODE_HOST;
4+
const cnodeBaseUrl = process.env.config.CNODE_HOST
55
export function fetchTopics({ cookies }) {
6-
return axios.get(cnodeBaseUrl + "/api/v1/topics", {
6+
return axios.get(cnodeBaseUrl + '/api/v1/topics', {
77
headers: getCommonHeader({ cookies })
8-
});
8+
})
99
}
1010

1111
export function fetchTopicDetail({ id, cookies }) {
1212
return axios.get(cnodeBaseUrl + `/api/v1/topic/${id}`, {
1313
headers: getCommonHeader({ cookies })
14-
});
14+
})
1515
}
1616

1717
function getCommonHeader({ cookies }) {
1818
if (TARGET_SERVER && cookies) {
19-
return { cookie: getCookieString(cookies) };
19+
return { cookie: getCookieString(cookies) }
2020
} else {
21-
return null;
21+
return null
2222
}
2323
}
2424

2525
function getCookieString(cookies) {
26-
let cookieStr = "";
26+
let cookieStr = ''
2727
for (var variable in cookies) {
28+
// eslint-disable-next-line no-prototype-builtins
2829
if (cookies.hasOwnProperty(variable)) {
29-
cookieStr += `${variable}=${encodeURIComponent(cookies[variable])}; `;
30+
cookieStr += `${variable}=${encodeURIComponent(cookies[variable])}; `
3031
}
3132
}
32-
return cookieStr;
33+
return cookieStr
3334
}

‎src/components/TopicItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
<script>
99
export default {
10-
name: "TopicItem",
10+
name: 'TopicItem',
1111
serverCacheKey: props => props.topicInfo.id, // for ssr cache item component
1212
props: {
1313
topicInfo: Object
1414
}
15-
};
15+
}
1616
</script>
1717

1818
<!-- Add "scoped" attribute to limit CSS to this component only -->

‎src/entry-client.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { createApp } from "./main";
2-
const { app, router, store } = createApp();
1+
import { createApp } from './main'
2+
const { app, router, store } = createApp()
33

44
// prime the store with server-initialized state.
55
// the state is determined during SSR and inlined in the page markup.
66
if (window.__INITIAL_STATE__) {
7-
store.replaceState(window.__INITIAL_STATE__);
7+
store.replaceState(window.__INITIAL_STATE__)
88
}
99
router.onReady(() => {
10-
app.$mount("#app");
11-
});
10+
app.$mount('#app')
11+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /