Skip to content

Commit

Permalink
[meta] Fix eslint comma-dangle violations
Browse files Browse the repository at this point in the history
  • Loading branch information
brendo authored and ljharb committed Oct 28, 2019
1 parent a0614a7 commit 1b96580
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/rules/no-extraneous-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function extractDepFields(pkg) {
peerDependencies: pkg.peerDependencies || {},
// BundledDeps should be in the form of an array, but object notation is also supported by
// `npm`, so we convert it to an array if it is an object
bundledDependencies: arrayOrKeys(pkg.bundleDependencies || pkg.bundledDependencies || [])
bundledDependencies: arrayOrKeys(pkg.bundleDependencies || pkg.bundledDependencies || []),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/getExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('ExportMap', function () {
var imports = ExportMap.parse(
path,
contents,
{ parserPath: 'babel-eslint', settings: {} }
{ parserPath: 'babel-eslint', settings: {} },
)

expect(imports, 'imports').to.exist
Expand Down
32 changes: 16 additions & 16 deletions tests/src/core/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ describe('resolve', function () {
const testContext = utils.testContext({ 'import/resolver': './foo-bar-resolver-v1' })

expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(utils.testFilePath('./bar.jsx'))

expect(resolve( '../files/exception'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } }),
)).to.equal(undefined)

expect(resolve( '../files/not-found'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('not-found.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('not-found.js') } }),
)).to.equal(undefined)
})

it('resolves via a custom resolver with interface version 1 assumed if not specified', function () {
const testContext = utils.testContext({ 'import/resolver': './foo-bar-resolver-no-version' })

expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(utils.testFilePath('./bar.jsx'))

expect(resolve( '../files/exception'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } }),
)).to.equal(undefined)

expect(resolve( '../files/not-found'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('not-found.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('not-found.js') } }),
)).to.equal(undefined)
})

Expand All @@ -52,20 +52,20 @@ describe('resolve', function () {
}

expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(utils.testFilePath('./bar.jsx'))

testContextReports.length = 0
expect(resolve( '../files/exception'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } }),
)).to.equal(undefined)
expect(testContextReports[0]).to.be.an('object')
expect(testContextReports[0].message).to.equal('Resolve error: foo-bar-resolver-v2 resolve test exception')
expect(testContextReports[0].loc).to.eql({ line: 1, column: 0 })

testContextReports.length = 0
expect(resolve( '../files/not-found'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('not-found.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('not-found.js') } }),
)).to.equal(undefined)
expect(testContextReports.length).to.equal(0)
})
Expand All @@ -74,23 +74,23 @@ describe('resolve', function () {
const testContext = utils.testContext({ 'import/resolver': [ './foo-bar-resolver-v2', './foo-bar-resolver-v1' ] })

expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(utils.testFilePath('./bar.jsx'))
})

it('respects import/resolver as object', function () {
const testContext = utils.testContext({ 'import/resolver': { './foo-bar-resolver-v2': {} } })

expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(utils.testFilePath('./bar.jsx'))
})

it('respects import/resolver as array of objects', function () {
const testContext = utils.testContext({ 'import/resolver': [ { './foo-bar-resolver-v2': {} }, { './foo-bar-resolver-v1': {} } ] })

expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(utils.testFilePath('./bar.jsx'))
})

Expand All @@ -103,7 +103,7 @@ describe('resolve', function () {

testContextReports.length = 0
expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(undefined)
expect(testContextReports[0]).to.be.an('object')
expect(testContextReports[0].message).to.equal('Resolve error: invalid resolver config')
Expand All @@ -119,7 +119,7 @@ describe('resolve', function () {
}
testContextReports.length = 0
expect(resolve( '../files/foo'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
)).to.equal(undefined)
expect(testContextReports[0]).to.be.an('object')
expect(testContextReports[0].message).to.equal(`Resolve error: ${resolverName} with invalid interface loaded as resolver`)
Expand All @@ -130,7 +130,7 @@ describe('resolve', function () {
const testContext = utils.testContext({ 'import/resolve': { 'extensions': ['.jsx'] }})

expect(resolve( './jsx/MyCoolComponent'
, testContext
, testContext,
)).to.equal(utils.testFilePath('./jsx/MyCoolComponent.jsx'))
})

Expand All @@ -142,7 +142,7 @@ describe('resolve', function () {
}

expect(resolve( '../files/exception'
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } })
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('exception.js') } }),
)).to.equal(undefined)
expect(testContextReports[0]).to.be.an('object')
expect(testContextReports[0].message).to.equal('Resolve error: TEST ERROR')
Expand Down
2 changes: 1 addition & 1 deletion tests/src/rules/no-duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ruleTester.run('no-duplicates', rule, {
output: "import { x , y } from './bar'; ",
settings: { 'import/resolve': {
paths: [path.join( process.cwd()
, 'tests', 'files'
, 'tests', 'files',
)] }},
errors: 2, // path ends up hardcoded
}),
Expand Down
2 changes: 1 addition & 1 deletion tests/src/rules/no-unresolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function runResolverTests(resolver) {
function rest(specs) {
specs.settings = Object.assign({},
specs.settings,
{ 'import/resolver': resolver }
{ 'import/resolver': resolver },
)

return test(specs)
Expand Down

0 comments on commit 1b96580

Please sign in to comment.