Hacker News new | ask | show | jobs
by ef4 3125 days ago
I keep seeing this misconception repeated.

Both default and named exports can be rebound to new symbols locally. But that has no effect on how statically analyzable the code is.

“It can’t be auto refactored” just isn’t true. If it’s true for your particular tool, file a bug.

People are using a cargo cult understanding of how code analysis works. It’s not just grepping for a string.

1 comments

I assure you that I know how static analysis work but how could you rename something that doesn't have any name? How could you perform "rename" refactoring on `export default function () {...}` since this expression is not associated with any symbol.

It's clear for me that in this case you could talk only on refactoring like "rename all default imports to:" This is different than simply renaming a symbol and I don't know IDE that supports this operation.

Your editor knows the symbol of every value referencing the default export. Try go-to-references on a default export.

If your IDE doesn't support rename-references that's your IDE's deficiency - not default exports.