mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
chore(lint): enable linting on docs files (#1638)
This commit is contained in:
parent
aba2d224d0
commit
a5fcd5a976
@ -3,4 +3,3 @@ node_modules
|
|||||||
schema
|
schema
|
||||||
**/*.tmpl.*
|
**/*.tmpl.*
|
||||||
sw.js
|
sw.js
|
||||||
docs
|
|
||||||
|
7
docs/.eslintrc
Normal file
7
docs/.eslintrc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"settings": {
|
||||||
|
"import/ignore": [
|
||||||
|
"vue"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function isSpecialClick(event) {
|
function isSpecialClick (event) {
|
||||||
return event.button === 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey
|
return event.button === 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,26 +32,26 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$i18n.locale'(newValue) {
|
'$i18n.locale' (newValue) {
|
||||||
this.update(this.options, newValue)
|
this.update(this.options, newValue)
|
||||||
},
|
},
|
||||||
options(newValue) {
|
options (newValue) {
|
||||||
this.update(newValue, this.$i18n.locale)
|
this.update(newValue, this.$i18n.locale)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted () {
|
||||||
this.initialize(this.options, this.$i18n.locale)
|
this.initialize(this.options, this.$i18n.locale)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
stripTrailingSlash(url) {
|
stripTrailingSlash (url) {
|
||||||
return url.replace(/\/$|\/(?=\?)|\/(?=#)/g, '')
|
return url.replace(/\/$|\/(?=\?)|\/(?=#)/g, '')
|
||||||
},
|
},
|
||||||
getRelativePath(absoluteUrl) {
|
getRelativePath (absoluteUrl) {
|
||||||
const { pathname, hash } = new URL(absoluteUrl)
|
const { pathname, hash } = new URL(absoluteUrl)
|
||||||
const url = pathname.replace(this.settings.url, '/') + hash
|
const url = pathname.replace(this.settings.url, '/') + hash
|
||||||
return this.stripTrailingSlash(url)
|
return this.stripTrailingSlash(url)
|
||||||
},
|
},
|
||||||
async initialize(userOptions, code) {
|
async initialize (userOptions, code) {
|
||||||
const lang = this.$i18n.locales.find(locale => locale.code === code)
|
const lang = this.$i18n.locales.find(locale => locale.code === code)
|
||||||
|
|
||||||
const docsearch = await Promise.all([
|
const docsearch = await Promise.all([
|
||||||
@ -63,11 +63,13 @@ export default {
|
|||||||
...userOptions,
|
...userOptions,
|
||||||
container: '#docsearch',
|
container: '#docsearch',
|
||||||
searchParameters: {
|
searchParameters: {
|
||||||
...((!lang) ? {} : {
|
...((!lang)
|
||||||
facetFilters: [`${userOptions.langAttribute || 'language'}:${lang.iso}`].concat(
|
? {}
|
||||||
userOptions.facetFilters || []
|
: {
|
||||||
)
|
facetFilters: [`${userOptions.langAttribute || 'language'}:${lang.iso}`].concat(
|
||||||
}),
|
userOptions.facetFilters || []
|
||||||
|
)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
navigator: {
|
navigator: {
|
||||||
navigate: ({ itemUrl }) => {
|
navigate: ({ itemUrl }) => {
|
||||||
@ -97,7 +99,7 @@ export default {
|
|||||||
__v: 1,
|
__v: 1,
|
||||||
props: {
|
props: {
|
||||||
href: hit.url,
|
href: hit.url,
|
||||||
children: children,
|
children,
|
||||||
onClick: (event) => {
|
onClick: (event) => {
|
||||||
if (isSpecialClick(event)) {
|
if (isSpecialClick(event)) {
|
||||||
return
|
return
|
||||||
@ -119,13 +121,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$router.push(hit.url)
|
this.$router.push(hit.url)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
update(options, lang) {
|
update (options, lang) {
|
||||||
return this.initialize(options, lang)
|
return this.initialize(options, lang)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
:key="link.to"
|
:key="link.to"
|
||||||
:title="link.title"
|
:title="link.title"
|
||||||
:docs="link.children"
|
:docs="link.children"
|
||||||
:collapse.sync="link.collapse"
|
:collapse="link.collapse"
|
||||||
|
@update:collapse="link.collapse = $event"
|
||||||
/>
|
/>
|
||||||
<AsideNavigationItem v-else :key="link.to" :docs="[link]" />
|
<AsideNavigationItem v-else :key="link.to" :docs="[link]" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
>
|
>
|
||||||
<path d="M80.0761 12L159.152 148.965H1L80.0761 12Z" fill="currentColor" />
|
<path d="M80.0761 12L159.152 148.965H1L80.0761 12Z" fill="currentColor" />
|
||||||
</svg>
|
</svg>
|
||||||
</template?
|
</template>
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style lang="postcss">
|
||||||
.highlight-box {
|
.highlight-box {
|
||||||
@apply transition-shadow duration-300;
|
@apply transition-shadow duration-300;
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ export default {
|
|||||||
template: 'docs',
|
template: 'docs',
|
||||||
twitter: 'nuxt_js',
|
twitter: 'nuxt_js',
|
||||||
algolia: {
|
algolia: {
|
||||||
appId: "BH4D9OD16A",
|
appId: 'BH4D9OD16A',
|
||||||
container: "#docsearch",
|
container: '#docsearch',
|
||||||
apiKey: "ff80fbf046ce827f64f06e16f82f1401",
|
apiKey: 'ff80fbf046ce827f64f06e16f82f1401',
|
||||||
indexName: "nuxtjs",
|
indexName: 'nuxtjs',
|
||||||
facetFilters: ['tags:v3']
|
facetFilters: ['tags:v3']
|
||||||
},
|
},
|
||||||
github: {
|
github: {
|
||||||
|
Loading…
Reference in New Issue
Block a user