Skip to content

Commit 4d15e26

Browse files
jablkoljharb
authored andcommittedSep 3, 2021
[patch] TypeScript config: remove .d.ts from import/parsers setting and import/extensions setting
1 parent 9ccdcb7 commit 4d15e26

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

‎CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
77
## [Unreleased]
88

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

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

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

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

913+
[#2220]: https://github.com/import-js/eslint-plugin-import/pull/2220
912914
[#2219]: https://github.com/import-js/eslint-plugin-import/pull/2219
913915
[#2212]: https://github.com/import-js/eslint-plugin-import/pull/2212
914916
[#2196]: https://github.com/import-js/eslint-plugin-import/pull/2196
@@ -1444,6 +1446,7 @@ for info on changes for earlier releases.
14441446
[@isiahmeadows]: https://github.com/isiahmeadows
14451447
[@IvanGoncharov]: https://github.com/IvanGoncharov
14461448
[@ivo-stefchev]: https://github.com/ivo-stefchev
1449+
[@jablko]: https://github.com/jablko
14471450
[@jakubsta]: https://github.com/jakubsta
14481451
[@jeffshaver]: https://github.com/jeffshaver
14491452
[@jf248]: https://github.com/jf248

‎config/typescript.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
33
*/
44

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

710
module.exports = {
811

912
settings: {
1013
'import/extensions': allExtensions,
1114
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
1215
'import/parsers': {
13-
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
16+
'@typescript-eslint/parser': ['.ts', '.tsx'],
1417
},
1518
'import/resolver': {
1619
'node': {

0 commit comments

Comments
 (0)
Please sign in to comment.