Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Dec 5, 2022
1 parent f0c89f8 commit 82fcfa7
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 80 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ stylelint-fix:
clean:
rm -rf dist/
rm -rf src/fonts/
rm -rf styleguide/build/

clean-dev:
rm -rf node_modules
Expand Down
1 change: 1 addition & 0 deletions docs/directives.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Directives
## Tooltip

```js static
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev": "vite build --mode development",
"watch": "vite build --watch --mode development",
"l10n:extract": "node build/extract-l10n.js",
"lint": "eslint --ext .mjs,.js,.vue src styleguide",
"lint": "eslint --ext .mjs,.js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
Expand Down
158 changes: 80 additions & 78 deletions styleguide/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,92 +18,94 @@ const docsPath = path.resolve(__dirname, '../docs')
* @returns {import('vitepress').DefaultTheme.SidebarItem[]}
*/
function getComponents() {
const sections = {}
const sections = {}

fs.readdirSync(path.resolve(docsPath, 'components'))
.forEach(file => {
const name = file.replace('.md', '')
const words = name.split(/(?=[A-Z])/)
const section = words
.slice(0, (words[1] === 'App' && words.length >= 3 ? 3 : 2))
.join('')
.replace(/s$/, '') // fix NcActions
if (!(section in sections)) sections[section] = []
sections[section].push(name)
})
fs.readdirSync(path.resolve(docsPath, 'components'))
.forEach(file => {
const name = file.replace('.md', '')
const words = name.split(/(?=[A-Z])/)
const section = words
.slice(0, (words[1] === 'App' && words.length >= 3 ? 3 : 2))
.join('')
.replace(/s$/, '') // fix NcActions
if (!(section in sections)) sections[section] = []
sections[section].push(name)
})

return Object.keys(sections)
.sort()
.map(section => {
// Get base component as first entry, sort is not enogh because of `NcActions` vs `NcActionX`
const first = sections[section].sort((p,q) => p.length - q.length)[0]
const other = sections[section].filter(p => p !== first).sort()
return {
text: section,
items: [
first,
...other
].map(file => ({text: file, link: `/components/${file}`}))
}
})
return Object.keys(sections)
.sort()
.map(section => {
// Get base component as first entry, sort is not enogh because of `NcActions` vs `NcActionX`
const first = sections[section].sort((p, q) => p.length - q.length)[0]
const other = sections[section].filter(p => p !== first).sort()
return {
text: section,
items: [
first,
...other
].map(file => ({ text: file, link: `/components/${file}` }))
}
})
}

export default defineConfig({
title: '@nextcloud/vue',
description: 'Vue.js components for Nextcloud app development',
title: '@nextcloud/vue',
description: 'Vue.js components for Nextcloud app development',

ignoreDeadLinks: true,
ignoreDeadLinks: true,

themeConfig: {
logo: 'https://nextcloud.com/wp-content/uploads/2022/10/nextcloud-logo-blue-transparent.svg',
nav: [
{ text: `${version}`, items: [
{ text: 'Changelog', link: `https://github.com/nextcloud/nextcloud-vue/blob/v${version}/CHANGELOG.md` },
]},
],
sidebar: [
{
text: 'Components',
collapsible: true,
collapsed: true,
items: getComponents(),
},
{
items: [{
text: 'Directives',
link: '/directives'
}]
},
],
socialLinks: [
{
icon: 'github',
link: 'https://github.com/nextcloud/nextcloud-vue'
}
],
},
themeConfig: {
logo: 'https://nextcloud.com/wp-content/uploads/2022/10/nextcloud-logo-blue-transparent.svg',
nav: [
{
text: `${version}`, items: [
{ text: 'Changelog', link: `https://github.com/nextcloud/nextcloud-vue/blob/v${version}/CHANGELOG.md` },
]
},
],
sidebar: [
{
text: 'Components',
collapsible: true,
collapsed: true,
items: getComponents(),
},
{
items: [{
text: 'Directives',
link: '/directives'
}]
},
],
socialLinks: [
{
icon: 'github',
link: 'https://github.com/nextcloud/nextcloud-vue'
}
],
},

srcDir: '../docs',
outDir: './build',
srcDir: '../docs',
outDir: './build',

markdown: {
highlight: (str, language, attr) => `<pre ${attr} v-pre><code>${hljs.highlight(str, { language: language === 'vue' || language === '' ? 'xml' : language}).value}</code></pre>`
},
markdown: {
highlight: (str, language, attr) => `<pre ${attr} v-pre><code>${hljs.highlight(str, { language: language === 'vue' || language === '' ? 'xml' : language }).value}</code></pre>`
},

vite: {
root: docsPath,
plugins: [ SearchPlugin() ],
resolve: {
alias: [
{
find: 'vue/server-renderer',
replacement: "node_modules/vue/server-renderer/index.mjs"
},
{
find: '@vue/server-renderer',
replacement: "node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js"
}
]
}
}
vite: {
root: docsPath,
plugins: [SearchPlugin()],
resolve: {
alias: [
{
find: 'vue/server-renderer',
replacement: "node_modules/vue/server-renderer/index.mjs"
},
{
find: '@vue/server-renderer',
replacement: "node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js"
}
]
}
}
})
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*
* Provide some nextcloud-server functions when using components on the vitepress documentation
*/

/* eslint-disable-next-line */
import 'core-js/stable'
/* eslint-disable-next-line */
import 'regenerator-runtime/runtime'
import Vue from 'vue'
import VTooltip from './../src/directives/Tooltip'
import VTooltip from '../../../src/directives/Tooltip'

/**
* From server util.js
Expand Down

0 comments on commit 82fcfa7

Please sign in to comment.