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

Fix ignorePackages to produce errors #1521

Merged
merged 1 commit into from
Dec 5, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
- [`no-extraneous-dependencies`]: Implement support for [bundledDependencies](https://npm.github.io/using-pkgs-docs/package-json/types/bundleddependencies.html) ([#1436], thanks [@schmidsi]))

### Fixed
- `default`: make error message less confusing ([#1470], thanks [@golopot])
- [`default`]: make error message less confusing ([#1470], thanks [@golopot])
- Improve performance of `ExportMap.for` by only loading paths when necessary. ([#1519], thanks [@brendo])
- Support export of a merged TypeScript namespace declaration ([#1495], thanks [@benmunro])
- [`import/order`]: fix autofix to not move imports across fn calls ([#1253], thanks [@tihonove])
- [`prefer-default-export`]: fix false positive with type export ([#1506], thanks [@golopot])
- [`extensions`]: Fix `ignorePackages` to produce errors ([#1521], thanks [@saschanaz])

## [2.18.2] - 2019-07-19
- Skip warning on type interfaces ([#1425], thanks [@lencioni])
Expand Down Expand Up @@ -611,6 +612,7 @@ for info on changes for earlier releases.

[`memo-parser`]: ./memo-parser/README.md

[#1521]: https://github.com/benmosher/eslint-plugin-import/pull/1521
[#1519]: https://github.com/benmosher/eslint-plugin-import/pull/1519
[#1506]: https://github.com/benmosher/eslint-plugin-import/pull/1506
[#1495]: https://github.com/benmosher/eslint-plugin-import/pull/1495
Expand Down Expand Up @@ -1001,3 +1003,4 @@ for info on changes for earlier releases.
[@benmunro]: https://github.com/benmunro
[@tihonove]: https://github.com/tihonove
[@brendo]: https://github.com/brendo
[@saschanaz]: https://github.com/saschanaz
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