Skip to content

Commit

Permalink
fix(eslint-plugin-esm): fix type problem
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed Sep 18, 2024
1 parent a26c4ee commit 0e49131
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/eslint-plugin-esm/src/rules/no-rename-exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export const noRenameExports = createRule({
message: "Disallow renaming the named-exports.",
create: (context) => ({
ExportSpecifier: (node) => {
if (node.exported.name !== node.local.name) {
if (
node.exported.type !== "Identifier" ||
node.local.type !== "Identifier" ||
node.exported.name !== node.local.name
) {
context.report({ node, messageId: DEFAULT_MESSAGE_ID });
}
},
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin-esm/src/rules/no-rename-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ export const noRenameImports = createRule({
message: "Disallow renaming the named-imports.",
create: (context) => ({
ImportSpecifier: (node) => {
if (node.imported.name !== node.local.name) {
if (
node.imported.type !== "Identifier" ||
node.imported.name !== node.local.name
) {
context.report({ node, messageId: DEFAULT_MESSAGE_ID });
}
},
Expand Down

0 comments on commit 0e49131

Please sign in to comment.