Skip to content

Commit 308b60e

Browse files
authored
Merge branch 'main' into issue2385
2 parents 126d094 + 21304bd commit 308b60e

File tree

11 files changed

+41
-7
lines changed

11 files changed

+41
-7
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1515
- [`default`]: `typescript-eslint-parser`: avoid a crash on exporting as namespace (thanks [@ljharb])
1616
- [`export`]/TypeScript: false positive for typescript namespace merging ([#1964], thanks [@magarcia])
1717
- [`no-duplicates`]: ignore duplicate modules in different TypeScript module declarations ([#2378], thanks [@remcohaszing])
18+
- [`no-unused-modules`]: avoid a crash when processing re-exports ([#2388], thanks [@ljharb])
1819

1920
### Changed
2021
- [Tests] `no-nodejs-modules`: add tests for node protocol URL ([#2367], thanks [@sosukesuzuki])
2122
- [Tests] `default`, `no-anonymous-default-export`, `no-mutable-exports`, `no-named-as-default-member`, `no-named-as-default`: add tests for arbitrary module namespace names ([#2358], thanks [@sosukesuzuki])
2223
- [Docs] [`no-unresolved`]: Fix RegExp escaping in readme ([#2332], thanks [@stephtr])
2324
- [Refactor] `namespace`: try to improve performance ([#2340], thanks [@ljharb])
25+
- [Docs] make rule doc titles consistent ([#2393], thanks [@TheJaredWilcurt])
2426

2527
## [2.25.4] - 2022-01-02
2628

@@ -971,6 +973,8 @@ for info on changes for earlier releases.
971973

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

976+
[#2393]: https://github.com/import-js/eslint-plugin-import/pull/2393
977+
[#2388]: https://github.com/import-js/eslint-plugin-import/pull/2388
974978
[#2381]: https://github.com/import-js/eslint-plugin-import/pull/2381
975979
[#2378]: https://github.com/import-js/eslint-plugin-import/pull/2378
976980
[#2371]: https://github.com/import-js/eslint-plugin-import/pull/2371
@@ -1659,6 +1663,7 @@ for info on changes for earlier releases.
16591663
[@Taranys]: https://github.com/Taranys
16601664
[@taye]: https://github.com/taye
16611665
[@TheCrueltySage]: https://github.com/TheCrueltySage
1666+
[@TheJaredWilcurt]: https://github.com/TheJaredWilcurt
16621667
[@tihonove]: https://github.com/tihonove
16631668
[@timkraut]: https://github.com/timkraut
16641669
[@tizmagik]: https://github.com/tizmagik

Diff for: docs/rules/dynamic-import-chunkname.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# dynamic imports require a leading comment with a webpackChunkName (dynamic-import-chunkname)
1+
# import/dynamic-import-chunkname
22

33
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
44

Diff for: docs/rules/imports-first.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# imports-first
1+
# import/imports-first
22

33
This rule was **deprecated** in eslint-plugin-import v2.0.0. Please use the corresponding rule [`first`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/first.md).

Diff for: docs/rules/no-import-module-exports.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# no-import-module-exports
1+
# import/no-import-module-exports
22

33
Reports the use of import declarations with CommonJS exports in any module
44
except for the [main module](https://docs.npmjs.com/files/package.json#main).

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,6 @@
111111
"minimatch": "^3.1.2",
112112
"object.values": "^1.1.5",
113113
"resolve": "^1.22.0",
114-
"tsconfig-paths": "^3.12.0"
114+
"tsconfig-paths": "^3.13.0"
115115
}
116116
}

Diff for: src/rules/no-unused-modules.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ const prepareImportsAndExports = (srcFiles, context) => {
273273
exportAll.forEach((value, key) => {
274274
value.forEach(val => {
275275
const currentExports = exportList.get(val);
276-
const currentExport = currentExports.get(EXPORT_ALL_DECLARATION);
277-
currentExport.whereUsed.add(key);
276+
if (currentExports) {
277+
const currentExport = currentExports.get(EXPORT_ALL_DECLARATION);
278+
currentExport.whereUsed.add(key);
279+
}
278280
});
279281
});
280282
};
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { hello } from './magic/test'
2+
3+
hello();
4+
5+
export default function App() {};
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import App from './App';
2+
3+
export const x = App
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './test'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function hello() {
2+
console.log('hello!!');
3+
}
4+
5+
export function unused() {
6+
console.log('im unused!!');
7+
}

Diff for: tests/src/rules/no-unused-modules.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ ruleTester.run('no-unused-modules', rule, {
105105
});
106106

107107

108-
// tests for exports
108+
// tests for exports
109109
ruleTester.run('no-unused-modules', rule, {
110110
valid: [
111111
test({
@@ -301,6 +301,17 @@ describe('dynamic imports', () => {
301301
parser: parsers.TS_NEW,
302302
filename: testFilePath('./no-unused-modules/typescript/exports-for-dynamic-ts.ts'),
303303
}),
304+
test({
305+
code: `
306+
import App from './App';
307+
`,
308+
filename: testFilePath('./unused-modules-reexport-crash/src/index.tsx'),
309+
parser: parsers.TS_NEW,
310+
options: [{
311+
unusedExports: true,
312+
ignoreExports: ['**/magic/**'],
313+
}],
314+
}),
304315
],
305316
invalid: [
306317
],

0 commit comments

Comments
 (0)