Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update eslint packages to latest and fix complaints #3312

Merged
merged 1 commit into from Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/karma.js
Expand Up @@ -113,7 +113,7 @@ function Karma (socket, iframe, opener, navigator, location) {
values.push(this.stringify(args[i], 3))
}

this.info({log: values.join(', '), type: type})
this.info({ log: values.join(', '), type: type })
}

this.stringify = stringify
Expand Down Expand Up @@ -159,7 +159,7 @@ function Karma (socket, iframe, opener, navigator, location) {
} else {
// create an object with the string representation of the message to
// ensure all its content is properly transferred to the console log
message = {message: messageOrEvent, str: messageOrEvent.toString()}
message = { message: messageOrEvent, str: messageOrEvent.toString() }
}

socket.emit('karma_error', message)
Expand All @@ -184,7 +184,7 @@ function Karma (socket, iframe, opener, navigator, location) {
}

if (!startEmitted) {
socket.emit('start', {total: null})
socket.emit('start', { total: null })
startEmitted = true
}

Expand Down
4 changes: 2 additions & 2 deletions context/karma.js
Expand Up @@ -17,7 +17,7 @@ function ContextKarma (callParentKarmaMethod) {
values.push(this.stringify(args[i], 3))
}

this.info({log: values.join(', '), type: type})
this.info({ log: values.join(', '), type: type })
}

this.stringify = stringify
Expand Down Expand Up @@ -153,7 +153,7 @@ ContextKarma.getDirectCallParentKarmaMethod = function (parentWindow) {
}
ContextKarma.getPostMessageCallParentKarmaMethod = function (parentWindow) {
return function postMessageCallParentKarmaMethod (method, args) {
parentWindow.postMessage({__karmaMethod: method, __karmaArguments: args}, window.location.origin)
parentWindow.postMessage({ __karmaMethod: method, __karmaArguments: args }, window.location.origin)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/completion.js
Expand Up @@ -56,7 +56,7 @@ function sendCompletionFiles (env) {
if (err) return console.error(err)

if (files.length === 1 && files[0].endsWith('/')) {
sendCompletionFiles({last: files[0]})
sendCompletionFiles({ last: files[0] })
} else {
console.log(files.join('\n'))
}
Expand Down
2 changes: 1 addition & 1 deletion lib/helper.js
Expand Up @@ -62,7 +62,7 @@ exports.mmPatternWeight = (pattern) => {
const result = m.globParts.reduce((prev, p) => {
const r = p.reduce((prev, p) => {
return gsParser(p, prev)
}, {glob_star: 0, ext_glob: 0, word: 0, star: 0, optional: 0, range: 0})
}, { glob_star: 0, ext_glob: 0, word: 0, star: 0, optional: 0, range: 0 })
if (prev === undefined) return r
return compareWeightObject(r, prev) > 0 ? r : prev
}, undefined)
Expand Down
2 changes: 1 addition & 1 deletion lib/logger.js
Expand Up @@ -45,7 +45,7 @@ function setup (level, colors, appenders) {
})
}
} else {
appenders = {'console': constant.CONSOLE_APPENDER}
appenders = { 'console': constant.CONSOLE_APPENDER }
}

