Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1328805 - Enable the no-cond-assign rule for eslint and fix the s…
Browse files Browse the repository at this point in the history
…ix resulting errors mostly by wrapping the assignment with parentheses to explicitly state that the assignment is intentional with exception for advanced.js where assignment was not intended. r=mossop

MozReview-Commit-ID: EZytfzGoMLR
  • Loading branch information
msujaws committed Jan 5, 2017
1 parent e5d4eb8 commit 183fa3e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion browser/components/preferences/in-content/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ var gAdvancedPane = {
* sync its new value to the gfx.direct2d.disabled pref too.
*/
updateHardwareAcceleration() {
if (AppConstants.platform = "win") {
if (AppConstants.platform == "win") {
var fromPref = document.getElementById("layers.acceleration.disabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;
Expand Down
3 changes: 3 additions & 0 deletions toolkit/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ module.exports = {
// Use [] instead of Array()
// "no-array-constructor": "error",

// Disallow assignment operators in conditional statements
"no-cond-assign": "error",

// Disallow the use of debugger
"no-debugger": "error",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ var SubprocessMonitor = {
// We first iterate the table to check if summaries exist for rowPids,
// if yes, update them and delete the pid's summary or else hide the row
// for recycling it. Start at row 1 instead of 0 (to skip the header row).
for (let i = 1, row; row = resultTable.rows[i]; i++) {
for (let i = 1, row; (row = resultTable.rows[i]); i++) {
let rowPid = row.dataset.pid;
let summary = summaries[rowPid];
if (summary) {
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/contentprefs/tests/unit_cps2/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ function dbOK(expectedRows) {
},
handleResult(results) {
let row = null;
while (row = results.getNextRow()) {
while ((row = results.getNextRow())) {
actualRows.push(cols.map(c => row.getResultByName(c)));
}
},
Expand Down
3 changes: 1 addition & 2 deletions toolkit/components/places/ClusterLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ HierarchicalClustering.prototype = {
}

// merge the next two closest clusters until none of them are close enough
let next = null, i = 0;
for (; next = this.closestClusters(clusters, distances, neighbors); i++) {
for (let next = null, i = 0; (next = this.closestClusters(clusters, distances, neighbors)); i++) {
if (snapshotCallback && (i % snapshotGap) == 0) {
snapshotCallback(clusters);
}
Expand Down
4 changes: 2 additions & 2 deletions toolkit/content/aboutSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ var snapshotFormatters = {
let contents;
if (entry.message.length > 0 && entry.message[0] == "#") {
// This is a failure ID. See nsIGfxInfo.idl.
let m;
if (m = /#BLOCKLIST_FEATURE_FAILURE_BUG_(\d+)/.exec(entry.message)) {
let m = /#BLOCKLIST_FEATURE_FAILURE_BUG_(\d+)/.exec(entry.message);
if (m) {
let bugSpan = $.new("span");
bugSpan.textContent = strings.GetStringFromName("blocklistedBug") + "; ";

Expand Down
2 changes: 1 addition & 1 deletion toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function getFileSize(aFile) {
let size = 0;
let entries = aFile.directoryEntries.QueryInterface(AM_Ci.nsIDirectoryEnumerator);
let entry;
while (entry = entries.nextFile)
while ((entry = entries.nextFile))
size += getFileSize(entry);
entries.close();
return size;
Expand Down

0 comments on commit 183fa3e

Please sign in to comment.