1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +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

@ -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++) {