1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Adjust the brace-style ESLint rule to disallow single lines (and also enable no-iterator)

See http://eslint.org/docs/rules/brace-style.
Having the opening/closing braces on the same line can often make the code slightly more difficult to read, in particular for `if`/`else if` statements, compared to using new lines.

This patch also, for consistency with `mozilla-central`, enables the [`no-iterator`](http://eslint.org/docs/rules/no-iterator) rule. Note that this rule didn't require a single code change.
This commit is contained in:
Jonas Jenwald 2017-02-03 12:58:08 +01:00
parent 92e5fb099e
commit bc736fdc7d
18 changed files with 129 additions and 46 deletions

View file

@ -419,13 +419,19 @@ if (typeof PDFJS === 'undefined') {
} else if (!('bind' in console.log)) {
// native functions in IE9 might not have bind
console.log = (function(fn) {
return function(msg) { return fn(msg); };
return function(msg) {
return fn(msg);
};
})(console.log);
console.error = (function(fn) {
return function(msg) { return fn(msg); };
return function(msg) {
return fn(msg);
};
})(console.error);
console.warn = (function(fn) {
return function(msg) { return fn(msg); };
return function(msg) {
return fn(msg);
};
})(console.warn);
}
})();
@ -606,7 +612,9 @@ if (typeof PDFJS === 'undefined') {
var inputProto = el.constructor.prototype;
var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type');
Object.defineProperty(inputProto, 'type', {
get: function () { return typeProperty.get.call(this); },
get: function () {
return typeProperty.get.call(this);
},
set: function (value) {
typeProperty.set.call(this, value === 'number' ? 'text' : value);
},
@ -630,7 +638,9 @@ if (typeof PDFJS === 'undefined') {
var value = readyStateProto.get.call(this);
return value === 'interactive' ? 'loading' : value;
},
set: function (value) { readyStateProto.set.call(this, value); },
set: function (value) {
readyStateProto.set.call(this, value);
},
enumerable: true,
configurable: true
});

View file

@ -387,7 +387,9 @@ var Stepper = (function StepperClosure() {
this.table.appendChild(chunk);
},
getNextBreakPoint: function getNextBreakPoint() {
this.breakPoints.sort(function(a, b) { return a - b; });
this.breakPoints.sort(function(a, b) {
return a - b;
});
for (var i = 0; i < this.breakPoints.length; i++) {
if (this.breakPoints[i] > this.currentIdx) {
return this.breakPoints[i];
@ -484,7 +486,9 @@ var Stats = (function Stats() {
wrapper.appendChild(title);
wrapper.appendChild(statsDiv);
stats.push({ pageNumber: pageNumber, div: wrapper });
stats.sort(function(a, b) { return a.pageNumber - b.pageNumber; });
stats.sort(function(a, b) {
return a.pageNumber - b.pageNumber;
});
clear(this.panel);
for (var i = 0, ii = stats.length; i < ii; ++i) {
this.panel.appendChild(stats[i].div);