Skip to content

Commit

Permalink
Fix ignorePackages to produce errors
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz committed Oct 28, 2019
1 parent 112a0bf commit 2bfd9d0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ function buildProperties(context) {
}
})

if (result.defaultConfig === 'ignorePackages') {
result.defaultConfig = 'always'
result.ignorePackages = true
}

return result
}

Expand Down
24 changes: 23 additions & 1 deletion tests/src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ruleTester.run('extensions', rule, {
code: `
import foo from './foo.js'
import bar from './bar.json'
import Component from './Component'
import Component from './Component.jsx'
import express from 'express'
`,
options: [ 'ignorePackages' ],
Expand Down Expand Up @@ -309,6 +309,28 @@ ruleTester.run('extensions', rule, {
],
}),

test({
code: `
import foo from './foo.js'
import bar from './bar.json'
import Component from './Component'
import baz from 'foo/baz'
import express from 'express'
`,
options: [ 'ignorePackages' ],
errors: [
{
message: 'Missing file extension for "./Component"',
line: 4,
column: 31,
}, {
message: 'Missing file extension for "foo/baz"',
line: 5,
column: 25,
},
],
}),

test({
code: `
import foo from './foo.js'
Expand Down

0 comments on commit 2bfd9d0

Please sign in to comment.