From 7091872513288561c919ca5ff4d4520a130c8cc6 Mon Sep 17 00:00:00 2001 From: Jay Danielsen Date: Fri, 30 Aug 2024 07:28:44 -0400 Subject: [PATCH] final lint updates --- .github/workflows/node-pr-pipeline.yaml | 1 + lib/index.js | 48 ++++++++++++++----------- lib/sheet.js | 17 +++++---- lib/templates.js | 4 ++- lib/utils.js | 2 ++ package.json | 2 +- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/.github/workflows/node-pr-pipeline.yaml b/.github/workflows/node-pr-pipeline.yaml index 327f584..469cd2e 100644 --- a/.github/workflows/node-pr-pipeline.yaml +++ b/.github/workflows/node-pr-pipeline.yaml @@ -27,4 +27,5 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present + - run: npm run lint - run: npm test diff --git a/lib/index.js b/lib/index.js index 08983f5..090e0b4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,3 +1,5 @@ +'use strict'; + var archiver, duplex, sheetStream, templates, through, utils, xlsxStream, _; through = require('through'); @@ -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) { diff --git a/lib/sheet.js b/lib/sheet.js index 40a5e5b..7446386 100644 --- a/lib/sheet.js +++ b/lib/sheet.js @@ -1,3 +1,5 @@ +'use strict'; + var sheetStream, template, through, utils, _; _ = require('lodash'); @@ -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; @@ -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 = ""; + buf = ''; if (opts.columns != null) { _ref = opts.columns; for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { @@ -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; diff --git a/lib/templates.js b/lib/templates.js index 65a10c9..427943d 100644 --- a/lib/templates.js +++ b/lib/templates.js @@ -1,3 +1,5 @@ +'use strict'; + var esc, utils, xml; utils = require('./utils'); @@ -153,7 +155,7 @@ module.exports = { }, rels: { 'xl/worksheets/_rels/sheet1.xml.rels': function (links) { - xmlString = xml( + const xmlString = xml( '\n', ); let linksCounter = 0; diff --git a/lib/utils.js b/lib/utils.js index 9121b6f..6a22455 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,3 +1,5 @@ +'use strict'; + var compress, escapeXML, _; _ = require('lodash'); diff --git a/package.json b/package.json index 398bc59..9a79100 100644 --- a/package.json +++ b/package.json @@ -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"