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

[Typescript] Lookup for external modules in @types folder. #1526

Merged
merged 1 commit into from Jan 1, 2020
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Expand Up @@ -11,9 +11,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

### Fixed
- [`no-unused-modules`]: fix usage of `import/extensions` settings ([#1560], thanks [@stekycz])

### Fixed
- [`import/extensions`]: ignore non-main modules ([#1563], thanks [@saschanaz])
- TypeScript config: lookup for external modules in @types folder ([#1526], thanks [@joaovieira])

## [2.19.1] - 2019-12-08
### Fixed
Expand Down Expand Up @@ -634,6 +633,7 @@ for info on changes for earlier releases.
[#1560]: https://github.com/benmosher/eslint-plugin-import/pull/1560
[#1551]: https://github.com/benmosher/eslint-plugin-import/pull/1551
[#1542]: https://github.com/benmosher/eslint-plugin-import/pull/1542
[#1526]: https://github.com/benmosher/eslint-plugin-import/pull/1526
[#1521]: https://github.com/benmosher/eslint-plugin-import/pull/1521
[#1519]: https://github.com/benmosher/eslint-plugin-import/pull/1519
[#1507]: https://github.com/benmosher/eslint-plugin-import/pull/1507
Expand Down Expand Up @@ -1054,3 +1054,4 @@ for info on changes for earlier releases.
[@stekycz]: https://github.com/stekycz
[@dbrewer5]: https://github.com/dbrewer5
[@rsolomon]: https://github.com/rsolomon
[@joaovieira]: https://github.com/joaovieira
1 change: 1 addition & 0 deletions config/typescript.js
Expand Up @@ -8,6 +8,7 @@ module.exports = {

settings: {
'import/extensions': allExtensions,
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
},
Expand Down
14 changes: 14 additions & 0 deletions tests/src/config/typescript.js
@@ -0,0 +1,14 @@
import path from 'path'
import { expect } from 'chai'

const config = require(path.join(__dirname, '..', '..', '..', 'config', 'typescript'))

describe('config typescript', () => {
// https://github.com/benmosher/eslint-plugin-import/issues/1525
it('should mark @types paths as external', () => {
const externalModuleFolders = config.settings['import/external-module-folders']
expect(externalModuleFolders).to.exist
expect(externalModuleFolders).to.contain('node_modules')
expect(externalModuleFolders).to.contain('node_modules/@types')
})
})