Skip to content

Commit

Permalink
no-unused-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
guyonroche committed May 17, 2017
1 parent d05bc70 commit d077ef4
Show file tree
Hide file tree
Showing 45 changed files with 67 additions and 144 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"no-plusplus": ["off"],
"no-unused-expressions": ["off"],
"global-require": ["off"],
"no-unused-vars": ["off"],
"no-path-concat": ["off"],
"prefer-rest-params": ["off"]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/csv/csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ CSV.prototype = {
var streamOptions = {
encoding: options.encoding || 'utf8'
};
var stream = fs.createWriteStream(filename, options);
var stream = fs.createWriteStream(filename, streamOptions);

return this.write(stream, options);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/csv/line-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ utils.inherits(LineBuffer, events.EventEmitter, {
// line: here is a line
// done: all lines emitted

write: function(chunk, encoding, callback) {
write: function(chunk, encoding) {
// find line or lines in chunk and emit them if not corked
// or queue them if corked
var data = this.buffer ? this.buffer + chunk : chunk;
Expand Down Expand Up @@ -56,10 +56,10 @@ utils.inherits(LineBuffer, events.EventEmitter, {
// tell the source I'm ready again
this.emit('drain');
},
setDefaultEncoding: function(encoding) {
setDefaultEncoding: function() {
// ?
},
end: function(chunk, encoding, callback) {
end: function(chunk, encoding) {
if (this.buffer) {
this.emit('line', this.buffer);
this.buffer = null;
Expand Down
1 change: 0 additions & 1 deletion lib/doc/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
'use strict';

var colCache = require('../utils/col-cache');
var utils = require('../utils/utils');
var Enums = require('./enums');
var { slideFormula } = require('../utils/shared-formula');

Expand Down
3 changes: 1 addition & 2 deletions lib/doc/worksheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

var _ = require('../utils/under-dash');

var utils = require('./../utils/utils');
var colCache = require('./../utils/col-cache');
var Range = require('./range');
var Row = require('./row');
Expand Down Expand Up @@ -423,7 +422,7 @@ Worksheet.prototype = {
},

get hasMerges() {
return _.some(this._merges, function(merge, address) {
return _.some(this._merges, function(merge) {
// TODO: this doesn't look right
return true;
});
Expand Down
1 change: 0 additions & 1 deletion lib/stream/xlsx/workbook-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var fs = require('fs');
var Archiver = require('archiver');
var PromishLib = require('../../utils/promish');

var utils = require('../../utils/utils');
var StreamBuf = require('../../utils/stream-buf');

var RelType = require('../../xlsx/rel-type');
Expand Down
5 changes: 1 addition & 4 deletions lib/stream/xlsx/worksheet-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

'use strict';

var fs = require('fs');
var events = require('events');
var Sax = require('sax');

Expand Down Expand Up @@ -81,19 +80,17 @@ utils.inherits(WorksheetReader, events.EventEmitter, {
this.emit('row', row);
},

read: function(entry, options, hyperlinkReader) {
read: function(entry, options) {
var self = this;

var emitSheet = false;
var prepSheet = false;
var emitHyperlinks = false;
var hyperlinks = null;
switch (options.worksheets) {
case 'emit':
emitSheet = true;
break;
case 'prep':
prepSheet = true;
break;
default:
break;
Expand Down
3 changes: 0 additions & 3 deletions lib/stream/xlsx/worksheet-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

'use strict';

var fs = require('fs');

var utils = require('../../utils/utils');
var RelType = require('../../xlsx/rel-type');

var colCache = require('../../utils/col-cache');
Expand Down
2 changes: 0 additions & 2 deletions lib/utils/cell-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
'use strict';

var _ = require('./under-dash');

var utils = require('./utils');
var colCache = require('./col-cache');

var CellMatrix = function(template) {
Expand Down
9 changes: 4 additions & 5 deletions lib/utils/flow-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,12 @@ utils.inherits(FlowControl, events.EventEmitter, {
return !stemFlow;
},

end: function(chunk, encoding, callback) {
end: function(chunk, encoding) {
// Signal from up-stream
var self = this;
this.queue.push({
callback: function() {
self.queue = null;
self.emit('finish');
callback: () => {
this.queue = null;
this.emit('finish');
}
});
this._flush();
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/shared-formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

var colCache = require('./col-cache');

var cellRefRegex = /(([a-z_\-0-9]*)!)?[$]?([a-z]+)[$]?([1-9][0-9]*)/i;
// var cellRefRegex = /(([a-z_\-0-9]*)!)?[$]?([a-z]+)[$]?([1-9][0-9]*)/i;
var replacementCandidateRx = /(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/ig;
var CRrx = /^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;

Expand Down
26 changes: 7 additions & 19 deletions lib/utils/stream-base64.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
'use strict';

var Stream = require('stream');
var PromishLib = require('./promish');

var utils = require('./utils');
var StringBuf = require('./string-buf');


// =============================================================================
// StreamBase64 - A utility to convert to/from base64 stream
// Note: does not buffer data, must be piped
var StreamBuf = module.exports = function(options) {
options = options || {};

var StreamBuf = module.exports = function() {
// consuming pipe streams go here
this.pipes = [];
};
Expand All @@ -25,20 +19,14 @@ utils.inherits(StreamBuf, Stream.Duplex, {
// unpipe(src) - unpipe() has been called on readable
// error - duh

write: function(data, encoding, callback) {
if (encoding instanceof Function) {
callback = encoding;
encoding = 'utf8';
}
callback = callback || utils.nop;

write: function(/* data, encoding */) {
return true;
},
cork: function() {
},
uncork: function() {
},
end: function(chunk, encoding, callback) {
end: function(/* chunk, encoding, callback */) {
},

// readable
Expand All @@ -47,7 +35,7 @@ utils.inherits(StreamBuf, Stream.Duplex, {
// event end - no more data
// event close - optional, indicates upstream close
// event error - duh
read: function(size) {
read: function(/* size */) {
},
setEncoding: function(encoding) {
// causes stream.read or stream.on('data) to return strings of encoding instead of Buffer objects
Expand All @@ -59,7 +47,7 @@ utils.inherits(StreamBuf, Stream.Duplex, {
},
isPaused: function() {
},
pipe: function(destination, options) {
pipe: function(/* destination, options */) {
// add destination to pipe list & write current buffer
this.pipes.push(destination);
},
Expand All @@ -69,12 +57,12 @@ utils.inherits(StreamBuf, Stream.Duplex, {
return pipe !== destination;
});
},
unshift: function(chunk) {
unshift: function(/* chunk */) {
// some numpty has read some data that's not for them and they want to put it back!
// Might implement this some day
throw new Error('Not Implemented');
},
wrap: function(stream) {
wrap: function(/* stream */) {
// not implemented
throw new Error('Not Implemented');
}
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/stream-buf.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ utils.inherits(StreamBuf, Stream.Duplex, {
isPaused: function() {
return !!this.paused;
},
pipe: function(destination, options) {
pipe: function(destination) {
// add destination to pipe list & write current buffer
this.pipes.push(destination);
if (!this.paused && this.buffers.length) {
Expand All @@ -344,12 +344,12 @@ utils.inherits(StreamBuf, Stream.Duplex, {
return pipe !== destination;
});
},
unshift: function(chunk) {
unshift: function(/* chunk */) {
// some numpty has read some data that's not for them and they want to put it back!
// Might implement this some day
throw new Error('Not Implemented');
},
wrap: function(stream) {
wrap: function(/* stream */) {
// not implemented
throw new Error('Not Implemented');
}
Expand Down
2 changes: 0 additions & 2 deletions lib/utils/string-buf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

'use strict';

var utils = require('./utils');

// StringBuf - a way to keep string memory operations to a minimum
// while building the strings for the xml files
var StringBuf = module.exports = function(options) {
Expand Down
7 changes: 1 addition & 6 deletions lib/utils/string-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@

'use strict';


var utils = require('./utils');

var nop = function() {};

// StringBuf - a way to keep string memory operations to a minimum
// while building the strings for the xml files
var StringBuf = module.exports = function(options) {
var StringBuf = module.exports = function() {
this.reset();
};

Expand Down
4 changes: 2 additions & 2 deletions lib/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var inherits = function(cls, superCtor, statics, prototype) {
var utils = module.exports = {
nop: function() {},
promiseImmediate: function(value) {
return new PromishLib.Promish(function(resolve, reject) {
return new PromishLib.Promish(function(resolve) {
if (global.setImmediate) {
setImmediate(function() {
resolve(value);
Expand Down Expand Up @@ -119,7 +119,7 @@ var utils = module.exports = {

fs: {
exists: function(path) {
return new PromishLib.Promish(function(resolve, reject) {
return new PromishLib.Promish(function(resolve) {
fs.exists(path, function(exists) {
resolve(exists);
});
Expand Down
14 changes: 7 additions & 7 deletions lib/xlsx/xform/base-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ var PromishLib = require('../../utils/promish');
var XmlStream = require('../../utils/xml-stream');

// Base class for Xforms
var BaseXform = module.exports = function(model, name) {
var BaseXform = module.exports = function(/* model, name */) {
};

BaseXform.prototype = {
// ============================================================
// Virtual Interface
prepare: function(model, options) {
prepare: function(/* model, options */) {
// optional preparation (mutation) of model so it is ready for write
},
render: function(xmlStream, model) {
render: function(/* xmlStream, model */) {
// convert model to xml
},
parseOpen: function(node) {
parseOpen: function(/* node */) {
// Sax Open Node event
},
parseText: function(node) {
parseText: function(/* node */) {
// Sax Text event
},
parseClose: function(name) {
parseClose: function(/* name */) {
// Sax Close Node event
},
reconcile: function(model, options) {
reconcile: function(/* model, options */) {
// optional post-parse step (opposite to prepare)
},

Expand Down
6 changes: 0 additions & 6 deletions lib/xlsx/xform/core/app-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ var StringXform = require('../simple/string-xform');
var AppHeadingPairsXform = require('./app-heading-pairs-xform');
var AppTitleOfPartsXform = require('./app-titles-of-parts-xform');

var props = {
company: 'Company',
manager: 'Manager',
worksheets: [{name: 'sheet1'}]
};

var AppXform = module.exports = function() {
this.map = {
'Company': new StringXform({tag: 'Company'}),
Expand Down
1 change: 0 additions & 1 deletion lib/xlsx/xform/drawing/blip-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

var utils = require('../../../utils/utils');
var BaseXform = require('../base-xform');
var IntegerXform = require('../simple/integer-xform');

var BlipXform = module.exports = function() {
};
Expand Down
4 changes: 1 addition & 3 deletions lib/xlsx/xform/drawing/drawing-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

'use strict';

var events = require('events');

var utils = require('../../../utils/utils');
var XmlStream = require('../../../utils/xml-stream');

Expand All @@ -28,7 +26,7 @@ utils.inherits(WorkSheetXform, BaseXform, {
}, {
get tag() { return 'xdr:wsDr'; },

prepare: function(model, options) {
prepare: function(model) {
var twoCellAnchorXform = this.map['xdr:twoCellAnchor'];
model.anchors.forEach(function(item, index) {
twoCellAnchorXform.prepare(item, {index: index});
Expand Down
2 changes: 1 addition & 1 deletion lib/xlsx/xform/drawing/pic-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var NvPicPrXform = require('./nv-pic-pr-xform');

var spPrJSON = require('./sp-pr');

var PicXform = module.exports = function(options) {
var PicXform = module.exports = function() {
this.map = {
'xdr:nvPicPr': new NvPicPrXform(),
'xdr:blipFill': new BlipFillXform(),
Expand Down
3 changes: 0 additions & 3 deletions lib/xlsx/xform/drawing/two-cell-anchor-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

'use strict';

var _ = require('../../../utils/under-dash');
var utils = require('../../../utils/utils');
var colCache = require('../../../utils/col-cache');
var BaseXform = require('../base-xform');
Expand Down Expand Up @@ -44,8 +43,6 @@ utils.inherits(TwoCellAnchorXform, BaseXform, {
row: range.bottom
};
} else {
// API specifies zero based coords
const { row, col } = model.range.tl;
model.tl = model.range.tl;
model.br = model.range.br;
}
Expand Down
1 change: 0 additions & 1 deletion lib/xlsx/xform/sheet/cell-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var utils = require('../../../utils/utils');
var BaseXform = require('../base-xform');

var Enums = require('../../../doc/enums');
var RelType = require('../../rel-type');
var Range = require('../../../doc/range');


Expand Down
Loading

0 comments on commit d077ef4

Please sign in to comment.