From 17afec76c0c2f4f966cc80e6760dea96a3bd77c5 Mon Sep 17 00:00:00 2001 From: Jiri Spac Date: Tue, 20 Dec 2022 11:28:08 +0100 Subject: [PATCH] add Greppability as a another advantage --- docs/tips/defaultIsBad.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/tips/defaultIsBad.md b/docs/tips/defaultIsBad.md index 2b1d63e16..369803599 100644 --- a/docs/tips/defaultIsBad.md +++ b/docs/tips/defaultIsBad.md @@ -55,6 +55,10 @@ With `default` there is horrible experience for commonJS users who have to `cons ### Typo Protection You don't get typos like one dev doing `import Foo from "./foo";` and another doing `import foo from "./foo";` +### Greppability + +Default exports cannot be easily grepped across the whole codebase. With named exports it's trivial to find all the uses of an exported token even from a basic terminal, without the need to spin up a typescript language server. + ### TypeScript auto-import Auto import quickfix works better. You use `Foo` and auto import will write down `import { Foo } from "./foo";` cause its a well defined name exported from a module. Some tools out there will try to magic read and *infer* a name for a default export but magic is flaky.