Skip to content

Commit 3e093b3

Browse files
committed
全局lint优化
1 parent ddd05eb commit 3e093b3

File tree

104 files changed

+3417
-3602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3417
-3602
lines changed

.eslintrc.js

Lines changed: 117 additions & 291 deletions
Large diffs are not rendered by default.

build/webpack.base.conf.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ module.exports = {
3737
},
3838
module: {
3939
rules: [
40-
// {
41-
// test: /\.(js|vue)$/,
42-
// loader: 'eslint-loader',
43-
// enforce: "pre",
44-
// include: [resolve('src'), resolve('test')],
45-
// options: {
46-
// formatter: require('eslint-friendly-formatter')
47-
// }
48-
// },
40+
{
41+
test: /\.(js|vue)$/,
42+
loader: 'eslint-loader',
43+
enforce: "pre",
44+
include: [resolve('src'), resolve('test')],
45+
options: {
46+
formatter: require('eslint-friendly-formatter')
47+
}
48+
},
4949
{
5050
test: /\.vue$/,
5151
loader: 'vue-loader',

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
</script>
1212

1313
<style lang="scss">
14-
@import '~normalize.css/normalize.css';// normalize.css 样式格式化
15-
@import './styles/index.scss'; // 全局自定义的css样式
14+
@import '~normalize.css/normalize.css';// normalize.css 样式格式化
15+
@import './styles/index.scss'; // 全局自定义的css样式
1616
</style>

src/api/article.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import fetch from 'utils/fetch';
1+
import fetch from 'utils/fetch'
22

3-
export function getList() {
3+
export function getList () {
44
return fetch({
55
url: '/article/list',
66
method: 'get'
7-
});
7+
})
88
}
99

10-
export function getArticle() {
10+
export function getArticle () {
1111
return fetch({
1212
url: '/article/detail',
1313
method: 'get'
14-
});
14+
})
1515
}
1616

src/api/article_table.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import fetch from 'utils/fetch';
1+
import fetch from 'utils/fetch'
22

3-
export function fetchList(query) {
3+
export function fetchList (query) {
44
return fetch({
55
url: '/article_table/list',
66
method: 'get',
77
params: query
8-
});
8+
})
99
}
1010

11-
export function fetchPv(pv) {
11+
export function fetchPv (pv) {
1212
return fetch({
1313
url: '/article_table/pv',
1414
method: 'get',
1515
params: { pv }
16-
});
16+
})
1717
}

src/api/login.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fetch from 'utils/fetch'
22

3-
export function loginByUsername(username, password) {
3+
export function loginByUsername (username, password) {
44
const data = {
55
username,
66
password
@@ -12,14 +12,14 @@ export function loginByUsername(username, password) {
1212
})
1313
}
1414

15-
export function logout() {
15+
export function logout () {
1616
return fetch({
1717
url: '/login/logout',
1818
method: 'post'
1919
})
2020
}
2121

22-
export function getInfo(token) {
22+
export function getInfo (token) {
2323
return fetch({
2424
url: '/user/info',
2525
method: 'get',

src/api/qiniu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import fetch from 'utils/fetch';
1+
import fetch from 'utils/fetch'
22

3-
export function getToken() {
3+
export function getToken () {
44
return fetch({
55
url: '/qiniu/upload/token', // 假地址 自行替换
66
method: 'get'
7-
});
7+
})
88
}

src/api/remoteSearch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import fetch from 'utils/fetch';
1+
import fetch from 'utils/fetch'
22

3-
export function userSearch(name) {
3+
export function userSearch (name) {
44
return fetch({
55
url: '/search/user',
66
method: 'get',
77
params: { name }
8-
});
8+
})
99
}

src/components/BackToTop/index.vue

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,73 +12,73 @@
1212
</template>
1313

1414
<script>
15-
export default {
16-
name: 'BackToTop',
17-
props: {
18-
visibilityHeight: {
19-
type: Number,
20-
default: 400
21-
},
22-
backPosition: {
23-
type: Number,
24-
default: 0
25-
},
26-
customStyle: {
27-
type: Object,
28-
default: {
29-
right: '50px',
30-
bottom: '50px',
31-
width: '40px',
32-
height: '40px',
33-
'border-radius': '4px',
34-
'line-height': '45px',
35-
background: '#e7eaf1'
36-
}
37-
},
38-
transitionName: {
39-
type: String,
40-
default: 'fade'
41-
}
15+
export default {
16+
name: 'BackToTop',
17+
props: {
18+
visibilityHeight: {
19+
type: Number,
20+
default: 400
21+
},
22+
backPosition: {
23+
type: Number,
24+
default: 0
4225
},
43-
data() {
44-
return {
45-
visible: false,
46-
interval: null
26+
customStyle: {
27+
type: Object,
28+
default: {
29+
right: '50px',
30+
bottom: '50px',
31+
width: '40px',
32+
height: '40px',
33+
'border-radius': '4px',
34+
'line-height': '45px',
35+
background: '#e7eaf1'
4736
}
4837
},
49-
mounted() {
50-
window.addEventListener('scroll', this.handleScroll);
38+
transitionName: {
39+
type: String,
40+
default: 'fade'
41+
}
42+
},
43+
data() {
44+
return {
45+
visible: false,
46+
interval: null
47+
}
48+
},
49+
mounted() {
50+
window.addEventListener('scroll', this.handleScroll)
51+
},
52+
beforeDestroy() {
53+
window.removeEventListener('scroll', this.handleScroll)
54+
if (this.interval) {
55+
clearInterval(this.interval)
56+
}
57+
},
58+
methods: {
59+
handleScroll() {
60+
this.visible = window.pageYOffset > this.visibilityHeight
5161
},
52-
beforeDestroy() {
53-
window.removeEventListener('scroll', this.handleScroll);
54-
if (this.interval) {
55-
clearInterval(this.interval);
56-
}
62+
backToTop() {
63+
const start = window.pageYOffset
64+
let i = 0
65+
this.interval = setInterval(() => {
66+
const next = Math.floor(this.easeInOutQuad(10 * i, start, -start, 500))
67+
if (next <= this.backPosition) {
68+
window.scrollTo(0, this.backPosition)
69+
clearInterval(this.interval)
70+
} else {
71+
window.scrollTo(0, next)
72+
}
73+
i++
74+
}, 16.7)
5775
},
58-
methods: {
59-
handleScroll() {
60-
this.visible = window.pageYOffset > this.visibilityHeight;
61-
},
62-
backToTop() {
63-
const start = window.pageYOffset;
64-
let i = 0;
65-
this.interval = setInterval(() => {
66-
const next = Math.floor(this.easeInOutQuad(10 * i, start, -start, 500));
67-
if (next <= this.backPosition) {
68-
window.scrollTo(0, this.backPosition);
69-
clearInterval(this.interval)
70-
} else {
71-
window.scrollTo(0, next);
72-
}
73-
i++;
74-
}, 16.7)
75-
},
76-
easeInOutQuad(t, b, c, d) {
77-
if ((t /= d / 2) < 1) return c / 2 * t * t + b;
78-
return -c / 2 * (--t * (t - 2) - 1) + b;
79-
}
76+
easeInOutQuad(t, b, c, d) {
77+
if ((t /= d / 2) < 1) return c / 2 * t * t + b
78+
return -c / 2 * (--t * (t - 2) - 1) + b
8079
}
8180
}
81+
}
8282
</script>
8383

8484
<style scoped>

0 commit comments

Comments
 (0)