Skip to content

Commit 0fef160

Browse files
committed
lint
1 parent c8699d2 commit 0fef160

13 files changed

+169
-169
lines changed

browser/diffDOM.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/TraceLogger.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class TraceLogger {
6565
| number
6666
| boolean
6767
| false
68-
| (string | HTMLElement | number | boolean | false)[],
68+
| (string | HTMLElement | number | boolean | false)[]
6969
) {
7070
this.padding += this.pad
7171
this.log(`├─> entering ${fn}`, args)
@@ -79,12 +79,12 @@ export class TraceLogger {
7979
| number
8080
| boolean
8181
| false
82-
| (string | HTMLElement | number | boolean | false)[],
82+
| (string | HTMLElement | number | boolean | false)[]
8383
) {
8484
this.log("│<──┘ generated return value", result)
8585
this.padding = this.padding.substring(
8686
0,
87-
this.padding.length - this.pad.length,
87+
this.padding.length - this.pad.length
8888
)
8989
}
9090
// log message formatting
@@ -107,7 +107,7 @@ export class TraceLogger {
107107
| number
108108
| boolean
109109
| false
110-
| (string | HTMLElement | number | boolean | false)[],
110+
| (string | HTMLElement | number | boolean | false)[]
111111
) {
112112
if (!v) {
113113
return "<falsey>"

src/diffDOM/dom/apply.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { objToNode } from "./fromVirtual"
77

88
const getFromRoute = (
99
node: Element,
10-
route: number[],
10+
route: number[]
1111
): Element | Text | false => {
1212
route = route.slice()
1313
while (route.length > 0) {
@@ -20,15 +20,15 @@ const getFromRoute = (
2020
export function applyDiff(
2121
tree: Element,
2222
diff: diffType,
23-
options: DiffDOMOptions, // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}
23+
options: DiffDOMOptions // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}
2424
) {
2525
const action = diff[options._const.action] as string | number
2626
const route = diff[options._const.route] as number[]
2727
let node
2828

2929
if (
3030
![options._const.addElement, options._const.addTextElement].includes(
31-
action,
31+
action
3232
)
3333
) {
3434
// For adding nodes, we calculate the route later on. It's different because it includes the position of the newly added item.
@@ -56,7 +56,7 @@ export function applyDiff(
5656
}
5757
node.setAttribute(
5858
diff[options._const.name] as string,
59-
diff[options._const.value] as string,
59+
diff[options._const.value] as string
6060
)
6161
break
6262
case options._const.modifyAttribute:
@@ -65,7 +65,7 @@ export function applyDiff(
6565
}
6666
node.setAttribute(
6767
diff[options._const.name] as string,
68-
diff[options._const.newValue] as string,
68+
diff[options._const.newValue] as string
6969
)
7070
if (
7171
checkElementType(node, "HTMLInputElement") &&
@@ -88,7 +88,7 @@ export function applyDiff(
8888
node,
8989
node.data,
9090
diff[options._const.oldValue] as string,
91-
diff[options._const.newValue] as string,
91+
diff[options._const.newValue] as string
9292
)
9393
if (checkElementType(node.parentNode, "HTMLTextAreaElement")) {
9494
node.parentNode.value = diff[options._const.newValue] as string
@@ -108,7 +108,7 @@ export function applyDiff(
108108
node,
109109
node.data,
110110
diff[options._const.oldValue] as string,
111-
diff[options._const.newValue] as string,
111+
diff[options._const.newValue] as string
112112
)
113113
break
114114
case options._const.modifyChecked:
@@ -133,19 +133,19 @@ export function applyDiff(
133133
objToNode(
134134
diff[options._const.newValue] as nodeType,
135135
insideSvg,
136-
options,
136+
options
137137
),
138-
node,
138+
node
139139
)
140140
break
141141
}
142142
case options._const.relocateGroup:
143143
nodeArray = Array(
144-
...new Array(diff[options._const.groupLength]),
144+
...new Array(diff[options._const.groupLength])
145145
).map(() =>
146146
node.removeChild(
147-
node.childNodes[diff[options._const.from] as number],
148-
),
147+
node.childNodes[diff[options._const.from] as number]
148+
)
149149
)
150150
nodeArray.forEach((childNode, index) => {
151151
if (index === 0) {
@@ -169,9 +169,9 @@ export function applyDiff(
169169
objToNode(
170170
diff[options._const.element] as nodeType,
171171
node.namespaceURI === "http://www.w3.org/2000/svg",
172-
options,
172+
options
173173
),
174-
node.childNodes[c] || null,
174+
node.childNodes[c] || null
175175
)
176176
break
177177
}
@@ -190,7 +190,7 @@ export function applyDiff(
190190
const parentRoute = route.slice()
191191
const c: number = parentRoute.splice(parentRoute.length - 1, 1)[0]
192192
newNode = options.document.createTextNode(
193-
diff[options._const.value] as string,
193+
diff[options._const.value] as string
194194
)
195195
node = getFromRoute(tree, parentRoute)
196196
if (!node.childNodes) {
@@ -220,9 +220,9 @@ export function applyDiff(
220220
export function applyDOM(
221221
tree: Element,
222222
diffs: (Diff | diffType)[],
223-
options: DiffDOMOptions,
223+
options: DiffDOMOptions
224224
) {
225225
return diffs.every((diff: Diff | diffType) =>
226-
applyDiff(tree, diff as diffType, options),
226+
applyDiff(tree, diff as diffType, options)
227227
)
228228
}

src/diffDOM/dom/fromVirtual.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { checkElementType } from "../helpers"
44
export function objToNode(
55
objNode: elementNodeType,
66
insideSvg: boolean,
7-
options: DiffDOMOptions,
7+
options: DiffDOMOptions
88
) {
99
let node: Element | Text | Comment
1010
if (objNode.nodeName === "#text") {
@@ -15,30 +15,30 @@ export function objToNode(
1515
if (insideSvg) {
1616
node = options.document.createElementNS(
1717
"http://www.w3.org/2000/svg",
18-
objNode.nodeName,
18+
objNode.nodeName
1919
)
2020
if (objNode.nodeName === "foreignObject") {
2121
insideSvg = false
2222
}
2323
} else if (objNode.nodeName.toLowerCase() === "svg") {
2424
node = options.document.createElementNS(
2525
"http://www.w3.org/2000/svg",
26-
"svg",
26+
"svg"
2727
)
2828
insideSvg = true
2929
} else {
3030
node = options.document.createElement(objNode.nodeName)
3131
}
3232
if (objNode.attributes) {
3333
Object.entries(objNode.attributes).forEach(([key, value]) =>
34-
(node as Element).setAttribute(key, value),
34+
(node as Element).setAttribute(key, value)
3535
)
3636
}
3737
if (objNode.childNodes) {
3838
node = node as Element
3939
objNode.childNodes.forEach(
4040
(childNode: elementNodeType | textNodeType) =>
41-
node.appendChild(objToNode(childNode, insideSvg, options)),
41+
node.appendChild(objToNode(childNode, insideSvg, options))
4242
)
4343
}
4444
if (options.valueDiffing) {
@@ -53,7 +53,7 @@ export function objToNode(
5353
"HTMLMeterElement",
5454
"HTMLOptionElement",
5555
"HTMLProgressElement",
56-
"HTMLParamElement",
56+
"HTMLParamElement"
5757
)
5858
) {
5959
;(

src/diffDOM/dom/undo.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function swap(obj: object, p1: string | number, p2: string | number) {
1313
function undoDiff(
1414
tree: Element,
1515
diff: diffType,
16-
options: DiffDOMOptions, // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}
16+
options: DiffDOMOptions // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}
1717
) {
1818
switch (diff[options._const.action]) {
1919
case options._const.addAttribute:
@@ -80,7 +80,7 @@ function undoDiff(
8080
export function undoDOM(
8181
tree: Element,
8282
diffs: (diffType | Diff)[],
83-
options: DiffDOMOptions,
83+
options: DiffDOMOptions
8484
) {
8585
diffs = diffs.slice()
8686
diffs.reverse()

src/diffDOM/helpers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class Diff {
1717
| boolean
1818
| number[]
1919
| { [key: string]: string | { [key: string]: string } }
20-
| elementNodeType,
20+
| elementNodeType
2121
) {
2222
this[aKey] = aValue
2323
return this
@@ -35,6 +35,6 @@ export function checkElementType(element, ...elementTypeNames: string[]) {
3535
typeof element?.ownerDocument?.defaultView?.[elementTypeName] ===
3636
"function" &&
3737
element instanceof
38-
element.ownerDocument.defaultView[elementTypeName],
38+
element.ownerDocument.defaultView[elementTypeName]
3939
)
4040
}

src/diffDOM/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const DEFAULT_OPTIONS = {
2323
node: textNodeType,
2424
currentValue: string,
2525
expectedValue: string,
26-
newValue: string,
26+
newValue: string
2727
) {
2828
node.data = newValue
2929
return
@@ -92,7 +92,7 @@ export class DiffDOM {
9292
const constNames: ConstNamesPartial = {}
9393
if (options.compress) {
9494
varNames.forEach(
95-
(varName, index) => (constNames[varName] = index),
95+
(varName, index) => (constNames[varName] = index)
9696
)
9797
} else {
9898
varNames.forEach((varName) => (constNames[varName] = varName))
@@ -113,7 +113,7 @@ export class DiffDOM {
113113

114114
diff(
115115
t1Node: string | elementNodeType | Element,
116-
t2Node: string | elementNodeType | Element,
116+
t2Node: string | elementNodeType | Element
117117
) {
118118
const finder = new DiffFinder(t1Node, t2Node, this.options)
119119
return finder.init()

src/diffDOM/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ interface DiffDOMOptions {
111111
node: textNodeType | Text | Comment,
112112
currentValue: string,
113113
expectedValue: string,
114-
newValue: string,
114+
newValue: string
115115
) => void
116116
preVirtualDiffApply: PreDiffApply
117117
postVirtualDiffApply: PostDiffApply

src/diffDOM/virtual/apply.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ function getFromVirtualRoute(tree: elementNodeType, route: number[]) {
2424
function applyVirtualDiff(
2525
tree: elementNodeType,
2626
diff: Diff,
27-
options: DiffDOMOptions, // {preVirtualDiffApply, postVirtualDiffApply, _const}
27+
options: DiffDOMOptions // {preVirtualDiffApply, postVirtualDiffApply, _const}
2828
) {
2929
let node, parentNode, nodeIndex
3030

3131
if (
3232
![options._const.addElement, options._const.addTextElement].includes(
33-
diff[options._const.action],
33+
diff[options._const.action]
3434
)
3535
) {
3636
// For adding nodes, we calculate the route later on. It's different because it includes the position of the newly added item.
@@ -126,11 +126,11 @@ function applyVirtualDiff(
126126
nodeArray = node.childNodes
127127
.splice(
128128
diff[options._const.from],
129-
diff[options._const.groupLength],
129+
diff[options._const.groupLength]
130130
)
131131
.reverse()
132132
nodeArray.forEach((movedNode: nodeType) =>
133-
node.childNodes.splice(diff[options._const.to], 0, movedNode),
133+
node.childNodes.splice(diff[options._const.to], 0, movedNode)
134134
)
135135
if (node.subsets) {
136136
node.subsets.forEach((map: subsetType) => {
@@ -321,7 +321,7 @@ function applyVirtualDiff(
321321

322322
if (node.subsets) {
323323
node.subsets = node.subsets.filter(
324-
(map: subsetType) => !map.delete && map.oldValue !== map.newValue,
324+
(map: subsetType) => !map.delete && map.oldValue !== map.newValue
325325
)
326326
if (newSubsets.length) {
327327
node.subsets = node.subsets.concat(newSubsets)
@@ -340,7 +340,7 @@ function applyVirtualDiff(
340340
export function applyVirtual(
341341
tree: elementNodeType,
342342
diffs: Diff[],
343-
options: DiffDOMOptions,
343+
options: DiffDOMOptions
344344
) {
345345
diffs.forEach((diff: Diff) => {
346346
applyVirtualDiff(tree, diff, options)

0 commit comments

Comments
 (0)