Skip to content

Commit 280dec8

Browse files
chore: minor tweaks and fixes (bootstrap-vue#4760)
* Remove redundant default values * Seperate events utils, add `eventOnOff()` util and fix `parseEventOptions()` capture option handling * Remove all unused vars * `opts` => `options` * Correct typo in table docs * Update tabs.js * Update bv-hover-swap.js * Update bv-hover-swap.js * Update bv-hover-swap.spec.js * Update jumbotron.js * `hte` => `the` * Update common-props.json * Update events.spec.js Co-authored-by: Troy Morehouse <troymore@nbnet.nb.ca>
1 parent 7a34f73 commit 280dec8

File tree

89 files changed

+389
-422
lines changed

Some content is hidden

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

89 files changed

+389
-422
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ module.exports = {
1414
Vue: true
1515
},
1616
rules: {
17+
'no-unused-vars': [
18+
'error',
19+
{
20+
vars: 'all',
21+
args: 'after-used',
22+
ignoreRestSiblings: false
23+
}
24+
],
1725
'spaced-comment': 'off', // needed to ignore `/*#__PURE__*/` comments
1826
'vue/html-self-closing': [
1927
'error',

docs/common-props.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"description": "Sets the 'placeholder' attribute value on the form control"
127127
},
128128
"readonly": {
129-
"description": "Sets the 'readonly' attribute on hte form control"
129+
"description": "Sets the 'readonly' attribute on the form control"
130130
},
131131
"plaintext": {
132132
"description": "Set the form control as readonly and renders the control to look like plain text (no borders)"

docs/markdown/reference/images/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ In your `nuxt.config.js` file, add the following to your build section:
9797
```js
9898
module.exports = {
9999
build: {
100-
extend(config, ctx) {
100+
extend(config) {
101101
const vueLoader = config.module.rules.find(rule => rule.loader === 'vue-loader')
102102
vueLoader.options.transformAssetUrls = {
103103
video: ['src', 'poster'],

docs/nuxt.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ renderer.blockquote = function(text) {
9999

100100
// Bootstrap v4 table support for markdown renderer
101101
const originalTable = renderer.table
102-
renderer.table = function(header, body) {
102+
renderer.table = function() {
103103
let table = originalTable.apply(this, arguments)
104104
table = table
105105
.replace('<table>', '<table class="b-table table table-bordered table-striped bv-docs-table">')

docs/pages/play.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,15 @@ export default {
597597
// appData watcher
598598
this.contentUnWatch = this.$watch(
599599
'appData',
600-
(newVal, oldVal) => {
600+
() => {
601601
this.run()
602602
},
603603
{ deep: true }
604604
)
605605
// Javascript watcher
606606
this.jsUnWatch = this.$watch(
607607
() => this.js.trim(),
608-
(newVal, oldVal) => {
608+
() => {
609609
this.compileJs()
610610
},
611611
{ immediate: true }

docs/plugins/play.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const destroyVM = (name, vm) => {
8686
;[...document.querySelectorAll(`.vue-example-${name}`)].forEach(removeNode)
8787
}
8888

89-
const processExamples = (el, binding, vnode, oldVnode) => {
89+
const processExamples = (el, binding, vnode) => {
9090
if (vnode.context.$options.beforeDestroy) {
9191
vnode.context.$options.beforeDestroy = []
9292
.concat(vnode.context.$options.beforeDestroy)

docs/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const makeTOC = (readme, meta = null) => {
113113
// Filter out un-matched values
114114
.filter(v => Array.isArray(v))
115115
// Create TOC structure
116-
.forEach(([value, tag, id, content]) => {
116+
.forEach(([, tag, id, content]) => {
117117
const href = `#${stripQuotes(id)}`
118118
const label = stripHTML(content)
119119
if (tag === 'h2') {

nuxt/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module.exports = function nuxtBootstrapVue(moduleOptions = {}) {
9292
if (!usePretranspiled) {
9393
// Use bootstrap-vue source code for smaller prod builds
9494
// by aliasing 'bootstrap-vue' to the source files
95-
this.extendBuild((config, { isServer }) => {
95+
this.extendBuild(config => {
9696
if (!config.resolve.alias) {
9797
config.resolve.alias = {}
9898
}

scripts/postcss.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = ctx => ({
1+
module.exports = () => ({
22
map: {
33
inline: false,
44
annotation: true,

src/components/button-toolbar/button-toolbar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const BButtonToolbar = /*#__PURE__*/ Vue.extend({
6161
setItemFocus(item) {
6262
item && item.focus && item.focus()
6363
},
64-
focusFirst(evt) {
64+
focusFirst() {
6565
const items = this.getItems()
6666
this.setItemFocus(items[0])
6767
},
@@ -81,7 +81,7 @@ export const BButtonToolbar = /*#__PURE__*/ Vue.extend({
8181
this.setItemFocus(items[0])
8282
}
8383
},
84-
focusLast(evt) {
84+
focusLast() {
8585
const items = this.getItems().reverse()
8686
this.setItemFocus(items[0])
8787
},

src/components/button-toolbar/button-toolbar.spec.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,9 @@ describe('button-toolbar', () => {
8585
const App = Vue.extend({
8686
render(h) {
8787
return h(BButtonToolbar, { props: { keyNav: true } }, [
88-
h(BButtonGroup, {}, [h(BButton, {}, 'a'), h(BButton, {}, 'b')]),
89-
h(BButtonGroup, {}, [
90-
h(BButton, { props: { disabled: true } }, 'c'),
91-
h(BButton, {}, 'd')
92-
]),
93-
h(BButtonGroup, {}, [h(BButton, {}, 'e'), h(BButton, {}, 'f')])
88+
h(BButtonGroup, [h(BButton, 'a'), h(BButton, 'b')]),
89+
h(BButtonGroup, [h(BButton, { props: { disabled: true } }, 'c'), h(BButton, 'd')]),
90+
h(BButtonGroup, [h(BButton, 'e'), h(BButton, 'f')])
9491
])
9592
}
9693
})

src/components/button/button-close.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const BButtonClose = /*#__PURE__*/ Vue.extend({
3030
name: NAME,
3131
functional: true,
3232
props,
33-
render(h, { props, data, listeners, slots, scopedSlots }) {
33+
render(h, { props, data, slots, scopedSlots }) {
3434
const $slots = slots()
3535
const $scopedSlots = scopedSlots || {}
3636

src/components/button/button.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('button', () => {
208208
disabled: true
209209
},
210210
listeners: {
211-
click: e => {
211+
click: () => {
212212
called++
213213
}
214214
}

src/components/carousel/carousel.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@ import KeyCodes from '../../utils/key-codes'
33
import noop from '../../utils/noop'
44
import observeDom from '../../utils/observe-dom'
55
import { getComponentConfig } from '../../utils/config'
6-
import {
7-
selectAll,
8-
reflow,
9-
addClass,
10-
removeClass,
11-
setAttr,
12-
eventOn,
13-
eventOff
14-
} from '../../utils/dom'
6+
import { selectAll, reflow, addClass, removeClass, setAttr } from '../../utils/dom'
157
import { isBrowser, hasTouchSupport, hasPointerEventSupport } from '../../utils/env'
8+
import { EVENT_OPTIONS_NO_CAPTURE, eventOn, eventOff } from '../../utils/events'
169
import { isUndefined } from '../../utils/inspect'
1710
import { toInteger } from '../../utils/number'
1811
import idMixin from '../../mixins/id'
@@ -55,8 +48,6 @@ const TransitionEndEvents = {
5548
transition: 'transitionend'
5649
}
5750

58-
const EventOptions = { passive: true, capture: false }
59-
6051
// Return the browser specific transitionEnd event name
6152
const getTransitionEndEvent = el => {
6253
for (const name in TransitionEndEvents) {
@@ -308,7 +299,7 @@ export const BCarousel = /*#__PURE__*/ Vue.extend({
308299
}
309300
},
310301
// Restart auto rotate slides when focus/hover leaves the carousel
311-
restart(evt) /* istanbul ignore next: difficult to test */ {
302+
restart() /* istanbul ignore next: difficult to test */ {
312303
if (!this.$el.contains(document.activeElement)) {
313304
this.start()
314305
}
@@ -350,15 +341,17 @@ export const BCarousel = /*#__PURE__*/ Vue.extend({
350341
// Transition End handler
351342
let called = false
352343
/* istanbul ignore next: difficult to test */
353-
const onceTransEnd = evt => {
344+
const onceTransEnd = () => {
354345
if (called) {
355346
return
356347
}
357348
called = true
358349
/* istanbul ignore if: transition events cant be tested in JSDOM */
359350
if (this.transitionEndEvent) {
360351
const events = this.transitionEndEvent.split(/\s+/)
361-
events.forEach(evt => eventOff(currentSlide, evt, onceTransEnd, EventOptions))
352+
events.forEach(evt =>
353+
eventOff(currentSlide, evt, onceTransEnd, EVENT_OPTIONS_NO_CAPTURE)
354+
)
362355
}
363356
this._animationTimeout = null
364357
removeClass(nextSlide, dirClass)
@@ -380,7 +373,9 @@ export const BCarousel = /*#__PURE__*/ Vue.extend({
380373
/* istanbul ignore if: transition events cant be tested in JSDOM */
381374
if (this.transitionEndEvent) {
382375
const events = this.transitionEndEvent.split(/\s+/)
383-
events.forEach(event => eventOn(currentSlide, event, onceTransEnd, EventOptions))
376+
events.forEach(event =>
377+
eventOn(currentSlide, event, onceTransEnd, EVENT_OPTIONS_NO_CAPTURE)
378+
)
384379
}
385380
// Fallback to setTimeout()
386381
this._animationTimeout = setTimeout(onceTransEnd, TRANS_DURATION)

src/components/carousel/carousel.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ const appDef = {
3232
}
3333
},
3434
[
35-
h(BCarouselSlide, {}, 'slide 1'),
36-
h(BCarouselSlide, {}, 'slide 2'),
37-
h(BCarouselSlide, {}, 'slide 3'),
38-
h(BCarouselSlide, {}, 'slide 4')
35+
h(BCarouselSlide, 'slide 1'),
36+
h(BCarouselSlide, 'slide 2'),
37+
h(BCarouselSlide, 'slide 3'),
38+
h(BCarouselSlide, 'slide 4')
3939
]
4040
)
4141
}

src/components/carousel/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"prop": "noHoverPause",
39-
"description": "When set, disables the pausing of hte slide show when the current slide is hovered"
39+
"description": "When set, disables the pausing of the slide show when the current slide is hovered"
4040
},
4141
{
4242
"prop": "interval",

src/components/collapse/collapse.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
import Vue from '../../utils/vue'
2+
import { isBrowser } from '../../utils/env'
3+
import { addClass, hasClass, removeClass, closest, matches, getCS } from '../../utils/dom'
4+
import { EVENT_OPTIONS_NO_CAPTURE, eventOnOff } from '../../utils/events'
5+
import { BVCollapse } from '../../utils/bv-collapse'
26
import idMixin from '../../mixins/id'
37
import listenOnRootMixin from '../../mixins/listen-on-root'
48
import normalizeSlotMixin from '../../mixins/normalize-slot'
5-
import { isBrowser } from '../../utils/env'
6-
import { BVCollapse } from '../../utils/bv-collapse'
7-
import {
8-
addClass,
9-
hasClass,
10-
removeClass,
11-
closest,
12-
matches,
13-
getCS,
14-
eventOn,
15-
eventOff
16-
} from '../../utils/dom'
179

1810
// Events we emit on $root
1911
const EVENT_STATE = 'bv::collapse::state'
@@ -26,9 +18,6 @@ const EVENT_STATE_SYNC = 'bv::collapse::sync::state'
2618
const EVENT_TOGGLE = 'bv::toggle::collapse'
2719
const EVENT_STATE_REQUEST = 'bv::request::collapse::state'
2820

29-
// Event listener options
30-
const EventOptions = { passive: true, capture: false }
31-
3221
// @vue/component
3322
export const BCollapse = /*#__PURE__*/ Vue.extend({
3423
name: 'BCollapse',
@@ -137,28 +126,27 @@ export const BCollapse = /*#__PURE__*/ Vue.extend({
137126
},
138127
methods: {
139128
setWindowEvents(on) {
140-
const method = on ? eventOn : eventOff
141-
method(window, 'resize', this.handleResize, EventOptions)
142-
method(window, 'orientationchange', this.handleResize, EventOptions)
129+
eventOnOff(on, window, 'resize', this.handleResize, EVENT_OPTIONS_NO_CAPTURE)
130+
eventOnOff(on, window, 'orientationchange', this.handleResize, EVENT_OPTIONS_NO_CAPTURE)
143131
},
144132
toggle() {
145133
this.show = !this.show
146134
},
147-
onEnter(el) {
135+
onEnter() {
148136
this.transitioning = true
149137
// This should be moved out so we can add cancellable events
150138
this.$emit('show')
151139
},
152-
onAfterEnter(el) {
140+
onAfterEnter() {
153141
this.transitioning = false
154142
this.$emit('shown')
155143
},
156-
onLeave(el) {
144+
onLeave() {
157145
this.transitioning = true
158146
// This should be moved out so we can add cancellable events
159147
this.$emit('hide')
160148
},
161-
onAfterLeave(el) {
149+
onAfterLeave() {
162150
this.transitioning = false
163151
this.$emit('hidden')
164152
},

src/components/collapse/collapse.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ describe('collapse', () => {
411411
const localVue = CreateLocalVue()
412412
const App = localVue.extend({
413413
render(h) {
414-
return h('div', {}, [
414+
return h('div', [
415415
// JSDOM supports getComputedStyle when using stylesheets (non responsive)
416416
// https://github.com/jsdom/jsdom/blob/master/Changelog.md#030
417417
h('style', { attrs: { type: 'text/css' } }, '.collapse:not(.show) { display: none; }'),
@@ -471,7 +471,7 @@ describe('collapse', () => {
471471
const localVue = CreateLocalVue()
472472
const App = localVue.extend({
473473
render(h) {
474-
return h('div', {}, [
474+
return h('div', [
475475
// JSDOM supports getComputedStyle when using stylesheets (non responsive)
476476
// Although it appears to be picky about CSS definition ordering
477477
// https://github.com/jsdom/jsdom/blob/master/Changelog.md#030

src/components/collapse/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"props": [
2525
{
2626
"prop": "isNav",
27-
"description": "When set, signifies that hte collapse is bart of a navbar, enabling certain features for navbar support"
27+
"description": "When set, signifies that the collapse is bart of a navbar, enabling certain features for navbar support"
2828
},
2929
{
3030
"prop": "accordion",

src/components/dropdown/dropdown-item.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('dropdown-item', () => {
9696
const App = localVue.extend({
9797
router,
9898
render(h) {
99-
return h('ul', {}, [
99+
return h('ul', [
100100
// router-link
101101
h(BDropdownItem, { props: { to: '/a' } }, ['to-a']),
102102
// regular link

src/components/dropdown/dropdown.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ describe('dropdown', () => {
433433
const App = localVue.extend({
434434
render(h) {
435435
return h('div', { attrs: { id: 'container' } }, [
436-
h(BDropdown, { props: { id: 'test' } }, [h(BDropdownItem, {}, 'item')]),
436+
h(BDropdown, { props: { id: 'test' } }, [h(BDropdownItem, 'item')]),
437437
h('input', { attrs: { id: 'input' } })
438438
])
439439
}
@@ -666,7 +666,7 @@ describe('dropdown', () => {
666666
const localVue = new CreateLocalVue()
667667
const App = localVue.extend({
668668
render(h) {
669-
return h('div', {}, [
669+
return h('div', [
670670
h(BDropdown, { props: { id: 'test' } }, [
671671
h(BDropdownItem, { attrs: { id: 'item-1' } }, 'item'),
672672
h(BDropdownItem, { attrs: { id: 'item-2' } }, 'item'),

src/components/form-checkbox/form-checkbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ export const BFormCheckbox = /*#__PURE__*/ Vue.extend({
6868
}
6969
},
7070
watch: {
71-
computedLocalChecked(newVal, oldVal) {
71+
computedLocalChecked(newVal) {
7272
this.$emit('input', newVal)
7373
if (this.$refs && this.$refs.input) {
7474
this.$emit('update:indeterminate', this.$refs.input.indeterminate)
7575
}
7676
},
77-
indeterminate(newVal, oldVal) {
77+
indeterminate(newVal) {
7878
this.setIndeterminate(newVal)
7979
}
8080
},

src/components/form-group/form-group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ export const BFormGroup = {
447447
return h(
448448
isFieldset ? 'fieldset' : isHorizontal ? BFormRow : 'div',
449449
data,
450-
isHorizontal && isFieldset ? [h(BFormRow, {}, [label, content])] : [label, content]
450+
isHorizontal && isFieldset ? [h(BFormRow, [label, content])] : [label, content]
451451
)
452452
}
453453
}

0 commit comments

Comments
 (0)