Update eslint to the latest version 🚀 (#86)

This commit is contained in:
greenkeeper[bot] 2019-03-09 13:51:49 +01:00 committed by Luke Page
parent d6bf8d133a
commit 7e160967c9
11 changed files with 2850 additions and 202 deletions

View file

@ -1,183 +1,182 @@
{
"ecmaFeatures": {},
"rules": {
"no-alert": 2,
"no-array-constructor": 0,
"no-bitwise": 0,
"no-caller": 2,
"no-catch-shadow": 2,
"no-class-assign": 2,
"no-cond-assign": 2,
"no-console": 2,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-continue": 0,
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-div-regex": 0,
"no-dupe-keys": 2,
"no-dupe-args": 2,
"no-duplicate-case": 2,
"no-else-return": 1,
"no-empty": 2,
"no-empty-character-class": 2,
"no-eq-null": 0,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 1,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-floating-decimal": 1,
"no-func-assign": 2,
"no-implicit-coercion": 1,
"no-implied-eval": 1,
"no-inline-comments": 0,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-invalid-this": 1,
"no-irregular-whitespace": 2,
"no-iterator": 1,
"no-label-var": 1,
"no-labels": 1,
"no-lone-blocks": 1,
"no-lonely-if": 1,
"no-loop-func": 1,
"no-mixed-requires": [1, false],
"no-mixed-spaces-and-tabs": [2, false],
"linebreak-style": [0, "unix"],
"no-multi-spaces": 1,
"no-multi-str": 0,
"no-multiple-empty-lines": [1, {"max": 2}],
"no-native-reassign": 2,
"no-negated-in-lhs": 2,
"no-nested-ternary": 1,
"no-new": 1,
"no-new-func": 1,
"no-new-object": 1,
"no-new-require": 1,
"no-new-wrappers": 1,
"no-obj-calls": 2,
"no-octal": 2,
"no-octal-escape": 0,
"no-param-reassign": 1,
"no-path-concat": 0,
"no-plusplus": 0,
"no-process-env": 0,
"no-process-exit": 0,
"no-proto": 0,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-restricted-modules": 0,
"no-return-assign": 1,
"no-script-url": 0,
"no-self-compare": 1,
"no-sequences": 1,
"no-shadow": 1,
"no-shadow-restricted-names": 1,
"no-spaced-func": 1,
"no-sparse-arrays": 2,
"no-sync": 0,
"no-ternary": 0,
"no-trailing-spaces": 1,
"no-this-before-super": 1,
"no-throw-literal": 1,
"no-undef": 2,
"no-undef-init": 1,
"no-undefined": 0,
"no-unexpected-multiline": 1,
"no-underscore-dangle": 0,
"no-unneeded-ternary": 0,
"no-unreachable": 2,
"no-unused-expressions": 1,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-use-before-define": 2,
"no-useless-call": 2,
"no-void": 0,
"no-var": 0,
"no-warning-comments": [1, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": 1,
"no-alert": "error",
"no-array-constructor": "off",
"no-bitwise": "off",
"no-caller": "error",
"no-catch-shadow": "error",
"no-class-assign": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-const-assign": "error",
"no-constant-condition": "error",
"no-continue": "off",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-div-regex": "off",
"no-dupe-keys": "error",
"no-dupe-args": "error",
"no-duplicate-case": "error",
"no-else-return": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-eq-null": "off",
"no-eval": "error",
"no-ex-assign": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-boolean-cast": "error",
"no-extra-parens": "off",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-func-assign": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
"no-inline-comments": "off",
"no-inner-declarations": ["error", "functions"],
"no-invalid-regexp": "error",
"no-invalid-this": "error",
"no-irregular-whitespace": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-mixed-requires": ["error", false],
"no-mixed-spaces-and-tabs": ["error", false],
"linebreak-style": ["off", "unix"],
"no-multi-spaces": "error",
"no-multi-str": "off",
"no-multiple-empty-lines": ["error", {"max": 2}],
"no-native-reassign": "error",
"no-negated-in-lhs": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "off",
"no-param-reassign": "off",
"no-path-concat": "off",
"no-plusplus": "off",
"no-process-env": "off",
"no-process-exit": "off",
"no-proto": "off",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-modules": "off",
"no-return-assign": "error",
"no-script-url": "off",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-sparse-arrays": "error",
"no-sync": "off",
"no-ternary": "off",
"no-trailing-spaces": "error",
"no-this-before-super": "error",
"no-throw-literal": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-undefined": "off",
"no-unexpected-multiline": "error",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "off",
"no-unreachable": "error",
"no-unused-expressions": "error",
"no-unused-vars": ["error", {"vars": "all", "args": "after-used"}],
"no-use-before-define": "error",
"no-useless-call": "error",
"no-void": "off",
"no-var": "off",
"no-warning-comments": ["error", { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": "error",
"array-bracket-spacing": [1, "never"],
"arrow-parens": 1,
"arrow-spacing": 1,
"accessor-pairs": 1,
"block-scoped-var": 0,
"brace-style": [1, "stroustrup"],
"callback-return": [2, ["callback", "cb", "next"]],
"camelcase": [2, {"properties": "always"}],
"comma-dangle": [2, "never"],
"comma-spacing": 2,
"comma-style": 1,
"complexity": [1, 10],
"computed-property-spacing": [0, "never"],
"consistent-return": 0,
"consistent-this": [0, "that"],
"constructor-super": 1,
"curly": [1, "all"],
"default-case": 1,
"dot-location": [1, "property"],
"dot-notation": [1, { "allowKeywords": true }],
"eol-last": 0,
"eqeqeq": 1,
"func-names": 0,
"func-style": [0, "declaration"],
"generator-star-spacing": 0,
"guard-for-in": 1,
"handle-callback-err": 2,
"id-length": [2, {"min": 3, "max": 25, "exceptions":["x", "y", "i", "j", "ex", "up"]}],
"indent": [1, 2, {"SwitchCase": 1}],
"init-declarations": 0,
"key-spacing": [1, { "beforeColon": false, "afterColon": true }],
"keyword-spacing": 1,
"lines-around-comment": 0,
"max-depth": [1, 4],
"max-len": [1, 160, 2],
"max-nested-callbacks": [1, 2],
"max-params": [1, 5],
"max-statements": [1, 30],
"new-cap": 1,
"new-parens": 1,
"newline-after-var": 0,
"object-curly-spacing": [1, "always"],
"object-shorthand": 0,
"one-var": [1, {
"array-bracket-spacing": ["error", "never"],
"arrow-parens": "error",
"arrow-spacing": "error",
"accessor-pairs": "error",
"block-scoped-var": "off",
"brace-style": ["error", "stroustrup"],
"callback-return": ["error", ["callback", "cb", "next"]],
"camelcase": ["error", {"properties": "always"}],
"comma-dangle": ["error", "never"],
"comma-spacing": "error",
"comma-style": "error",
"complexity": "off",
"computed-property-spacing": ["off", "never"],
"consistent-return": "off",
"consistent-this": ["off", "that"],
"constructor-super": "error",
"curly": ["error", "all"],
"default-case": "error",
"dot-location": ["error", "property"],
"dot-notation": ["error", { "allowKeywords": true }],
"eol-last": "off",
"eqeqeq": ["error", "smart"],
"func-names": "off",
"func-style": ["off", "declaration"],
"generator-star-spacing": "off",
"guard-for-in": "error",
"handle-callback-err": "error",
"id-length": ["error", {"min": 3, "max": 25, "exceptions":["x", "y", "i", "j", "ex", "up"]}],
"indent": ["error", 2, {"SwitchCase": 1}],
"init-declarations": "off",
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
"keyword-spacing": "error",
"lines-around-comment": "off",
"max-depth": ["error", 6],
"max-len": ["error", { "code": 160 }],
"max-nested-callbacks": ["error", 1],
"max-params": ["error", 6],
"max-statements": "off",
"new-cap": "error",
"new-parens": "error",
"newline-after-var": "off",
"object-curly-spacing": ["error", "always"],
"object-shorthand": "off",
"one-var": ["error", {
"initialized": "never"
}],
"operator-assignment": [0, "always"],
"operator-linebreak": [1, "after"],
"padded-blocks": 0,
"prefer-const": 0,
"prefer-spread": 0,
"prefer-reflect": 0,
"quote-props": 0,
"quotes": [1, "single"],
"radix": 0,
"id-match": 0,
"require-yield": 0,
"semi": [1, "always"],
"semi-spacing": [1, {"before": false, "after": true}],
"sort-vars": 0,
"space-before-blocks": [1, "always"],
"space-before-function-paren": [1, "never"],
"space-in-parens": [1, "never"],
"space-infix-ops": 1,
"space-unary-ops": [1, { "words": true, "nonwords": false }],
"spaced-comment": 0,
"strict": [2, "global"],
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
"vars-on-top": 0,
"wrap-iife": 0,
"wrap-regex": 0,
"yoda": [0, "never"]
"operator-assignment": ["off", "always"],
"operator-linebreak": ["error", "after"],
"padded-blocks": "off",
"prefer-const": "off",
"prefer-spread": "off",
"prefer-reflect": "off",
"quote-props": "off",
"quotes": ["error", "single"],
"radix": "off",
"id-match": "off",
"require-yield": "off",
"semi": ["error", "always"],
"semi-spacing": ["error", {"before": false, "after": true}],
"sort-vars": "off",
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", "never"],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
"spaced-comment": "off",
"strict": ["error", "global"],
"use-isnan": "error",
"valid-jsdoc": "off",
"valid-typeof": "error",
"vars-on-top": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yoda": ["off", "never"]
},
"env": {
"node": true,
"es6": true
"es6": true
}
}

View file

@ -12,8 +12,8 @@ module.exports = function(dataIn, width, height, options) {
return new Int16Array(buffer)[0] !== 256;
})();
// If no need to convert to grayscale and alpha is present/absent in both, take a fast route
if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)){
return dataIn;
if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) {
return dataIn;
}
}
@ -22,7 +22,9 @@ module.exports = function(dataIn, width, height, options) {
var maxValue = 255;
var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];
if (inBpp == 4 && !options.inputHasAlpha) inBpp = 3;
if (inBpp === 4 && !options.inputHasAlpha) {
inBpp = 3;
}
var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];
if (options.bitDepth === 16) {
maxValue = 65535;
@ -44,19 +46,22 @@ module.exports = function(dataIn, width, height, options) {
bgColor.blue = maxValue;
}
function getRGBA(data, inIndex) {
var red, green, blue, alpha = maxValue;
function getRGBA() {
var red;
var green;
var blue;
var alpha = maxValue;
switch (options.inputColorType) {
case constants.COLORTYPE_COLOR_ALPHA:
alpha = data[inIndex + 3];
red = data[inIndex];
green = data[inIndex+1];
blue = data[inIndex+2];
green = data[inIndex + 1];
blue = data[inIndex + 2];
break;
case constants.COLORTYPE_COLOR:
red = data[inIndex];
green = data[inIndex+1];
blue = data[inIndex+2];
green = data[inIndex + 1];
blue = data[inIndex + 2];
break;
case constants.COLORTYPE_ALPHA:
alpha = data[inIndex + 1];
@ -81,7 +86,7 @@ module.exports = function(dataIn, width, height, options) {
blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue);
}
}
return {red: red, green: green, blue: blue, alpha: alpha};
return { red: red, green: green, blue: blue, alpha: alpha };
}
for (var y = 0; y < height; y++) {
@ -98,7 +103,8 @@ module.exports = function(dataIn, width, height, options) {
if (outHasAlpha) {
outData[outIndex + 3] = rgba.alpha;
}
} else {
}
else {
outData.writeUInt16BE(rgba.red, outIndex);
outData.writeUInt16BE(rgba.green, outIndex + 2);
outData.writeUInt16BE(rgba.blue, outIndex + 4);
@ -116,13 +122,16 @@ module.exports = function(dataIn, width, height, options) {
if (outHasAlpha) {
outData[outIndex + 1] = rgba.alpha;
}
} else {
}
else {
outData.writeUInt16BE(grayscale, outIndex);
if (outHasAlpha) {
outData.writeUInt16BE(rgba.alpha, outIndex + 2);
}
}
break;
default:
throw new Error('unrecognised color Type ' + options.colorType);
}
inIndex += inBpp;

View file

@ -23,7 +23,7 @@ util.inherits(ChunkStream, Stream);
ChunkStream.prototype.read = function(length, callback) {
this._reads.push({
length: Math.abs(length), // if length < 0 then at most this length
length: Math.abs(length), // if length < 0 then at most this length
allowLess: length < 0,
func: callback
});

View file

@ -4,7 +4,7 @@ var paethPredictor = require('./paeth-predictor');
function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {
for (var x = 0; x < byteWidth; x++) {
for (var x = 0; x < byteWidth; x++) {
rawData[rawPos + x] = pxData[pxPos + x];
}
}
@ -155,7 +155,9 @@ module.exports = function(pxData, width, height, options, bpp) {
throw new Error('unrecognised filter types');
}
if (options.bitDepth === 16) bpp *= 2;
if (options.bitDepth === 16) {
bpp *= 2;
}
var byteWidth = width * bpp;
var rawPos = 0;
var pxPos = 0;

View file

@ -63,11 +63,12 @@ ParserAsync.prototype._inflateData = function(data) {
this._filter.on('complete', this._complete.bind(this));
this._inflate.pipe(this._filter);
} else {
}
else {
var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1;
var imageSize = rowSize * this._bitmapInfo.height;
var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK);
this._inflate = zlib.createInflate({ chunkSize: chunkSize });
var leftToInflate = imageSize;

View file

@ -78,7 +78,8 @@ module.exports = function(buffer, options) {
var inflatedData;
if (metaData.interlace) {
inflatedData = zlib.inflateSync(inflateData);
} else {
}
else {
var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;
var imageSize = rowSize * metaData.height;
inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize });

View file

@ -35,7 +35,7 @@ var Parser = module.exports = function(options, dependencies) {
this.inflateData = dependencies.inflateData;
this.finished = dependencies.finished;
this.simpleTransparency = dependencies.simpleTransparency;
this.headersFinished = dependencies.headersFinished || function(){};
this.headersFinished = dependencies.headersFinished || function() {};
};
Parser.prototype.start = function() {
@ -73,8 +73,8 @@ Parser.prototype._parseChunkBegin = function(data) {
// chunk flags
var ancillary = Boolean(data[4] & 0x20); // or critical
// priv = Boolean(data[5] & 0x20), // or public
// safeToCopy = Boolean(data[7] & 0x20); // or unsafe
// priv = Boolean(data[5] & 0x20), // or public
// safeToCopy = Boolean(data[7] & 0x20); // or unsafe
if (!this._hasIHDR && type !== constants.TYPE_IHDR) {
this.error(new Error('Expected IHDR on beggining'));

View file

@ -108,12 +108,12 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) {
assert(this._handle, 'zlib binding closed');
do {
var res = this._handle.writeSync(flushFlag,
chunk, // in
inOff, // in_off
availInBefore, // in_len
this._buffer, // out
this._offset, //out_off
availOutBefore); // out_len
chunk, // in
inOff, // in_off
availInBefore, // in_len
this._buffer, // out
this._offset, //out_off
availOutBefore); // out_len
// Node 8 --> 9 compatibility check
res = res || this._writeState;
} while (!this._hadError && handleChunk(res[0], res[1]));

View file

@ -9,7 +9,7 @@ var SyncReader = module.exports = function(buffer) {
SyncReader.prototype.read = function(length, callback) {
this._reads.push({
length: Math.abs(length), // if length < 0 then at most this length
length: Math.abs(length), // if length < 0 then at most this length
allowLess: length < 0,
func: callback
});

2636
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -60,7 +60,7 @@
"browserify": "^14.5.0",
"buffer-equal": "1.0.0",
"connect": "^3.4.0",
"eslint": "^3.2.2",
"eslint": "^4.1.0",
"istanbul": "^0.4.4",
"phantomjs-prebuilt": "^2.1.7",
"serve-static": "^1.10.0",