dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Automatic Symbol Naming

Open harrysolovay opened this issue 2 years ago • 1 comments

Consider the following Symbol.

util/nominality/Tag.ts

export const Tag = Symbol.for("my_project/util/nominality/Tag.Tag");

To name this meaningfully, one needs to look at the export junctions. If we later decide to rearrange...

- util/nominality/Tag.ts
+ util/nominality.ts

... we must remember to update the value supplied to for.

- export const Tag = Symbol.for("my_project/util/nominality/Tag.Tag");
+ export const Tag = Symbol.for("my_project/util/nominality.Tag");

This is very frustrating/easy to forget... enough such that I typically do Symbol.for("TODO").

I'm not sure if you'd quality this as "formatting" per se... but I'd absolutely LOVE for DPrint to manage symbol names.

Anyways, just thought I'd share the idea of auto-naming. Thank you for considering :)

harrysolovay avatar Mar 04 '22 14:03 harrysolovay

I think this is out-of-scope. You can try to create a custom eslint rule :)

so1ve avatar Apr 03 '23 16:04 so1ve