Skip to content

Commit 81d676b

Browse files
committed
refactor: simplify
1 parent 99adcbc commit 81d676b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
'vue/attributes-order': 'error',
3636
'vue/order-in-components': 'error',
3737
'vue/html-indent': 'error',
38+
'vue/one-component-per-file': 'off',
3839
quotes: ['error', 'single']
3940
},
4041
overrides: [

src/library.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const createStdout = (formatterOrText, name = 'VueCommandStdout') => mark
6363

6464
render () {
6565
if (isFunction(formatterOrText)) {
66-
// This is automatically called with the given arguments
66+
// This is automatically called with the bound arguments
6767
return formatterOrText()
6868
}
6969

@@ -85,19 +85,17 @@ export const textFormatter = (text, innerHtml = false) => {
8585
// Creates a command not found component
8686
export const createCommandNotFound = (command, notFoundText = 'command not found', name = 'VueCommandNotFound') => {
8787
const text = `${command}: ${notFoundText}`
88-
return createStdout(textFormatter(text), name)
88+
return createStdout(text, name)
8989
}
9090

9191
// Creates a new query component
92-
// TODO Add name
9392
export const createQuery = () => markRaw(VueCommandQuery)
9493

9594
// A simple query parser which trims the query and splits the arguments by
9695
// spaces
9796
export const defaultParser = query => split(trim(query), ' ')
9897

9998
// Formats the given elements as a list
100-
// TODO Use HTML to enforce a new line
10199
export const listFormatter = (...lis) => {
102100
return () => {
103101
const ul = []
@@ -118,13 +116,11 @@ export const tableFormatter = rows => {
118116
const tbody = []
119117
forEach(rows, row => {
120118
const trs = []
121-
forEach(row, cell => {
122-
const td = h('td', cell)
123-
trs.push(td)
119+
forEach(row, td => {
120+
trs.push(h('td', td))
124121
})
125122

126-
const tr = h('tr', trs)
127-
tbody.push(tr)
123+
tbody.push(h('tr', trs))
128124
})
129125

130126
return h('table', tbody)

0 commit comments

Comments
 (0)