Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 637f7e8

Browse files
committed
Merge pull request #2660 from adobe/jasonsanjose/jshint
Fix JSHINT errors
2 parents be6bd38 + ebde963 commit 637f7e8

13 files changed

Lines changed: 71 additions & 89 deletions

File tree

src/command/KeyBindingManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ define(function (require, exports, module) {
587587
true
588588
);
589589

590-
exports.useWindowsCompatibleBindings = (brackets.platform !== "mac")
591-
&& (brackets.platform !== "win");
590+
exports.useWindowsCompatibleBindings = (brackets.platform !== "mac") &&
591+
(brackets.platform !== "win");
592592
});
593593

594594
$(CommandManager).on("commandRegistered", _handleCommandRegistered);

src/debug/DebugCommandHandlers.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,7 @@ define(function (require, exports, module) {
254254
// enable the menu item
255255
CommandManager.get(Commands.DEBUG_RUN_UNIT_TESTS).setEnabled(true);
256256
},
257-
function (error) {
258-
// Error getting metadata.
259-
// The menu item is already disabled, so there is nothing to do here.
260-
}
257+
function (error) {} /* menu already disabled, ignore errors */
261258
);
262259
}
263260

src/document/DocumentCommandHandlers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,9 @@ define(function (require, exports, module) {
644644

645645
message += "<ul>";
646646
unsavedDocs.forEach(function (doc) {
647-
message += "<li><span class='dialog-filename'>"
648-
+ StringUtils.htmlEscape(ProjectManager.makeProjectRelativeIfPossible(doc.file.fullPath))
649-
+ "</span></li>";
647+
message += "<li><span class='dialog-filename'>" +
648+
StringUtils.htmlEscape(ProjectManager.makeProjectRelativeIfPossible(doc.file.fullPath)) +
649+
"</span></li>";
650650
});
651651
message += "</ul>";
652652

src/extensions/default/InlineColorEditor/ColorEditor.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,10 @@ define(function (require, exports, module) {
530530
return false;
531531
}
532532
} else {
533-
switch (event.keyCode) {
534-
case KeyEvent.DOM_VK_LEFT:
535-
case KeyEvent.DOM_VK_RIGHT:
536-
case KeyEvent.DOM_VK_UP:
537-
case KeyEvent.DOM_VK_DOWN:
533+
if (event.keyCode === KeyEvent.DOM_VK_LEFT ||
534+
event.keyCode === KeyEvent.DOM_VK_RIGHT ||
535+
event.keyCode === KeyEvent.DOM_VK_UP ||
536+
event.keyCode === KeyEvent.DOM_VK_DOWN) {
538537
// Prevent arrow keys that weren't handled by a child control
539538
// from being handled by a parent, either through bubbling or
540539
// through default native behavior. There isn't a good general
@@ -564,22 +563,19 @@ define(function (require, exports, module) {
564563
event.stopPropagation();
565564
return false; // equivalent to event.preventDefault()
566565
}
567-
break;
568566
}
569567
}
570568
};
571569

572570
ColorEditor.prototype._handleHslKeydown = function (event) {
573-
switch (event.keyCode) {
574-
case KeyEvent.DOM_VK_TAB:
571+
if (event.keyCode === KeyEvent.DOM_VK_TAB) {
575572
// If we're the last focusable element (no color swatches), Tab wraps around to color square
576573
if (!event.shiftKey) {
577574
if (this.$swatches.children().length === 0) {
578575
this.$selectionBase.focus();
579576
return false;
580577
}
581578
}
582-
break;
583579
}
584580
};
585581

src/extensions/default/JavaScriptQuickEdit/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ define(function (require, exports, module) {
5252
}
5353

5454
// Return valid function expressions only (function call or reference)
55-
if (!((token.className === "variable")
56-
|| (token.className === "variable-2")
57-
|| (token.className === "property"))) {
55+
if (!((token.className === "variable") ||
56+
(token.className === "variable-2") ||
57+
(token.className === "property"))) {
5858
return null;
5959
}
6060

src/extensions/default/JavaScriptQuickEdit/unittests.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ define(function (require, exports, module) {
153153
}
154154
}
155155

156-
visibleRangeCheck = (editor._visibleRange.startLine === startLine)
157-
&& (editor._visibleRange.endLine === endLine);
156+
visibleRangeCheck = (editor._visibleRange.startLine === startLine) &&
157+
(editor._visibleRange.endLine === endLine);
158158

159159
this.message = function () {
160160
var msg = "";
@@ -168,18 +168,18 @@ define(function (require, exports, module) {
168168
}
169169

170170
if (!visibleRangeCheck) {
171-
msg += "Editor._visibleRange ["
172-
+ editor._visibleRange.startLine + ","
173-
+ editor._visibleRange.endLine + "] should be ["
174-
+ startLine + "," + endLine + "].";
171+
msg += "Editor._visibleRange [" +
172+
editor._visibleRange.startLine + "," +
173+
editor._visibleRange.endLine + "] should be [" +
174+
startLine + "," + endLine + "].";
175175
}
176176

177177
return msg;
178178
};
179179

180-
return (shouldHide.length === 0)
181-
&& (shouldShow.length === 0)
182-
&& visibleRangeCheck;
180+
return (shouldHide.length === 0) &&
181+
(shouldShow.length === 0) &&
182+
visibleRangeCheck;
183183
}
184184
});
185185
});

src/help/HelpCommandHandlers.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ define(function (require, exports, module) {
5959
function _handleShowExtensionsFolder() {
6060
brackets.app.showExtensionsFolder(
6161
FileUtils.convertToNativePath(decodeURI(window.location.href)),
62-
function (err) {
63-
// Ignore errors
64-
}
62+
function (err) {} /* Ignore errors */
6563
);
6664
}
6765

src/nls/de/strings.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ define({
9090
"SAVE_CLOSE_MESSAGE" : "Wollen Sie die Änderungen in dem Dokument <span class='dialog-filename'>{0}</span> speichern?",
9191
"SAVE_CLOSE_MULTI_MESSAGE" : "Wollen Sie Ihre Änderungen in den folgenden Dateien speichern?",
9292
"EXT_MODIFIED_TITLE" : "Externe Änderungen",
93-
"EXT_MODIFIED_MESSAGE" : "<span class='dialog-filename'>{0}</span> wurde extern geändert und hat ungespeicherte Änderungen in {APP_NAME}."
94-
+ "<br /><br />"
95-
+ "Welche Version wollen Sie weiter verwenden?",
96-
"EXT_DELETED_MESSAGE" : "<span class='dialog-filename'>{0}</span> wurde extern gelöscht und hat ungespeicherte Änderungen in {APP_NAME}."
97-
+ "<br /><br />"
98-
+ "Wollen Sie die Änderungen beibehalten?",
93+
"EXT_MODIFIED_MESSAGE" : "<span class='dialog-filename'>{0}</span> wurde extern geändert und hat ungespeicherte Änderungen in {APP_NAME}." +
94+
"<br /><br />" +
95+
"Welche Version wollen Sie weiter verwenden?",
96+
"EXT_DELETED_MESSAGE" : "<span class='dialog-filename'>{0}</span> wurde extern gelöscht und hat ungespeicherte Änderungen in {APP_NAME}." +
97+
"<br /><br />" +
98+
"Wollen Sie die Änderungen beibehalten?",
9999

100100
// Find, Replace, Find in Files
101101
"SEARCH_REGEXP_INFO" : "/re/-Syntax zum Suchen mit regulären Ausdrücken verwenden",

src/nls/pt-pt/strings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,5 +271,5 @@ define({
271271
"BASEURL_ERROR_SEARCH_DISALLOWED" : "O URL base não pode conter parametros de pesquisa como \"{0}\".",
272272
"BASEURL_ERROR_HASH_DISALLOWED" : "O URL base não pode conter cardinal como \"{0}\".",
273273
"BASEURL_ERROR_INVALID_CHAR" : "Caracteres especiais como '{0}' têm que ser %-codificados.",
274-
"BASEURL_ERROR_UNKOWN_ERROR" : "Erro desconhecido na análise do URL base",
274+
"BASEURL_ERROR_UNKOWN_ERROR" : "Erro desconhecido na análise do URL base"
275275
});

src/project/ProjectManager.js

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -377,29 +377,26 @@ define(function (require, exports, module) {
377377
// (jsTree is smart enough to replace the old tree if there's already one there)
378378
$projectTreeContainer.hide();
379379
_projectTree = $projectTreeContainer
380-
.jstree(
381-
{
382-
plugins : ["ui", "themes", "json_data", "crrm", "sort"],
383-
ui : { select_limit: 1, select_multiple_modifier: "", select_range_modifier: "" },
384-
json_data : { data: treeDataProvider, correct_state: false },
385-
core : { animation: 0 },
386-
themes : { theme: "brackets", url: "styles/jsTreeTheme.css", dots: false, icons: false },
387-
//(note: our actual jsTree theme CSS lives in brackets.less; we specify an empty .css
388-
// file because jsTree insists on loading one itself)
389-
strings : { loading : "Loading ...", new_node : "New node" },
390-
sort : function (a, b) {
391-
if (brackets.platform === "win") {
392-
// Windows: prepend folder names with a '0' and file names with a '1' so folders are listed first
393-
var a1 = ($(a).hasClass("jstree-leaf") ? "1" : "0") + this.get_text(a).toLowerCase(),
394-
b1 = ($(b).hasClass("jstree-leaf") ? "1" : "0") + this.get_text(b).toLowerCase();
395-
return (a1 > b1) ? 1 : -1;
396-
} else {
397-
return this.get_text(a).toLowerCase() > this.get_text(b).toLowerCase() ? 1 : -1;
398-
}
380+
.jstree({
381+
plugins : ["ui", "themes", "json_data", "crrm", "sort"],
382+
ui : { select_limit: 1, select_multiple_modifier: "", select_range_modifier: "" },
383+
json_data : { data: treeDataProvider, correct_state: false },
384+
core : { animation: 0 },
385+
themes : { theme: "brackets", url: "styles/jsTreeTheme.css", dots: false, icons: false },
386+
//(note: our actual jsTree theme CSS lives in brackets.less; we specify an empty .css
387+
// file because jsTree insists on loading one itself)
388+
strings : { loading : "Loading ...", new_node : "New node" },
389+
sort : function (a, b) {
390+
if (brackets.platform === "win") {
391+
// Windows: prepend folder names with a '0' and file names with a '1' so folders are listed first
392+
var a1 = ($(a).hasClass("jstree-leaf") ? "1" : "0") + this.get_text(a).toLowerCase(),
393+
b1 = ($(b).hasClass("jstree-leaf") ? "1" : "0") + this.get_text(b).toLowerCase();
394+
return (a1 > b1) ? 1 : -1;
395+
} else {
396+
return this.get_text(a).toLowerCase() > this.get_text(b).toLowerCase() ? 1 : -1;
399397
}
400398
}
401-
)
402-
.bind(
399+
}).bind(
403400
"before.jstree",
404401
function (event, data) {
405402
if (data.func === "toggle_node") {
@@ -409,8 +406,7 @@ define(function (require, exports, module) {
409406
suppressToggleOpen = _projectTree.jstree("is_open", data.args[0]);
410407
}
411408
}
412-
)
413-
.bind(
409+
).bind(
414410
"select_node.jstree",
415411
function (event, data) {
416412
var entry = data.rslt.obj.data("entry");
@@ -444,8 +440,7 @@ define(function (require, exports, module) {
444440

445441
suppressToggleOpen = false;
446442
}
447-
)
448-
.bind(
443+
).bind(
449444
"reopen.jstree",
450445
function (event, data) {
451446
// This handler fires for the initial load and subsequent
@@ -475,15 +470,13 @@ define(function (require, exports, module) {
475470
result.resolve();
476471
}
477472
}
478-
)
479-
.bind(
473+
).bind(
480474
"scroll.jstree",
481475
function (e) {
482476
// close all dropdowns on scroll
483477
Menus.closeAll();
484478
}
485-
)
486-
.bind(
479+
).bind(
487480
"loaded.jstree open_node.jstree close_node.jstree",
488481
function (event, data) {
489482
if (event.type === "open_node") {
@@ -508,8 +501,7 @@ define(function (require, exports, module) {
508501

509502
_savePreferences();
510503
}
511-
)
512-
.bind(
504+
).bind(
513505
"mousedown.jstree",
514506
function (event) {
515507
// select tree node on right-click
@@ -754,8 +746,8 @@ define(function (require, exports, module) {
754746
NativeFileSystem.requestNativeFileSystem(rootPath,
755747
function (fs) {
756748
var rootEntry = fs.root;
757-
var projectRootChanged = (!_projectRoot || !rootEntry)
758-
|| _projectRoot.fullPath !== rootEntry.fullPath;
749+
var projectRootChanged = (!_projectRoot || !rootEntry) ||
750+
_projectRoot.fullPath !== rootEntry.fullPath;
759751

760752
// Success!
761753
var perfTimerName = PerfUtils.markStart("Load Project: " + rootPath),
@@ -1095,8 +1087,8 @@ define(function (require, exports, module) {
10951087
};
10961088

10971089
var errorCallback = function (error) {
1098-
if ((error.name === NativeFileError.PATH_EXISTS_ERR)
1099-
|| (error.name === NativeFileError.TYPE_MISMATCH_ERR)) {
1090+
if ((error.name === NativeFileError.PATH_EXISTS_ERR) ||
1091+
(error.name === NativeFileError.TYPE_MISMATCH_ERR)) {
11001092
Dialogs.showModalDialog(
11011093
Dialogs.DIALOG_ID_ERROR,
11021094
Strings.INVALID_FILENAME_TITLE,

0 commit comments

Comments
 (0)