Skip to content

Commit b4853c3

Browse files
committed
style: lint code
1 parent ba1f7c7 commit b4853c3

38 files changed

+599
-230
lines changed

Diff for: packages/@vuepress/core/lib/client/app.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Vue.use(VuePress)
3838
Vue.mixin(dataMixin(ClientComputedMixin, siteData))
3939
// component for rendering markdown content and setting title etc.
4040

41+
/* eslint-disable vue/match-component-file-name */
4142
Vue.component('Content', Content)
4243
Vue.component('ContentSlotsDistributor', ContentSlotsDistributor)
4344
Vue.component('OutboundLink', OutboundLink)
@@ -46,6 +47,7 @@ Vue.component('ClientOnly', ClientOnly)
4647
// core components
4748
Vue.component('Layout', getLayoutAsyncComponent('Layout'))
4849
Vue.component('NotFound', getLayoutAsyncComponent('NotFound'))
50+
/* eslint-disable-next-line vue/match-component-file-name */
4951

5052
// global helper for adding base path to absolute urls
5153
Vue.prototype.$withBase = function (path) {
@@ -102,7 +104,7 @@ export function createApp (isServer) {
102104
router,
103105
render (h) {
104106
return h('div', { attrs: { id: 'app' }}, [
105-
h('router-view', { ref: 'layout' }),
107+
h('RouterView', { ref: 'layout' }),
106108
h('div', { class: 'global-ui' }, globalUIComponents.map(component => h(component)))
107109
])
108110
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
<template>
2-
<component :is="layout"/>
2+
<component :is="layout" />
33
</template>
44

55
<script>
66
import Vue from 'vue'
77
import { setGlobalInfo } from '@app/util'
88
99
export default {
10+
name: 'GlobalLayout',
11+
12+
computed: {
13+
layout () {
14+
const layout = this.getLayout()
15+
setGlobalInfo('layout', layout)
16+
return Vue.component(layout)
17+
}
18+
},
19+
1020
methods: {
1121
getLayout () {
1222
if (this.$page.path) {
@@ -19,14 +29,6 @@ export default {
1929
}
2030
return 'NotFound'
2131
}
22-
},
23-
24-
computed: {
25-
layout () {
26-
const layout = this.getLayout()
27-
setGlobalInfo('layout', layout)
28-
return Vue.component(layout)
29-
}
3032
}
3133
}
3234
</script>

Diff for: packages/@vuepress/core/lib/client/components/NotFound.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
<div class="theme-container">
33
<div class="content">
44
<h1>404</h1>
5+
56
<blockquote>{{ getMsg() }}</blockquote>
6-
<router-link to="/">Take me home.</router-link>
7+
8+
<RouterLink to="/">
9+
Take me home.
10+
</RouterLink>
711
</div>
812
</div>
913
</template>

Diff for: packages/@vuepress/core/lib/client/components/OutboundLink.vue

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
<template functional>
2-
<svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
3-
<path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path>
4-
<polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon>
2+
<svg
3+
class="icon outbound"
4+
xmlns="http://www.w3.org/2000/svg"
5+
aria-hidden="true"
6+
x="0px"
7+
y="0px"
8+
viewBox="0 0 100 100"
9+
width="15"
10+
height="15"
11+
>
12+
<path
13+
fill="currentColor"
14+
d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"
15+
/>
16+
<polygon
17+
fill="currentColor"
18+
points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"
19+
/>
520
</svg>
621
</template>
722

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<template>
2-
<Content/>
2+
<Content />
33
</template>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<template>
2-
<Content/>
2+
<Content />
33
</template>

Diff for: packages/@vuepress/markdown/lib/link.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ module.exports = (md, externalAttrs) => {
6767
routerLinks.push(to)
6868

6969
return Object.create(token, {
70-
tag: { value: 'router-link' }
70+
tag: { value: 'RouterLink' }
7171
})
7272
}
7373

7474
md.renderer.rules.link_close = (tokens, idx, options, env, self) => {
7575
const token = tokens[idx]
7676
if (hasOpenRouterLink) {
77-
token.tag = 'router-link'
77+
token.tag = 'RouterLink'
7878
hasOpenRouterLink = false
7979
}
8080
if (hasOpenExternalLink) {

Diff for: packages/@vuepress/plugin-back-to-top/BackToTop.vue

+24-9
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@
33
<svg
44
v-if="show"
55
class="go-to-top"
6+
xmlns="http://www.w3.org/2000/svg"
7+
viewBox="0 0 49.484 28.284"
68
@click="scrollToTop"
7-
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 49.484 28.284"
89
>
910
<g transform="translate(-229 -126.358)">
10-
<rect fill="currentColor" width="35" height="5" rx="2" transform="translate(229 151.107) rotate(-45)"/>
11-
<rect fill="currentColor" width="35" height="5" rx="2" transform="translate(274.949 154.642) rotate(-135)"/>
11+
<rect
12+
fill="currentColor"
13+
width="35"
14+
height="5"
15+
rx="2"
16+
transform="translate(229 151.107) rotate(-45)"
17+
/>
18+
<rect
19+
fill="currentColor"
20+
width="35"
21+
height="5"
22+
rx="2"
23+
transform="translate(274.949 154.642) rotate(-135)"
24+
/>
1225
</g>
1326
</svg>
1427
</transition>
@@ -18,6 +31,8 @@
1831
import debounce from 'lodash.debounce'
1932
2033
export default {
34+
name: 'BackToTop',
35+
2136
props: {
2237
threshold: {
2338
type: Number,
@@ -31,6 +46,12 @@ export default {
3146
}
3247
},
3348
49+
computed: {
50+
show () {
51+
return this.scrollTop > this.threshold
52+
}
53+
},
54+
3455
mounted () {
3556
this.scrollTop = this.getScrollTop()
3657
window.addEventListener('scroll', debounce(() => {
@@ -49,12 +70,6 @@ export default {
4970
window.scrollTo({ top: 0, behavior: 'smooth' })
5071
this.scrollTop = 0
5172
}
52-
},
53-
54-
computed: {
55-
show () {
56-
return this.scrollTop > this.threshold
57-
}
5873
}
5974
}
6075
</script>
+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import BackToTop from './BackToTop.vue'
22

33
export default ({ Vue }) => {
4+
// eslint-disable-next-line vue/match-component-file-name
45
Vue.component('BackToTop', BackToTop)
56
}

Diff for: packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue

+16-9
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
v-if="enabled"
1111
class="sw-update-popup"
1212
>
13-
{{ message }}<br>
14-
<button @click="reload">{{ buttonText }}</button>
13+
{{ message }}
14+
15+
<br>
16+
17+
<button @click="reload">
18+
{{ buttonText }}
19+
</button>
1520
</div>
1621
</slot>
1722
</transition>
@@ -24,20 +29,15 @@ import { normalizeConfig } from '@app/util'
2429
import { popupConfig as defaultPopupConfig } from './i18n'
2530
2631
export default {
32+
name: 'SWUpdatePopup',
33+
2734
data () {
2835
return {
2936
rawPopupConfig: SW_UPDATE_POPUP,
3037
updateEvent: null
3138
}
3239
},
3340
34-
created () {
35-
event.$on('sw-updated', this.onSWUpdated)
36-
if (SW_UPDATE_POPUP === true) {
37-
this.rawPopupConfig = defaultPopupConfig
38-
}
39-
},
40-
4141
computed: {
4242
popupConfig () {
4343
return normalizeConfig(this, this.rawPopupConfig)
@@ -58,6 +58,13 @@ export default {
5858
}
5959
},
6060
61+
created () {
62+
event.$on('sw-updated', this.onSWUpdated)
63+
if (SW_UPDATE_POPUP === true) {
64+
this.rawPopupConfig = defaultPopupConfig
65+
}
66+
},
67+
6168
methods: {
6269
onSWUpdated (e) {
6370
this.updateEvent = e

Diff for: packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import SWUpdateEvent from './SWUpdateEvent'
66
import event from './event'
77

88
if (SW_UPDATE_POPUP) {
9+
// eslint-disable-next-line vue/match-component-file-name
910
Vue.component('SWUpdatePopup', () => import('./SWUpdatePopup.vue'))
1011
}
1112

Diff for: packages/@vuepress/plugin-search/SearchBox.vue

+24-15
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
11
<template>
22
<div class="search-box">
33
<input
4-
@input="query = $event.target.value"
4+
ref="input"
55
aria-label="Search"
66
:value="query"
77
:class="{ 'focused': focused }"
88
:placeholder="placeholder"
99
autocomplete="off"
1010
spellcheck="false"
11+
@input="query = $event.target.value"
1112
@focus="focused = true"
1213
@blur="focused = false"
1314
@keyup.enter="go(focusIndex)"
1415
@keyup.up="onUp"
1516
@keyup.down="onDown"
16-
ref="input"
1717
>
1818
<ul
19-
class="suggestions"
2019
v-if="showSuggestions"
20+
class="suggestions"
2121
:class="{ 'align-right': alignRight }"
2222
@mouseleave="unfocus"
2323
>
2424
<li
25-
class="suggestion"
2625
v-for="(s, i) in suggestions"
26+
:key="i"
27+
class="suggestion"
2728
:class="{ focused: i === focusIndex }"
2829
@mousedown="go(i)"
2930
@mouseenter="focus(i)"
3031
>
31-
<a :href="s.path" @click.prevent>
32+
<a
33+
:href="s.path"
34+
@click.prevent
35+
>
3236
<span class="page-title">{{ s.title || s.path }}</span>
33-
<span v-if="s.header" class="header">&gt; {{ s.header.title }}</span>
37+
<span
38+
v-if="s.header"
39+
class="header"
40+
>&gt; {{ s.header.title }}</span>
3441
</a>
3542
</li>
3643
</ul>
@@ -40,6 +47,8 @@
4047
<script>
4148
/* global SEARCH_MAX_SUGGESTIONS, SEARCH_PATHS, SEARCH_HOTKEYS */
4249
export default {
50+
name: 'SearchBox',
51+
4352
data () {
4453
return {
4554
query: '',
@@ -49,15 +58,6 @@ export default {
4958
}
5059
},
5160
52-
mounted () {
53-
this.placeholder = this.$site.themeConfig.searchPlaceholder || ''
54-
document.addEventListener('keydown', this.onHotkey)
55-
},
56-
57-
beforeDestroy () {
58-
document.removeEventListener('keydown', this.onHotkey)
59-
},
60-
6161
computed: {
6262
showSuggestions () {
6363
return (
@@ -121,6 +121,15 @@ export default {
121121
}
122122
},
123123
124+
mounted () {
125+
this.placeholder = this.$site.themeConfig.searchPlaceholder || ''
126+
document.addEventListener('keydown', this.onHotkey)
127+
},
128+
129+
beforeDestroy () {
130+
document.removeEventListener('keydown', this.onHotkey)
131+
},
132+
124133
methods: {
125134
getPageLocalePath (page) {
126135
for (const localePath in this.$site.locales || {}) {

Diff for: packages/@vuepress/theme-default/__tests__/components/DropdownLink.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('DropdownLink', () => {
2121
const wrapper = mount(DropdownLink, {
2222
localVue: createLocalVue(),
2323
stubs: {
24-
'router-link': RouterLinkStub
24+
'RouterLink': RouterLinkStub
2525
},
2626
propsData: { item }
2727
})

Diff for: packages/@vuepress/theme-default/__tests__/components/NavLink.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('NavLink', () => {
1111
const wrapper = mount(NavLink, {
1212
localVue: createLocalVue(),
1313
stubs: {
14-
'router-link': RouterLinkStub
14+
'RouterLink': RouterLinkStub
1515
},
1616
propsData: { item }
1717
})

0 commit comments

Comments
 (0)