Skip to content

Commit eefaaa2

Browse files
committed
style(eslint): Fix ESLint errors
1 parent d40463d commit eefaaa2

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

lib/preprocessor.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var _ = require('lodash')
1313
var SourceMapConsumer = require('source-map').SourceMapConsumer
1414
var SourceMapGenerator = require('source-map').SourceMapGenerator
1515
var globalSourceCache = require('./source-cache')
16-
var extend = require('util')._extend
1716
var coverageMap = require('./coverage-map')
1817

1918
// Regexes
@@ -29,13 +28,13 @@ function createCoveragePreprocessor (logger, helper, basePath, reporters, covera
2928
// -------
3029

3130
var instrumenterOverrides = {}
32-
var instrumenters = {istanbul: istanbul}
31+
var instrumenters = { istanbul: istanbul }
3332
var includeAllSources = false
3433
var useJSExtensionForCoffeeScript = false
3534

3635
if (coverageReporter) {
3736
instrumenterOverrides = coverageReporter.instrumenter
38-
instrumenters = extend({istanbul: istanbul}, coverageReporter.instrumenters)
37+
instrumenters = Object.assign({}, { istanbul: istanbul }, coverageReporter.instrumenters)
3938
includeAllSources = coverageReporter.includeAllSources === true
4039
useJSExtensionForCoffeeScript = coverageReporter.useJSExtensionForCoffeeScript === true
4140
}
@@ -84,7 +83,7 @@ function createCoveragePreprocessor (logger, helper, basePath, reporters, covera
8483
var instrumenterLiteral = 'istanbul'
8584

8685
_.forEach(instrumenterOverrides, function (literal, pattern) {
87-
if (minimatch(file.originalPath, pattern, {dot: true})) {
86+
if (minimatch(file.originalPath, pattern, { dot: true })) {
8887
instrumenterLiteral = String(literal)
8988
}
9089
})
@@ -95,7 +94,7 @@ function createCoveragePreprocessor (logger, helper, basePath, reporters, covera
9594

9695
if (file.sourceMap) {
9796
log.debug('Enabling source map generation for "%s".', file.originalPath)
98-
codeGenerationOptions = extend({
97+
codeGenerationOptions = Object.assign({}, {
9998
format: {
10099
compact: !constructOptions.noCompact
101100
},
@@ -105,8 +104,8 @@ function createCoveragePreprocessor (logger, helper, basePath, reporters, covera
105104
}, constructOptions.codeGenerationOptions || {})
106105
}
107106

108-
var options = extend({}, constructOptions)
109-
options = extend(options, {codeGenerationOptions: codeGenerationOptions})
107+
var options = Object.assign({}, constructOptions)
108+
options = Object.assign({}, options, { codeGenerationOptions: codeGenerationOptions })
110109

111110
var instrumenter = new InstrumenterConstructor(options)
112111
instrumenter.instrument(content, jsPath, function (err, instrumentedCode) {
@@ -120,7 +119,7 @@ function createCoveragePreprocessor (logger, helper, basePath, reporters, covera
120119
generator.applySourceMap(new SourceMapConsumer(file.sourceMap))
121120
file.sourceMap = JSON.parse(generator.toString())
122121
instrumentedCode += '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,'
123-
instrumentedCode += new Buffer(JSON.stringify(file.sourceMap)).toString('base64') + '\n'
122+
instrumentedCode += Buffer.from(JSON.stringify(file.sourceMap)).toString('base64') + '\n'
124123
}
125124

126125
// remember the actual immediate instrumented JS for given original path

lib/reporter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var CoverageReporter = function (rootConfig, helper, logger, emitter) {
9898
Object.keys(covObj).forEach(function (key) {
9999
// Do any patterns match the resolved key
100100
var found = patterns.some(function (pattern) {
101-
return minimatch(normalize(key), pattern, {dot: true})
101+
return minimatch(normalize(key), pattern, { dot: true })
102102
})
103103

104104
// if no patterns match, keep the key
@@ -115,7 +115,7 @@ var CoverageReporter = function (rootConfig, helper, logger, emitter) {
115115

116116
// First match wins
117117
Object.keys(overrides).some(function (pattern) {
118-
if (minimatch(normalize(key), pattern, {dot: true})) {
118+
if (minimatch(normalize(key), pattern, { dot: true })) {
119119
thresholds = overrides[pattern]
120120
return true
121121
}
@@ -283,7 +283,7 @@ var CoverageReporter = function (rootConfig, helper, logger, emitter) {
283283
})
284284
var reporter = istanbul.Report.create(reporterConfig.type || 'html', options)
285285

286-
// If reporting to console or in-memory skip directory creation
286+
// If reporting to console or in-memory skip directory creation
287287
var toDisk = !reporterConfig.type || !reporterConfig.type.match(/^(text|text-summary|in-memory)$/)
288288
var hasNoFile = _.isUndefined(reporterConfig.file)
289289

@@ -307,8 +307,8 @@ var CoverageReporter = function (rootConfig, helper, logger, emitter) {
307307
if (pendingFileWritings) {
308308
fileWritingFinished = (
309309
typeof config._onExit === 'function'
310-
? (function (done) { return function () { config._onExit(done) } }(done))
311-
: done
310+
? (function (done) { return function () { config._onExit(done) } }(done))
311+
: done
312312
)
313313
} else {
314314
(typeof config._onExit === 'function' ? config._onExit(done) : done())

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
"sinon": "^1.14.1",
5858
"sinon-chai": "^2.8.0"
5959
},
60+
"engines": {
61+
"node": ">=6.0.0"
62+
},
6063
"contributors": [
6164
"dignifiedquire <[email protected]>",
6265
"Friedel Ziegelmayer <[email protected]>",

0 commit comments

Comments
 (0)