log4js.configure({
Expand Down
1 change: 1 addition & 0 deletions lib/middleware/karma.js
Expand Up @@ -42,6 +42,7 @@ function filePathToUrlPath (filePath, basePath, urlRoot, proxyPath) {
}

function getQuery (urlStr) {
// eslint-disable-next-line node/no-deprecated-api
return url.parse(urlStr, true).query || {}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/middleware/proxy.js
Expand Up @@ -8,9 +8,10 @@ function parseProxyConfig (proxies, config) {
proxies = proxies || []
return _.sortBy(_.map(proxies, function (proxyConfiguration, proxyPath) {
if (typeof proxyConfiguration === 'string') {
proxyConfiguration = {target: proxyConfiguration}
proxyConfiguration = { target: proxyConfiguration }
}
let proxyUrl = proxyConfiguration.target
// eslint-disable-next-line node/no-deprecated-api
const proxyDetails = url.parse(proxyUrl)
let pathname = proxyDetails.pathname

Expand Down
2 changes: 1 addition & 1 deletion lib/preprocessor.js
Expand Up @@ -91,7 +91,7 @@ function createPreprocessor (config, basePath, injector) {

let preprocessorNames = []
patterns.forEach((pattern) => {
if (mm(file.originalPath, pattern, {dot: true})) {
if (mm(file.originalPath, pattern, { dot: true })) {
preprocessorNames = _.union(preprocessorNames, config[pattern])
}
})
Expand Down
1 change: 1 addition & 0 deletions lib/reporter.js
@@ -1,5 +1,6 @@
'use strict'

// eslint-disable-next-line node/no-deprecated-api
const resolve = require('url').resolve
const SourceMapConsumer = require('source-map').SourceMapConsumer
const _ = require('lodash')
Expand Down
2 changes: 1 addition & 1 deletion lib/server.js
Expand Up @@ -221,7 +221,7 @@ class Server extends KarmaEventEmitter {
if (!helper.isString(message)) {
message = util.inspect(message, { showHidden: false, colors: false })
}
const logMap = {'%m': message, '%t': level.toLowerCase(), '%T': level.toUpperCase(), '%b': browser}
const logMap = { '%m': message, '%t': level.toLowerCase(), '%T': level.toUpperCase(), '%b': browser }
const logString = configFormat.replace(/%[mtTb]/g, (m) => logMap[m])
this.log.debug(`Writing browser console line: ${logString}`)
fs.writeSync(browserLogFile, logString + '\n')
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/json-utils.js
@@ -1,5 +1,5 @@

const {stringify} = require('flatted/cjs')
const { stringify } = require('flatted/cjs')

const JsonUtils = {
stringify (obj) {
Expand Down
2 changes: 1 addition & 1 deletion lib/watcher.js
Expand Up @@ -27,7 +27,7 @@ function watchPatterns (patterns, watcher) {
}

function checkAnyPathMatch (patterns, path) {
return patterns.some((pattern) => mm(path, pattern, {dot: true}))
return patterns.some((pattern) => mm(path, pattern, { dot: true }))
}

function createIgnore (patterns, excludes) {
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -416,12 +416,12 @@
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.2.2",
"cucumber": "^3.1.0",
"eslint": "^4.11.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.4.2",
"eslint-plugin-standard": "^3.0.1",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"grunt": "^1.0.4",
"grunt-auto-release": "^0.0.7",
"grunt-browserify": "^5.0.0",
Expand All @@ -432,7 +432,7 @@
"grunt-conventional-changelog": "^6.0.1",
"grunt-conventional-github-releaser": "^1.0.0",
"grunt-cucumberjs": "^2.0.2",
"grunt-eslint": "^20.1.0",
"grunt-eslint": "^21.0.0",
"grunt-mocha-test": "^0.13.2",
"grunt-npm": "0.0.2",
"http2": "^3.3.6",
Expand Down
4 changes: 2 additions & 2 deletions tasks/test.js
Expand Up @@ -16,9 +16,9 @@ module.exports = function (grunt) {
grunt.log.writeln(['Running', cmd].concat(args).join(' '))
var child
if (process.platform === 'win32') {
child = grunt.util.spawn({cmd: node, args: [cmd].concat(args)}, callback)
child = grunt.util.spawn({ cmd: node, args: [cmd].concat(args) }, callback)
} else {
child = grunt.util.spawn({cmd: cmd, args: args}, callback)
child = grunt.util.spawn({ cmd: cmd, args: args }, callback)
}
child.stdout.pipe(process.stdout)
child.stderr.pipe(process.stderr)
Expand Down
38 changes: 19 additions & 19 deletions test/client/karma.spec.js
Expand Up @@ -19,7 +19,7 @@ describe('Karma', function () {
socket = new MockSocket()
iframe = {}
windowNavigator = {}
windowLocation = {search: ''}
windowLocation = { search: '' }
windowStub = sinon.stub().returns({})

k = new ClientKarma(socket, iframe, windowStub, windowNavigator, windowLocation)
Expand Down Expand Up @@ -76,11 +76,11 @@ describe('Karma', function () {
ck.start = ADAPTER_START_FN
ck.error('syntax error', '/some/file.js', 11)
ck.loaded()
assert.notEqual(ck.start, ADAPTER_START_FN)
assert.notStrictEqual(ck.start, ADAPTER_START_FN)

ck.start = ADAPTER_START_FN
ck.loaded()
assert.notEqual(k.start, ADAPTER_START_FN)
assert.notStrictEqual(k.start, ADAPTER_START_FN)
})

it('should not set up context if there was an error', function () {
Expand Down Expand Up @@ -180,12 +180,12 @@ describe('Karma', function () {

// emit 49 results
for (var i = 1; i < 50; i++) {
ck.result({id: i})
ck.result({ id: i })
}

assert(!spyResult.called)

ck.result('result', {id: 50})
ck.result('result', { id: 50 })
assert(spyResult.called)
assert(spyResult.args[0][0].length === 50)
})
Expand All @@ -198,7 +198,7 @@ describe('Karma', function () {

// emit 40 results
for (var i = 1; i <= 40; i++) {
ck.result({id: i})
ck.result({ id: i })
}

ck.complete()
Expand All @@ -221,7 +221,7 @@ describe('Karma', function () {

// adapter didn't call info({total: x})
ck.result()
assert.deepEqual(log, ['start', 'result'])
assert.deepStrictEqual(log, ['start', 'result'])
})

it('should not emit "start" if already done by the adapter', function () {
Expand All @@ -240,10 +240,10 @@ describe('Karma', function () {

setTransportTo('websocket')

ck.info({total: 321})
ck.info({ total: 321 })
ck.result()
assert.deepEqual(log, ['start', 'result'])
assert(spyStart.calledWith({total: 321}))
assert.deepStrictEqual(log, ['start', 'result'])
assert(spyStart.calledWith({ total: 321 }))
})
})

Expand Down Expand Up @@ -276,8 +276,8 @@ describe('Karma', function () {
ck.setupContext(mockWindow)
var confirmResult = mockWindow.confirm('What?')
assert(ck.log.calledWith('confirm', ['What?']))
assert.equal(confirmCalled, true)
assert.equal(confirmResult, true)
assert.strictEqual(confirmCalled, true)
assert.strictEqual(confirmResult, true)
})

it('should capture prompt', function () {
Expand All @@ -294,8 +294,8 @@ describe('Karma', function () {
ck.setupContext(mockWindow)
var promptResult = mockWindow.prompt('What is your favorite color?', 'blue')
assert(ck.log.calledWith('prompt', ['What is your favorite color?', 'blue']))
assert.equal(promptCalled, true)
assert.equal(promptResult, 'user-input')
assert.strictEqual(promptCalled, true)
assert.strictEqual(promptResult, 'user-input')
})

it('should patch the console if captureConsole is true', function () {
Expand Down Expand Up @@ -344,7 +344,7 @@ describe('Karma', function () {
ck.setupContext(mockWindow)
mockWindow.console.log('What?')
assert(ck.log.calledWith('log'))
assert.equal(ck.log.args[0][1][0], 'What?')
assert.strictEqual(ck.log.args[0][1][0], 'What?')
assert(ck.log.calledWith('warn'))
assert(/^Console method log threw:[\s\S]+I am a broken console\.log method/.test(ck.log.args[1][1][0]))
})
Expand All @@ -369,7 +369,7 @@ describe('Karma', function () {

// emit 40 results
for (var i = 0; i < 40; i++) {
ck.result({id: i})
ck.result({ id: i })
}

assert(!spyResult.called)
Expand All @@ -382,7 +382,7 @@ describe('Karma', function () {
windowLocation.search = '?id=567&return_url=http://return.com'
socket = new MockSocket()
k = new ClientKarma(socket, {}, windowStub, windowNavigator, windowLocation)
clientWindow = {karma: k}
clientWindow = { karma: k }
ck = new ContextKarma(ContextKarma.getDirectCallParentKarmaMethod(clientWindow))
ck.config = {}

Expand Down Expand Up @@ -415,7 +415,7 @@ describe('Karma', function () {
// clock.tick() does not work in IE 7
setTimeout(function () {
clock.tick(1)
assert.notEqual(iframe.src, CURRENT_URL)
assert.notStrictEqual(iframe.src, CURRENT_URL)
}, 10)
})

Expand All @@ -431,7 +431,7 @@ describe('Karma', function () {

clock.tick(1)

assert.equal(iframe.src, CURRENT_URL)
assert.strictEqual(iframe.src, CURRENT_URL)
})

it('should accept multiple calls to loaded', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/client/mocks.js
Expand Up @@ -25,7 +25,7 @@ function Emitter () {
function MockSocket () {
Emitter.call(this)

this.socket = {transport: {name: 'websocket'}}
this.socket = { transport: { name: 'websocket' } }

var transportName = 'websocket'

Expand Down