Skip to content

Commit

Permalink
final lint updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydanielsencision committed Aug 30, 2024
1 parent e476594 commit 7091872
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 28 deletions.
1 change: 1 addition & 0 deletions .github/workflows/node-pr-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
- run: npm test
48 changes: 28 additions & 20 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var archiver, duplex, sheetStream, templates, through, utils, xlsxStream, _;

through = require('through');
Expand Down Expand Up @@ -96,33 +98,39 @@ module.exports = xlsxStream = function (opts) {
});
_ref1 = templates.statics;
for (name in _ref1) {
buffer = _ref1[name];
zip.append(buffer, {
name: name,
store: opts.store,
});
if (_ref1.hasOwnProperty(name)) {
buffer = _ref1[name];
zip.append(buffer, {
name: name,
store: opts.store,
});
}
}
_ref2 = templates.semiStatics;
for (name in _ref2) {
func = _ref2[name];
zip.append(func(opts), {
name: name,
store: opts.store,
});
if (_ref2.hasOwnProperty(name)) {
func = _ref2[name];
zip.append(func(opts), {
name: name,
store: opts.store,
});
}
}
_ref3 = templates.sheet_related;
for (name in _ref3) {
obj = _ref3[name];
buffer = obj.header;
for (_j = 0, _len1 = sheets.length; _j < _len1; _j++) {
sheet = sheets[_j];
buffer += obj.sheet(sheet);
if (_ref3.hasOwnProperty(name)) {
obj = _ref3[name];
buffer = obj.header;
for (_j = 0, _len1 = sheets.length; _j < _len1; _j++) {
sheet = sheets[_j];
buffer += obj.sheet(sheet);
}
buffer += obj.footer;
zip.append(buffer, {
name: name,
store: opts.store,
});
}
buffer += obj.footer;
zip.append(buffer, {
name: name,
store: opts.store,
});
}
return zip.finalize(function (e, bytes) {
if (e != null) {
Expand Down
17 changes: 11 additions & 6 deletions lib/sheet.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var sheetStream, template, through, utils, _;

_ = require('lodash');
Expand All @@ -7,7 +9,7 @@ through = require('through');
utils = require('./utils');

template = require('./templates');
worksheetTemplates = template.worksheet;
const worksheetTemplates = template.worksheet;

module.exports = sheetStream = function (zip, sheet, opts) {
var colChar, converter, nRow, onData, onEnd;
Expand All @@ -20,7 +22,7 @@ module.exports = sheetStream = function (zip, sheet, opts) {
onData = function (row) {
var buf, col, i, val, _i, _j, _len, _len1, _ref;
nRow++;
buf = "<row r='" + nRow + "'>";
buf = '<row r="' + nRow + '">';
if (opts.columns != null) {
_ref = opts.columns;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
Expand All @@ -47,11 +49,14 @@ module.exports = sheetStream = function (zip, sheet, opts) {

if (links.length > 0) {
let rel = template.rels;
let name;
for (name in rel) {
func = rel[name];
zip.append(func(links), {
name: name,
});
if (!rel.hasOwnProperty(name)) {
const func = rel[name];
zip.append(func(links), {
name: name,
});
}
}
this.queue(worksheetTemplates.hyperLinkStart);
let linkCounter = 0;
Expand Down
4 changes: 3 additions & 1 deletion lib/templates.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var esc, utils, xml;

utils = require('./utils');
Expand Down Expand Up @@ -153,7 +155,7 @@ module.exports = {
},
rels: {
'xl/worksheets/_rels/sheet1.xml.rels': function (links) {
xmlString = xml(
const xmlString = xml(
'<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n',
);
let linksCounter = 0;
Expand Down
2 changes: 2 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var compress, escapeXML, _;

_ = require('lodash');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"test": "mocha",
"lint": "prettier --check . && eslint --max-warnings=0 .",
"lint": "eslint .",
"prettier": "prettier --write --single-quote .",
"fix": "eslint --fix .",
"build": "npm install"
Expand Down

0 comments on commit 7091872

Please sign in to comment.