Skip to content

Commit

Permalink
[Fix] no-unused-modules: report error on binding instead of parent …
Browse files Browse the repository at this point in the history
…export
  • Loading branch information
Chamion authored and ljharb committed Jul 26, 2023
1 parent d3aa478 commit 90e2dfa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -15,7 +15,8 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
- [`order`]: partial fix for [#2687] (thanks [@ljharb])
- [`no-duplicates`]: Detect across type and regular imports ([#2835], thanks [@benkrejci])
- [`extensions`]: handle `.` and `..` properly ([#2778], thanks [@benasher44])
- [`no-unused-modules`]: improve schema (thanks [@ljharb])
- [`no-unused-modules`]: improve schema (thanks [@ljharb])
- [`no-unused-modules`]: report error on binding instead of parent export ([#2842], thanks [@Chamion])

### Changed
- [Docs] [`no-duplicates`]: fix example schema ([#2684], thanks [@simmo])
Expand Down Expand Up @@ -1076,6 +1077,7 @@ for info on changes for earlier releases.

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

[#2842]: https://github.com/import-js/eslint-plugin-import/pull/2842
[#2835]: https://github.com/import-js/eslint-plugin-import/pull/2835
[#2832]: https://github.com/import-js/eslint-plugin-import/pull/2832
[#2778]: https://github.com/import-js/eslint-plugin-import/pull/2778
Expand Down Expand Up @@ -1666,6 +1668,7 @@ for info on changes for earlier releases.
[@bradzacher]: https://github.com/bradzacher
[@brendo]: https://github.com/brendo
[@brettz9]: https://github.com/brettz9
[@Chamion]: https://github.com/Chamion
[@charlessuh]: https://github.com/charlessuh
[@charpeni]: https://github.com/charpeni
[@cherryblossom000]: https://github.com/cherryblossom000
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unused-modules.js
Expand Up @@ -931,7 +931,7 @@ module.exports = {
},
ExportNamedDeclaration(node) {
node.specifiers.forEach((specifier) => {
checkUsage(node, specifier.exported.name || specifier.exported.value);
checkUsage(specifier, specifier.exported.name || specifier.exported.value);
});
forEachDeclarationIdentifier(node.declaration, (name) => {
checkUsage(node, name);
Expand Down
6 changes: 3 additions & 3 deletions tests/src/rules/no-unused-modules.js
Expand Up @@ -184,17 +184,17 @@ ruleTester.run('no-unused-modules', rule, {
{
message: `exported declaration 'default' not used within other modules`,
line: 12,
column: 9,
column: 18,
},
{
message: `exported declaration 'o0' not used within other modules`,
line: 12,
column: 9,
column: 27,
},
{
message: `exported declaration 'o3' not used within other modules`,
line: 12,
column: 9,
column: 31,
},
error(`exported declaration 'p' not used within other modules`),
],
Expand Down

0 comments on commit 90e2dfa

Please sign in to comment.