From: Samuel Mannehed Date: Sat, 30 May 2020 23:36:41 +0000 (+0200) Subject: Add camelCase rule to eslint X-Git-Tag: v1.2.0~17^2 X-Git-Url: https://git.proxmox.com/?p=mirror_novnc.git;a=commitdiff_plain;h=cfb824ed03942b328d75ea1443f07edaa3579f68 Add camelCase rule to eslint --- diff --git a/.eslintrc b/.eslintrc index 900a718..4b50d2f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -44,5 +44,6 @@ "named": "never", "asyncArrow": "always" }], "switch-colon-spacing": ["error"], + "camelcase": ["error", { allow: ["^XK_", "^XF86XK_"] }], } } diff --git a/core/deflator.js b/core/deflator.js index ad3d0fb..fe2a8f7 100644 --- a/core/deflator.js +++ b/core/deflator.js @@ -21,12 +21,14 @@ export default class Deflator { } deflate(inData) { + /* eslint-disable camelcase */ this.strm.input = inData; this.strm.avail_in = this.strm.input.length; this.strm.next_in = 0; this.strm.output = this.outputBuffer; this.strm.avail_out = this.chunkSize; this.strm.next_out = 0; + /* eslint-enable camelcase */ let lastRet = deflate(this.strm, Z_FULL_FLUSH); let outData = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out); @@ -41,9 +43,11 @@ export default class Deflator { let chunks = [outData]; let totalLen = outData.length; do { + /* eslint-disable camelcase */ this.strm.output = new Uint8Array(this.chunkSize); this.strm.next_out = 0; this.strm.avail_out = this.chunkSize; + /* eslint-enable camelcase */ lastRet = deflate(this.strm, Z_FULL_FLUSH); @@ -69,9 +73,11 @@ export default class Deflator { outData = newData; } + /* eslint-disable camelcase */ this.strm.input = null; this.strm.avail_in = 0; this.strm.next_in = 0; + /* eslint-enable camelcase */ return outData; } diff --git a/core/inflator.js b/core/inflator.js index e61a5bd..4b33760 100644 --- a/core/inflator.js +++ b/core/inflator.js @@ -22,6 +22,7 @@ export default class Inflate { setInput(data) { if (!data) { //FIXME: flush remaining data. + /* eslint-disable camelcase */ this.strm.input = null; this.strm.avail_in = 0; this.strm.next_in = 0; @@ -29,6 +30,7 @@ export default class Inflate { this.strm.input = data; this.strm.avail_in = this.strm.input.length; this.strm.next_in = 0; + /* eslint-enable camelcase */ } } @@ -41,8 +43,10 @@ export default class Inflate { this.strm.output = new Uint8Array(this.chunkSize); } + /* eslint-disable camelcase */ this.strm.next_out = 0; this.strm.avail_out = expected; + /* eslint-enable camelcase */ let ret = inflate(this.strm, 0); // Flush argument not used. if (ret < 0) { diff --git a/tests/test.deflator.js b/tests/test.deflator.js index 2f2fab3..12e8a46 100644 --- a/tests/test.deflator.js +++ b/tests/test.deflator.js @@ -17,12 +17,14 @@ function _inflator(compText, expected) { strm.output = new Uint8Array(chunkSize); } + /* eslint-disable camelcase */ strm.input = compText; strm.avail_in = strm.input.length; strm.next_in = 0; strm.next_out = 0; strm.avail_out = expected.length; + /* eslint-enable camelcase */ let ret = inflate(strm, 0); diff --git a/tests/test.rfb.js b/tests/test.rfb.js index d195905..0481df1 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -70,11 +70,13 @@ function deflateWithSize(data) { strm.output = new Uint8Array(chunkSize); deflateInit(strm, 5); + /* eslint-disable camelcase */ strm.input = unCompData; strm.avail_in = strm.input.length; strm.next_in = 0; strm.next_out = 0; strm.avail_out = chunkSize; + /* eslint-enable camelcase */ deflate(strm, 3);