lint: Run eslint --fix on bin/ and tests/

This commit is contained in:
Richard Hansen 2020-11-23 13:21:51 -05:00 committed by John McLear
parent 0625739cb8
commit b8d07a42eb
78 changed files with 4319 additions and 4599 deletions

View file

@ -1,21 +1,21 @@
var assert = require('assert')
os = require('os'),
fs = require('fs'),
path = require('path'),
TidyHtml = null,
Settings = null;
const assert = require('assert');
os = require('os'),
fs = require('fs'),
path = require('path'),
TidyHtml = null,
Settings = null;
var npm = require("../../../../src/node_modules/npm/lib/npm.js");
var nodeify = require('../../../../src/node_modules/nodeify');
const npm = require('../../../../src/node_modules/npm/lib/npm.js');
const nodeify = require('../../../../src/node_modules/nodeify');
describe(__filename, function() {
describe('tidyHtml', function() {
before(function(done) {
npm.load({}, function(err) {
describe(__filename, function () {
describe('tidyHtml', function () {
before(function (done) {
npm.load({}, (err) => {
assert.ok(!err);
TidyHtml = require('../../../../src/node/utils/TidyHtml');
Settings = require('../../../../src/node/utils/Settings');
return done()
return done();
});
});
@ -23,7 +23,7 @@ describe(__filename, function() {
return nodeify(TidyHtml.tidy(file), callback);
}
it('Tidies HTML', function(done) {
it('Tidies HTML', function (done) {
// If the user hasn't configured Tidy, we skip this tests as it's required for this test
if (!Settings.tidyHtml) {
this.skip();
@ -32,15 +32,15 @@ describe(__filename, function() {
// Try to tidy up a bad HTML file
const tmpDir = os.tmpdir();
var tmpFile = path.join(tmpDir, 'tmp_' + (Math.floor(Math.random() * 1000000)) + '.html')
const tmpFile = path.join(tmpDir, `tmp_${Math.floor(Math.random() * 1000000)}.html`);
fs.writeFileSync(tmpFile, '<html><body><p>a paragraph</p><li>List without outer UL</li>trailing closing p</p></body></html>');
tidy(tmpFile, function(err){
tidy(tmpFile, (err) => {
assert.ok(!err);
// Read the file again
var cleanedHtml = fs.readFileSync(tmpFile).toString();
const cleanedHtml = fs.readFileSync(tmpFile).toString();
var expectedHtml = [
const expectedHtml = [
'<title></title>',
'</head>',
'<body>',
@ -57,13 +57,13 @@ describe(__filename, function() {
});
});
it('can deal with errors', function(done) {
it('can deal with errors', function (done) {
// If the user hasn't configured Tidy, we skip this tests as it's required for this test
if (!Settings.tidyHtml) {
this.skip();
}
tidy('/some/none/existing/file.html', function(err) {
tidy('/some/none/existing/file.html', (err) => {
assert.ok(err);
return done();
});