Skip to content

Commit

Permalink
ASL-4149 - lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaz1634 committed Nov 18, 2022
1 parent 1172c06 commit 304d711
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
1 change: 0 additions & 1 deletion controllers/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ module.exports = router.post('/',
next(err);
});
});

4 changes: 2 additions & 2 deletions lib/missing-data.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';

const _ = require('lodash');
const mustacheRe = /{{\s*[\w\.]+\s*}}/g;
const mustacheRe = /{{\s*[\w.]+\s*}}/g;

// Compares the data to the template placeholders and
// returns a comma separated string of missing items from the data
module.exports = (template, data) => {
const keys = _.keys(data);
const list = _.map(template.match(mustacheRe), x => {
return x.match(/[\w\.]+/)[0];
return x.match(/[\w.]+/)[0];
});
return _.difference(list, keys);
};
14 changes: 7 additions & 7 deletions models/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ module.exports = class PDFConverterModel {

const opts = {
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--ignore-certificate-errors'
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--ignore-certificate-errors'
]
};

options = Object.assign({
const optionsWithFormatAndWaitUntil = Object.assign({
format: 'A4',
waitUntil: 'load'
}, options);
Expand All @@ -24,8 +24,8 @@ module.exports = class PDFConverterModel {
.then(browser => {
return browser.newPage()
.then(page => {
return page.setContent(html, { waitUntil: options.waitUntil })
.then(() => page.pdf(options))
return page.setContent(html, { waitUntil: optionsWithFormatAndWaitUntil.waitUntil })
.then(() => page.pdf(optionsWithFormatAndWaitUntil))
.then(data => Buffer.from(data, 'base64'));
})
.then(data => {
Expand Down
2 changes: 2 additions & 0 deletions test/integration/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const sinon = require('sinon');
const assert = require('assert');
const supertest = require('supertest');
const puppeteer = require('puppeteer');
const mustache = require('mustache');
Expand Down
1 change: 1 addition & 0 deletions test/unit/lib/missing-data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const assert = require('assert');
const path = require('path');
const fs = require('fs');
const missingData = require('../../../lib/missing-data');
Expand Down
2 changes: 2 additions & 0 deletions test/unit/middleware/validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const sinon = require('sinon');
const assert = require('assert');
const validate = require('../../../middleware/validate');
const ValidationError = require('../../../lib/validation-error');

Expand Down

0 comments on commit 304d711

Please sign in to comment.