style: no-sequences, no-void, quote-props (#527)

pull/530/head
Shahar Dawn Or 5 years ago committed by GitHub
parent ad3745bfe8
commit 6eacf72763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,16 +19,13 @@ module.exports = {
'dot-notation': 'off', 'dot-notation': 'off',
'import/first': 'off', 'import/first': 'off',
'no-mixed-operators': 'off', 'no-mixed-operators': 'off',
'no-sequences': 'off',
'no-undef': 'off', 'no-undef': 'off',
'no-unneeded-ternary': 'off', 'no-unneeded-ternary': 'off',
'no-unused-expressions': 'off', 'no-unused-expressions': 'off',
'no-unused-vars': 'off', 'no-unused-vars': 'off',
'no-void': 'off',
'node/no-deprecated-api': 'off', 'node/no-deprecated-api': 'off',
'one-var': 'off', 'one-var': 'off',
'prefer-const': 'off', 'prefer-const': 'off',
'quote-props': 'off',
eqeqeq: 'off', eqeqeq: 'off',
semi: 'off' semi: 'off'
} }

@ -83,7 +83,7 @@ function destroy (vnode: VNode): void {
(vnode as any).isTextNode = isTextElement(elm as Element | Text); // is this a text node? (vnode as any).isTextNode = isTextElement(elm as Element | Text); // is this a text node?
(vnode as any).boundingRect = (elm as Element).getBoundingClientRect(); // save the bounding rectangle to a new property on the vnode (vnode as any).boundingRect = (elm as Element).getBoundingClientRect(); // save the bounding rectangle to a new property on the vnode
(vnode as any).textRect = (vnode as any).isTextNode ? getTextNodeRect((elm as Element).childNodes[0] as Text) : null; // save bounding rect of inner text node (vnode as any).textRect = (vnode as any).isTextNode ? getTextNodeRect((elm as Element).childNodes[0] as Text) : null; // save bounding rect of inner text node
var computedStyle = window.getComputedStyle(elm as Element, void 0); // get current styles (includes inherited properties) var computedStyle = window.getComputedStyle(elm as Element, undefined); // get current styles (includes inherited properties)
(vnode as any).savedStyle = JSON.parse(JSON.stringify(computedStyle)); // save a copy of computed style values (vnode as any).savedStyle = JSON.parse(JSON.stringify(computedStyle)); // save a copy of computed style values
removed[hero.id] = vnode; removed[hero.id] = vnode;
} }
@ -104,7 +104,7 @@ function post () {
if (oldVnode) { if (oldVnode) {
isTextNode = (oldVnode as any).isTextNode && isTextElement(newElm); // Are old & new both text? isTextNode = (oldVnode as any).isTextNode && isTextElement(newElm); // Are old & new both text?
newStyle = (newElm as HTMLElement).style; newStyle = (newElm as HTMLElement).style;
newComputedStyle = window.getComputedStyle(newElm, void 0); // get full computed style for new element newComputedStyle = window.getComputedStyle(newElm, undefined); // get full computed style for new element
oldElm = oldVnode.elm as Element; oldElm = oldVnode.elm as Element;
oldStyle = (oldElm as HTMLElement).style; oldStyle = (oldElm as HTMLElement).style;
// Overall element bounding boxes // Overall element bounding boxes

@ -372,7 +372,7 @@ describe('snabbdom', function () {
elm.appendChild(text); elm.appendChild(text);
var vnode = toVNode(elm, domApi); var vnode = toVNode(elm, domApi);
assert.equal(vnode.sel, 'x-div#id.class.other'); assert.equal(vnode.sel, 'x-div#id.class.other');
assert.deepEqual(vnode.data, { attrs: { 'data': 'value' } }); assert.deepEqual(vnode.data, { attrs: { data: 'value' } });
const children = vnode.children as [VNode, VNode] const children = vnode.children as [VNode, VNode]
assert.equal(children[0].sel, 'x-h2#hx'); assert.equal(children[0].sel, 'x-h2#hx');
assert.deepEqual(children[0].data, { attrs: { 'data-env': 'xyz' } }); assert.deepEqual(children[0].data, { attrs: { 'data-env': 'xyz' } });

@ -138,7 +138,7 @@ describe('event listeners', function () {
assert.equal(2, result.length); assert.equal(2, result.length);
assert.equal(vnode1, result[0]); assert.equal(vnode1, result[0]);
assert.equal(vnode1, result[1]); assert.equal(vnode1, result[1]);
}), });
it('access to virtual node in event handler with argument', function () { it('access to virtual node in event handler with argument', function () {
var result: Array<VNode | Event> = []; var result: Array<VNode | Event> = [];
function clicked (arg: number, ev: Event, vnode: VNode) { result.push(this); result.push(vnode); } function clicked (arg: number, ev: Event, vnode: VNode) { result.push(this); result.push(vnode); }
@ -150,7 +150,7 @@ describe('event listeners', function () {
assert.equal(2, result.length); assert.equal(2, result.length);
assert.equal(vnode1, result[0]); assert.equal(vnode1, result[0]);
assert.equal(vnode1, result[1]); assert.equal(vnode1, result[1]);
}), });
it('access to virtual node in event handler with arguments', function () { it('access to virtual node in event handler with arguments', function () {
var result: Array<VNode | Event> = []; var result: Array<VNode | Event> = [];
function clicked (arg1: number, arg2: string, ev: Event, vnode: VNode) { result.push(this); result.push(vnode); } function clicked (arg1: number, arg2: string, ev: Event, vnode: VNode) { result.push(this); result.push(vnode); }

Loading…
Cancel
Save