Skip to content

Commit efaf792

Browse files
committed
Clean up code.
Early return vs variable creation and return. Avoid commented code to don't report parameters as not used
1 parent e606847 commit efaf792

File tree

4 files changed

+12
-44
lines changed

4 files changed

+12
-44
lines changed

src/App.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,11 +2091,11 @@ export default defineComponent({
20912091
tag === tag.toLowerCase() && tag.length > 2 && tag.length < 6
20922092
20932093
function onTagState(valid: string[], invalid: string[], duplicate: string[]) {
2094-
// console.log({
2095-
// valid,
2096-
// invalid,
2097-
// duplicate,
2098-
// })
2094+
console.log({
2095+
valid,
2096+
invalid,
2097+
duplicate,
2098+
})
20992099
}
21002100
21012101
return {

src/components/BAvatar/BAvatar.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ const onImgError = (e: Event): void => emit('img-error', e)
200200
</script>
201201

202202
<script lang="ts">
203-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
204203
export const computeSize = (value: any): string | null => {
205204
const calcValue = isString(value) && isNumeric(value) ? toFloat(value, 0) : value
206205
return isNumber(calcValue) ? `${calcValue}px` : calcValue || null

src/components/BPagination/BPagination.vue

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default defineComponent({
7575
)
7676
7777
const startNumber = computed(() => {
78-
let lStartNumber = 1
78+
let lStartNumber: number
7979
const pagesLeft: number = numberOfPages.value - props.modelValue
8080
8181
if (pagesLeft + 2 < props.limit && props.limit > ELLIPSIS_THRESHOLD) {
@@ -156,21 +156,6 @@ export default defineComponent({
156156
return n
157157
})
158158
159-
const pageNumberfinal = computed(() => {
160-
let n: number = numberOfLinks.value
161-
162-
if (showFirstDots.value && props.firstNumber && startNumber.value < 4) {
163-
n = n + 2
164-
}
165-
const lastPageNumber = startNumber.value + n - 1
166-
167-
if (showLastDots.value && props.lastNumber && lastPageNumber > numberOfPages.value - 3) {
168-
n = n + (lastPageNumber === numberOfPages.value - 2 ? 2 : 3)
169-
}
170-
n = Math.min(n, numberOfPages.value - startNumber.value + 1)
171-
return n
172-
})
173-
174159
const showLastDots = computed(() => {
175160
const paginationWindowEnd = numberOfPages.value - numberOfLinks.value // The start of the last window of page links
176161
@@ -474,7 +459,8 @@ export default defineComponent({
474459
buttons.push(gotoLastPageButton)
475460
}
476461
477-
const $pagination = h(
462+
//pagination
463+
return h(
478464
'ul',
479465
{
480466
'class': ['pagination', btnSize.value, alignment.value, styleClass.value],
@@ -484,7 +470,6 @@ export default defineComponent({
484470
},
485471
buttons
486472
)
487-
return $pagination
488473
}
489474
},
490475
})

src/components/BToast/BToast.vue

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default defineComponent({
6464
let resumeDismiss: number
6565
6666
const clearDismissTimer = () => {
67-
if (dismissTimer === undefined) return
67+
if (typeof dismissTimer === 'undefined') return
6868
clearTimeout(dismissTimer)
6969
dismissTimer = undefined
7070
}
@@ -121,14 +121,6 @@ export default defineComponent({
121121
startDismissTimer()
122122
}
123123
124-
const toggle = () => {
125-
if (props.modelValue) {
126-
hide()
127-
} else {
128-
show()
129-
}
130-
}
131-
132124
watch(
133125
() => props.modelValue,
134126
(newValue) => {
@@ -165,15 +157,8 @@ export default defineComponent({
165157
emit('update:modelValue', false)
166158
}
167159
168-
const transitionHandlers = computed(() => ({
169-
OnBeforeEnter,
170-
OnAfterEnter,
171-
OnBeforeLeave,
172-
OnAfterLeave,
173-
}))
174-
175160
onUnmounted(() => {
176-
//if there is time left on autohide or no autohide then keep toast alive
161+
//if there is time left on autoHide or no autoHide then keep toast alive
177162
clearDismissTimer()
178163
if (!props.autoHide) {
179164
return
@@ -255,7 +240,8 @@ export default defineComponent({
255240
$innertoast
256241
)
257242
}
258-
const $toast = h(
243+
//toast
244+
return h(
259245
'div',
260246
{
261247
'class': ['b-toast'],
@@ -280,8 +266,6 @@ export default defineComponent({
280266
),
281267
]
282268
)
283-
284-
return $toast
285269
}
286270
},
287271
})

0 commit comments

Comments
 (0)