Skip to content

fix(docs): drop self-closing tags + build system improvements (fixes #2882) #2893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.nuxt/
dist/
docs-dist/
es/
node_modules/
nuxt/plugin.template.js
12 changes: 11 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['standard', 'plugin:vue/recommended', 'plugin:prettier/recommended'],
plugins: ['jest', 'node', 'promise'],
plugins: ['jest', 'markdown', 'node', 'promise'],
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
Expand All @@ -14,6 +14,16 @@ module.exports = {
Vue: true
},
rules: {
'vue/html-self-closing': [
'error',
{
html: {
void: 'never',
normal: 'never',
component: 'never'
}
}
],
'vue/max-attributes-per-line': ['error', { singleline: 4 }],
'vue/no-template-shadow': 'off',
'vue/no-use-v-if-with-v-for': 'off',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Thank you to all our backers! 🙏

This project exists thanks to all the people who contribute. [[Contribute]](CONTRIBUTING.md).

<a href="https://github.com/bootstrap-vue/bootstrap-vue/graphs/contributors"><img src="https://opencollective.com/bootstrap-vue/contributors.svg?width=890" /></a>
<a href="https://github.com/bootstrap-vue/bootstrap-vue/graphs/contributors"><img src="https://opencollective.com/bootstrap-vue/contributors.svg?width=890"></a>

<h2 align="center">License</h2>

Expand Down
9 changes: 7 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
module.exports = function(api) {
module.exports = api => {
const isDocs = api.env('docs')

let presets = []
if (!isDocs) {
presets.push(['@babel/env', { useBuiltIns: 'entry', corejs: { version: 2 } }])
}

return {
presets: isDocs ? [] : [['@babel/env', { useBuiltIns: 'entry', corejs: { version: 2 } }]],
presets,
env: {
es: {
plugins: [['@babel/plugin-transform-modules-commonjs', { noInterop: true, loose: true }]]
Expand Down
2 changes: 1 addition & 1 deletion docs/components/codemirror.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<textarea ref="textArea" :value="value" />
<textarea ref="textArea" :value="value"></textarea>
</template>

<script>
Expand Down
25 changes: 9 additions & 16 deletions docs/components/componentdoc.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<template>
<section
v-if="component"
class="bd-content"
>
<section v-if="component" class="bd-content">
<b-row tag="header" align-v="center">
<b-col sm="9">
<anchored-heading :id="`comp-ref-${componentName}`" level="2">
Expand Down Expand Up @@ -44,7 +41,7 @@
<b-badge variant="warning">
{{ typeof item.deprecated === 'string' ? 'deprecation' : 'deprecated' }}
</b-badge>
<!-- if deprecated is a string, show the string value -->
<!-- If deprecated is a string, show the string value -->
<small v-if="typeof item.deprecated === 'string'">{{ item.deprecated }}</small>
</template>
<template slot="defaultValue" slot-scope="{ value }">
Expand Down Expand Up @@ -83,7 +80,7 @@
small
head-variant="default"
striped
/>
></b-table>
</article>

<article v-if="events && events.length > 0">
Expand Down Expand Up @@ -113,7 +110,10 @@
<anchored-heading :id="`comp-ref-${componentName}-rootEventListeners`" level="4">
$root Event Listeners
</anchored-heading>
<p>You can control <code>{{ tag }}</code> by emitting the following events on <samp>$root</samp>:</p>
<p>
You can control <code>{{ tag }}</code> by emitting the following events on
<samp>$root</samp>:
</p>
<b-table
:items="rootEventListeners"
:fields="rootEventListenersFields"
Expand Down Expand Up @@ -151,9 +151,7 @@ import kebabCase from 'lodash/kebabCase'
import AnchoredHeading from './anchored-heading'

export default {
components: {
AnchoredHeading
},
components: { AnchoredHeading },
props: {
component: {},
slots: {
Expand Down Expand Up @@ -206,7 +204,6 @@ export default {
},
propsFields() {
const props = this.componentProps

const hasRequired = Object.keys(props).some(p => props[p].required)

const fields = [
Expand Down Expand Up @@ -259,19 +256,15 @@ export default {

// Describe value
let defaultVal = p.default

if (defaultVal instanceof Function && !Array.isArray(defaultVal)) {
defaultVal = defaultVal()
}

if (typeof defaultVal !== 'string') {
defaultVal = JSON.stringify(defaultVal)
}

if (defaultVal === '' || defaultVal === null || defaultVal === 'null') {
defaultVal = ''
}

defaultVal = (defaultVal || '').replace(/"/g, "'")

// Requied prop?
Expand All @@ -294,7 +287,7 @@ export default {
return kebabCase(this.component)
},
tag() {
return '<' + this.componentName + '>'
return `<${this.componentName}>`
},
githubURL() {
const base = 'https://github.com/bootstrap-vue/bootstrap-vue/tree/dev/src/components'
Expand Down
12 changes: 5 additions & 7 deletions docs/components/importdoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<p><strong>Example:</strong></p>

<pre class="hljs js text-monospace p-2"><code v-html="componentImportCode" /></pre>
<pre class="hljs js text-monospace p-2"><code v-html="componentImportCode"></code></pre>
</article>
</template>

Expand All @@ -41,7 +41,7 @@

<p><strong>Example:</strong></p>

<pre class="hljs js text-monospace p-2"><code v-html="directiveImportCode" /></pre>
<pre class="hljs js text-monospace p-2"><code v-html="directiveImportCode"></code></pre>
</article>
</template>

Expand All @@ -59,7 +59,7 @@
This plugin includes all of the above listed individual directives.
</p>

<pre class="hljs js text-monospace p-2"><code v-html="pluginImportCode" /></pre>
<pre class="hljs js text-monospace p-2"><code v-html="pluginImportCode"></code></pre>

<template v-if="meta.plugins && meta.plugins.length > 0">
<p>This plugin also automatically includes the following plugins:</p>
Expand All @@ -72,15 +72,13 @@
</template>

<script>
import hljs from 'highlightjs'
import kebabCase from 'lodash/kebabCase'
import startCase from 'lodash/startCase'
import hljs from 'highlightjs'
import AnchoredHeading from './anchored-heading'

export default {
components: {
AnchoredHeading
},
components: { AnchoredHeading },
props: {
meta: {}
},
Expand Down
33 changes: 11 additions & 22 deletions docs/components/jsfiddle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
:allowtransparency="true"
frameborder="0"
:src="src"
/>
<div
v-if="height === 0"
class="text-center"
>
></iframe>
<div v-if="height === 0" class="text-center">
<img src="//jsfiddle.net/img/embeddable/logo-dark.png" alt="jsfiddle">
<br>
<small class="text-muted mt-1">
Expand Down Expand Up @@ -66,13 +63,14 @@ export default {
},
computed: {
src() {
let url = `//jsfiddle.net/${this.slug}/embedded/${this.tabs}/${this.theme}?`
;['fontColor', 'accentColor', 'bodyColor', 'menuColor'].forEach(attr => {
const attrs = ['fontColor', 'accentColor', 'bodyColor', 'menuColor']
const baseUrl = `//jsfiddle.net/${this.slug}/embedded/${this.tabs}/${this.theme}?`
return attrs.reduce((url, attr) => {
if (this[attr] && this[attr].length > 0) {
url += `${attr}=${this[attr]}&`
}
})
return url
return url
}, baseUrl)
},
url() {
return `//jsfiddle.net/${this.slug}`
Expand All @@ -90,23 +88,14 @@ export default {
},
methods: {
setHeight(data) {
let height
if (this.slug === data.slug) {
height = data.height <= 0 ? 400 : data.height + 50
this.height = height
return height
this.height = data.height <= 0 ? 400 : data.height + 50
}
},
onMessage(event) {
const eventName = event.data[0]
const data = event.data[1]
switch (eventName) {
case 'embed':
return this.setHeight(data)
case 'resultsFrame':
return this.setHeight(data)
default:
break
const [eventName, data] = event.data
if (eventName === 'embed' || eventName === 'resultsFrame') {
this.setHeight(data)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/components/nav.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<b-navbar toggleable="md" class="navbar-dark bd-navbar" sticky>
<b-navbar-toggle target="bd-main-nav" />
<b-navbar-toggle target="bd-main-nav"></b-navbar-toggle>

<b-navbar-brand to="/" exact>
<svg
Expand Down Expand Up @@ -110,7 +110,7 @@
scrolling="0"
width="100px"
height="20px"
/>
></iframe>
</div>
</b-navbar-nav>
</b-collapse>
Expand Down
Loading