Skip to content

Commit aad7dca

Browse files
committed
fix lint errors
Signed-off-by: Ca Chen <[email protected]>
1 parent ac7a229 commit aad7dca

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1+
/* global $ */
2+
13
import './css/i.css'
24
import dotEmpty from './svg/dotEmpty.svg'
3-
import dotEmpty_h from './svg/dotEmpty_h.svg'
5+
import dotEmptyH from './svg/dotEmpty_h.svg'
46
import dot from './svg/dot.svg'
5-
import dot_h from './svg/dot_h.svg'
7+
import dotH from './svg/dot_h.svg'
68
import dotWideLeft from './svg/dotWideLeft.svg'
79
import dotWideRight from './svg/dotWideRight.svg'
810
import dotWideMiddle from './svg/dotWideMiddle.svg'
9-
import string_o from './svg/string_o.svg'
10-
import string_x from './svg/string_x.svg'
11+
import stringO from './svg/string_o.svg'
12+
import stringX from './svg/string_x.svg'
1113

12-
const switchList_v = {
13-
'o': `<div class='cell dot'>${dot}</div>`,
14+
const switchListV = {
15+
o: `<div class='cell dot'>${dot}</div>`,
1416
'*': `<div class='cell dot faded'>${dot}</div>`,
1517
'(': `<div class='cell'>${dotWideLeft}</div>`,
1618
')': `<div class='cell'>${dotWideRight}</div>`,
1719
'=': `<div class='cell'>${dotWideMiddle}</div>`,
18-
'^': `<div class='cell'>${string_o}</div>`,
19-
'x': `<div class='cell'>${string_x}</div>`,
20+
'^': `<div class='cell'>${stringO}</div>`,
21+
x: `<div class='cell'>${stringX}</div>`,
2022
'|': `<div class='cell empty'>${dotEmpty}</div>`,
2123
' ': `<div class='cell empty'>${dotEmpty}</div>`
2224
}
23-
const switchList_h = {
24-
'o': `<div class='cell dot'>${dot_h}</div>`,
25-
'*': `<div class='cell dot faded'>${dot_h}</div>`,
26-
'O': `<div class='cell dot root'>${dot_h}</div>`,
27-
'-': `<div class='cell empty'>${dotEmpty_h}</div>`,
28-
' ': `<div class='cell empty'>${dotEmpty_h}</div>`
25+
const switchListH = {
26+
o: `<div class='cell dot'>${dotH}</div>`,
27+
'*': `<div class='cell dot faded'>${dotH}</div>`,
28+
O: `<div class='cell dot root'>${dotH}</div>`,
29+
'-': `<div class='cell empty'>${dotEmptyH}</div>`,
30+
' ': `<div class='cell empty'>${dotEmptyH}</div>`
2931
}
3032

31-
let getArgument = (argName, content) => {
32-
let lineOfContent = content.data.split('\n')
33+
const getArgument = (argName, content) => {
34+
const lineOfContent = content.data.split('\n')
3335

3436
let argv = ''
35-
let indexOfArg = ''
3637
let idx = ''
3738
for (idx in lineOfContent) {
3839
if (lineOfContent[idx].startsWith(argName)) {
@@ -48,38 +49,38 @@ let getArgument = (argName, content) => {
4849
}
4950

5051
export const renderFretBoard = (data) => {
51-
let fretboardHTML = $('<div class="fretboard_instance"></div>')
52+
const fretboardHTML = $('<div class="fretboard_instance"></div>')
5253

5354
// parsing arguments
54-
let content = { 'data': data }
55-
let getTitle = getArgument('title:', content)
56-
let fretType = getArgument('type:', content).split(' ')
55+
let content = { data: data }
56+
const getTitle = getArgument('title:', content)
57+
const fretType = getArgument('type:', content).split(' ')
5758
content = content.data
5859

5960
$(fretboardHTML).append($(`<div class="fretTitle">${getTitle}</div>`))
6061

6162
// create fretboard background HTML
62-
let fretb_orientation = fretType && fretType[0].startsWith('v') ? 'vert' : 'horiz'
63-
let fretb_len = fretType && fretType[0].substring(1)
64-
let fretb_class = fretType && fretType[0][0] + ' ' + fretType[0]
65-
let nut = (fretType[1] && fretType[1] === 'noNut')?'noNut':''
66-
let svgHTML = $(`<div class="svg_wrapper ${fretb_class} ${nut}"></div>`)
67-
let fretb_bg = require(`./svg/fretb_${fretb_orientation}_${fretb_len}.svg`)
68-
$(svgHTML).append($(fretb_bg))
63+
const fretbOrientation = fretType && fretType[0].startsWith('v') ? 'vert' : 'horiz'
64+
const fretbLen = fretType && fretType[0].substring(1)
65+
const fretbClass = fretType && fretType[0][0] + ' ' + fretType[0]
66+
const nut = (fretType[1] && fretType[1] === 'noNut') ? 'noNut' : ''
67+
const svgHTML = $(`<div class="svg_wrapper ${fretbClass} ${nut}"></div>`)
68+
const fretbBg = require(`./svg/fretb_${fretbOrientation}_${fretbLen}.svg`)
69+
$(svgHTML).append($(fretbBg))
6970

7071
// create cells HTML
71-
let cellsHTML = $('<div class="cells"></div>')
72-
let switchList = fretb_orientation && fretb_orientation === 'vert' ? switchList_v : switchList_h
73-
let contentCell = content && content.split('')
72+
const cellsHTML = $('<div class="cells"></div>')
73+
const switchList = fretbOrientation && fretbOrientation === 'vert' ? switchListV : switchListH
74+
const contentCell = content && content.split('')
7475
// Go through each ASCII character...
7576
contentCell && contentCell.forEach(char => {
7677
if (switchList[char] !== undefined) {
77-
cellsHTML.append($(switchList[char]));
78+
cellsHTML.append($(switchList[char]))
7879
}
7980
})
8081

8182
$(svgHTML).append($(cellsHTML))
8283
$(fretboardHTML).append($(svgHTML))
8384

8485
return fretboardHTML[0].outerHTML
85-
}
86+
}

0 commit comments

Comments
 (0)