Use standard and prettier (#10)

* switch from custom eslint config to standard + prettier

* fix new standard eslint violations

* add editorconfig file

* auto-fix all other violations

* update lint yarn script

* remove jshint comment
This commit is contained in:
Spencer
2019-07-09 13:24:13 -07:00
committed by GitHub
parent f69840c50f
commit 7c1573fb07
119 changed files with 4506 additions and 3521 deletions

View File

@ -1,17 +1,18 @@
module.exports = function (makeLogger) {
module.exports = function(makeLogger) {
var expect = require('expect.js');
var stub = require('../utils/auto_release_stub').make();
var fs = require('fs');
var once = require('events').EventEmitter.prototype.once;
var _ = require('lodash');
describe('buffer flush', function () {
describe('buffer flush', function() {
if (require('stream').Writable) {
it('writes everything in the buffer to console.error', function () {
var line = 'This string is written 10 times to create buffered output\n';
it('writes everything in the buffer to console.error', function() {
var line =
'This string is written 10 times to create buffered output\n';
var exitHandler;
stub(process, 'once', function (event, handler) {
stub(process, 'once', function(event, handler) {
if (event === 'exit') {
exitHandler = handler;
}
@ -21,13 +22,13 @@ module.exports = function (makeLogger) {
var logger = makeLogger();
// write the line 10 times
_.times(10, function () {
_.times(10, function() {
logger.onDebug(line);
});
// collect everything that is written to fs.appendFileSync
var flushedOutput = '';
stub(fs, 'appendFileSync', function (path, str) {
stub(fs, 'appendFileSync', function(path, str) {
flushedOutput += str;
});
@ -36,12 +37,15 @@ module.exports = function (makeLogger) {
// the first line is sent immediately to _write and there is nothing we can do about that
expect(flushedOutput).to.match(new RegExp(line));
expect(flushedOutput.match(new RegExp(line, 'g'))).to.have.property('length', 9);
expect(flushedOutput.match(new RegExp(line, 'g'))).to.have.property(
'length',
9
);
});
} else {
it('does not fall apart with non streams2 streams', function () {
it('does not fall apart with non streams2 streams', function() {
var exitHandler;
stub(process, 'once', function (event, handler) {
stub(process, 'once', function(event, handler) {
if (event === 'exit') {
exitHandler = handler;
}
@ -50,7 +54,7 @@ module.exports = function (makeLogger) {
makeLogger();
expect(function () {
expect(function() {
// call the event handler
exitHandler.call(process);
}).to.not.throwError();