Skip to content

Commit

Permalink
[patch] TypeScript config: remove .d.ts from import/parsers setti…
Browse files Browse the repository at this point in the history
…ng and `import/extensions` setting
  • Loading branch information
jablko authored and ljharb committed Sep 3, 2021
1 parent 9ccdcb7 commit 4d15e26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Expand Up @@ -7,7 +7,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
## [Unreleased]

### Changed
- [Refactor] switch to an internal replacement for `pkg-up` and `read-pkg-up` ([#2047], [@mgwalker])
- [Refactor] switch to an internal replacement for `pkg-up` and `read-pkg-up` ([#2047], thanks [@mgwalker])
- [patch] TypeScript config: remove `.d.ts` from [`import/parsers` setting] and [`import/extensions` setting] ([#2220], thanks [@jablko])

### Added
- [`no-unresolved`]: add `caseSensitiveStrict` option ([#1262], thanks [@sergei-startsev])
Expand Down Expand Up @@ -230,7 +231,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
- [`order`]: add option pathGroupsExcludedImportTypes to allow ordering of external import types ([#1565], thanks [@Mairu])

### Fixed
- [`no-unused-modules`]: fix usage of `import/extensions` settings ([#1560], thanks [@stekycz])
- [`no-unused-modules`]: fix usage of [`import/extensions` setting] ([#1560], thanks [@stekycz])
- [`extensions`]: ignore non-main modules ([#1563], thanks [@saschanaz])
- TypeScript config: lookup for external modules in @types folder ([#1526], thanks [@joaovieira])
- [`no-extraneous-dependencies`]: ensure `node.source` is truthy ([#1589], thanks [@ljharb])
Expand Down Expand Up @@ -909,6 +910,7 @@ for info on changes for earlier releases.

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

[#2220]: https://github.com/import-js/eslint-plugin-import/pull/2220
[#2219]: https://github.com/import-js/eslint-plugin-import/pull/2219
[#2212]: https://github.com/import-js/eslint-plugin-import/pull/2212
[#2196]: https://github.com/import-js/eslint-plugin-import/pull/2196
Expand Down Expand Up @@ -1444,6 +1446,7 @@ for info on changes for earlier releases.
[@isiahmeadows]: https://github.com/isiahmeadows
[@IvanGoncharov]: https://github.com/IvanGoncharov
[@ivo-stefchev]: https://github.com/ivo-stefchev
[@jablko]: https://github.com/jablko
[@jakubsta]: https://github.com/jakubsta
[@jeffshaver]: https://github.com/jeffshaver
[@jf248]: https://github.com/jf248
Expand Down
7 changes: 5 additions & 2 deletions config/typescript.js
Expand Up @@ -2,15 +2,18 @@
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
*/

const allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];
// Omit `.d.ts` because 1) TypeScript compilation already confirms that
// types are resolved, and 2) it would mask an unresolved
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
const allExtensions = ['.ts', '.tsx', '.js', '.jsx'];

module.exports = {

settings: {
'import/extensions': allExtensions,
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
'node': {
Expand Down

0 comments on commit 4d15e26

Please sign in to comment.