Enforce curly braces for control statements

This commit is contained in:
Pierre Ossman 2018-09-06 17:22:40 +02:00
parent 4a16dc51a8
commit 426a8c927b
7 changed files with 32 additions and 16 deletions

View File

@ -31,6 +31,7 @@
"ignoreComments": true }],
"comma-spacing": ["error"],
"comma-style": ["error"],
"curly": ["error", "multi-line"],
"func-call-spacing": ["error"],
"func-names": ["error"],
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],

View File

@ -53,10 +53,12 @@ export class Localizer {
.replace("_", "-")
.split("-");
if (userLang[0] !== supLang[0])
if (userLang[0] !== supLang[0]) {
continue;
if (userLang[1] !== supLang[1])
}
if (userLang[1] !== supLang[1]) {
continue;
}
this.language = supportedLanguages[j];
return;
@ -69,10 +71,12 @@ export class Localizer {
.replace("_", "-")
.split("-");
if (userLang[0] !== supLang[0])
if (userLang[0] !== supLang[0]) {
continue;
if (supLang[1] !== undefined)
}
if (supLang[1] !== undefined) {
continue;
}
this.language = supportedLanguages[j];
return;

View File

@ -249,10 +249,11 @@ export default class Keyboard {
// Character (A-Z)
let char = String.fromCharCode(e.keyCode);
// A feeble attempt at the correct case
if (e.shiftKey)
if (e.shiftKey) {
char = char.toUpperCase();
else
} else {
char = char.toLowerCase();
}
keysym = char.charCodeAt();
} else {
// Unknown, give up

View File

@ -2348,8 +2348,10 @@ RFB.encodingHandlers = {
else if (ctl === 0x0A) cmode = "png";
else if (ctl & 0x04) cmode = "filter";
else if (ctl < 0x04) cmode = "copy";
else return this._fail("Illegal tight compression received (ctl: " +
else {
return this._fail("Illegal tight compression received (ctl: " +
ctl + ")");
}
if (isTightPNG && (ctl < 0x08)) {
return this._fail("BasicCompression received in TightPNG rect");

View File

@ -187,13 +187,15 @@ export default class Cursor {
}
_showCursor() {
if (this._canvas.style.visibility === 'hidden')
if (this._canvas.style.visibility === 'hidden') {
this._canvas.style.visibility = '';
}
}
_hideCursor() {
if (this._canvas.style.visibility !== 'hidden')
if (this._canvas.style.visibility !== 'hidden') {
this._canvas.style.visibility = 'hidden';
}
}
// Should we currently display the cursor?
@ -201,24 +203,28 @@ export default class Cursor {
// different cursor set)
_shouldShowCursor(target) {
// Easy case
if (target === this._target)
if (target === this._target) {
return true;
}
// Other part of the DOM?
if (!this._target.contains(target))
if (!this._target.contains(target)) {
return false;
}
// Has the child its own cursor?
// FIXME: How can we tell that a sub element has an
// explicit "cursor: none;"?
if (window.getComputedStyle(target).cursor !== 'none')
if (window.getComputedStyle(target).cursor !== 'none') {
return false;
}
return true;
}
_updateVisibility(target) {
if (this._shouldShowCursor(target))
if (this._shouldShowCursor(target)) {
this._showCursor();
else
} else {
this._hideCursor();
}
}
_updatePosition() {

View File

@ -35,8 +35,9 @@ document.body.appendChild(script);
function fallback() {
if (!window._noVNC_has_module_support) {
/* eslint-disable no-console */
if (console)
if (console) {
console.log("No module support detected. Loading fallback...");
}
/* eslint-enable no-console */
let loader = document.createElement("script");
loader.src = "base/vendor/browser-es-module-loader/dist/browser-es-module-loader.js";

View File

@ -49,8 +49,9 @@ function enableUI() {
frames = VNC_frame_data;
// Only present in older recordings
if (window.VNC_frame_encoding)
if (window.VNC_frame_encoding) {
encoding = VNC_frame_encoding;
}
}
class IterationPlayer {