1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Adjust the yoda ESLint rule to apply to inequalities as well

I happened to notice that some inequalities had the wrong order, and was surprised since I thought that the `yoda` rule should have caught that.
However, reading http://eslint.org/docs/rules/yoda#options a bit more closely than previously, it's quite obvious that the `onlyEquality` option does *exactly* what its name suggests. Hence I think that it makes sense to adjust the options such that only ranges are allowed instead.
This commit is contained in:
Jonas Jenwald 2017-03-06 16:50:22 +01:00
parent f0c45f0336
commit a7c19d9cbb
6 changed files with 31 additions and 29 deletions

View file

@ -1614,7 +1614,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var type = xobj.dict.get('Subtype');
assert(isName(type), 'XObject should have a Name subtype');
if ('Form' !== type.name) {
if (type.name !== 'Form') {
xobjsCache.key = name;
xobjsCache.texts = null;
break;

View file

@ -106,7 +106,7 @@ var JpxImage = (function JpxImageClosure() {
this.parseCodestream(data, position, position + dataLength);
break;
case 0x6A502020: // 'jP\024\024'
if (0x0d0a870a !== readUint32(data, position)) {
if (readUint32(data, position) !== 0x0d0a870a) {
warn('Invalid JP2 signature');
}
break;

View file

@ -349,7 +349,7 @@ Shadings.Mesh = (function MeshClosure() {
var coord = reader.readCoordinate();
var color = reader.readComponents();
if (verticesLeft === 0) { // ignoring flags if we started a triangle
assert(0 <= f && f <= 2, 'Unknown type4 flag');
assert((0 <= f && f <= 2), 'Unknown type4 flag');
switch (f) {
case 0:
verticesLeft = 3;
@ -513,7 +513,7 @@ Shadings.Mesh = (function MeshClosure() {
var cs = new Int32Array(4); // c00, c30, c03, c33
while (reader.hasData) {
var f = reader.readFlag();
assert(0 <= f && f <= 3, 'Unknown type6 flag');
assert((0 <= f && f <= 3), 'Unknown type6 flag');
var i, ii;
var pi = coords.length;
for (i = 0, ii = (f !== 0 ? 8 : 12); i < ii; i++) {
@ -623,7 +623,7 @@ Shadings.Mesh = (function MeshClosure() {
var cs = new Int32Array(4); // c00, c30, c03, c33
while (reader.hasData) {
var f = reader.readFlag();
assert(0 <= f && f <= 3, 'Unknown type7 flag');
assert((0 <= f && f <= 3), 'Unknown type7 flag');
var i, ii;
var pi = coords.length;
for (i = 0, ii = (f !== 0 ? 12 : 16); i < ii; i++) {