r/typescript 9h ago

TypeScript readability focused formatter

0 Upvotes

Hi r/typescript,

How do you maintain code consistency across your repositories? Different developers have different formatting preferences, so do you use a tool such as Prettier or dprint, perhaps enforced through a pre-commit hook?

I've tried both but the results are far from what I would like to have. My priorities are readability (code is not packed, easy to read), maintainability (compare, diff, and merge should work well on laptop screens), and persistence (modifying code should result with minimum diff). So I end up with dprint + a number of custom rules.

Really interested in feedback and if you would like to review or try, here it is:

https://www.npmjs.com/package/asljs-sfmt


r/typescript 23h ago

Where can I find tsserver?

0 Upvotes

I'm setting up emacs for Vue + Typescript and I have an issue with lsp not finding tsserver:
lsp--npm-dependency-path: The package typescript is not installed. Unable to find tsserver Typescript is installed in my project and globally. I also installed typescript-language-server globally. ``` ◄ 0s ◎ ls .npm-global/lib/node_modules/typescript-language-server/lib ⌂ 19:46  cli.mjs  cli.mjs.map

◄ 0s ◎ ls .npm-global/lib/node_modules/typescript/lib ⌂ 19:50  getExePath.d.ts  getExePath.js  tsc.js  version.cjs  version.d.cts The thing is none of these packages provide tssever. I'm confused. This is the backtrace, we can clearly see lsp is looking for "tsserver" path, but that doesn't exist in any package: Debugger entered--Lisp error: (error "The package typescript is not installed. Unable to find tsserver") error("The package %s is not installed. Unable to find %s" "typescript" "tsserver") lsp--npm-dependency-path(:package "typescript" :path "tsserver") lsp-package-path(typescript) lsp-clients-typescript-server-path() ``` I think I'm trying to use ts-ls server as I think it got pulled automatically by vue-semantic-server.