-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use DPrint to ensure consistent code formatting #7474
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -0,0 +1,23 @@ | |||
{ | |||
"lineWidth": 120, | |||
"typescript": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://dprint.dev/plugins/typescript/config/ , this also works for JS, not only TS
Thanks @linonetwo I won't be able to try this out for a few days, but it looks good.
|
at 19c052d#commitcomment-107771231 Jeremy wrote
So we would be able to get rid of all the The problem is even removing So @linonetwo .. Did you compare the "vanilla" TW file size before and after you did use dprint? |
@pmario After removing |
I didn't see a rule to save this space, this might add a lot of spaces |
This one is a tricky one. From my point of view, in general the extra space would improve human readability. But it has a negative impact on file size. You did open a "feature request" at the dprint repo. right? ... We'll see what they say. |
dprint wasm might work in browser too, so we might be able to write a Rust formatted compile to wasm and run with drpint as a tw codemirror plugin |
@pmario size compare linonetwo#3 Before: 1,803,178 B (1.8MB) After--: 1,803,407 B (1.8MB) |
If this is merged, other developers need to run |
@linonetwo Your sizes are interesting. If I download empty.html from tiddlywiki.com I do get a file with 2328kByte in size. If I create it with latest master v5.3.0-pre it's 2400kByte |
Sorry, I just right-click the Also, @Jermolene you wish to decide between #7394 and this after 5.3.0? |
OK. But still. What do I need to do to activate dprint for all files so I can create a new file afterwards. |
See linonetwo#3 (comment) , but also a pr to add it to npm script so no one need to ask about this #7539 |
IMO in #7474 (comment) there is a typo: IMO it should be |
Very interesting.
That's almost nothing. I did expect much more problems. I'll have to have a closer look, what actually has been changed. |
yes, updated. About error, I think we can merge the auto fixed version, then take spare time to fix other errors one PR by one PR. |
Did you find a configuration to ignore the "additional indentation" cause by the wrapper functions? |
Not yet, maybe we can just accept the space? Or I have to add that rule using rust. But spaces is not so much, as far as we tested. |
As an alternative to #7394
I suggest dprint because it is very fast (rust) and secure (see dprint.json, plugins are wasm in sandbox).
And I also suggest using pnpm because it can reuse packages across projects and is fast. (optional if you prefer npm, but I don't know why can't get npm install things on my Mac today, its been a while since last using it.)
No need to run dprint/prettier alone, they can be integrated into eslint and use
eslint . --fix
instead. Or we can do this file-by-file, when modifying a file in the future.There are lots of style to be fixed, due to
(function(){ })()
on many js file that should introduce indentation but there was no indentation.(I'm not sure this wrapper is necessary, I never write them in my plugins and still works fine.)
I also config dprint errors as warning in eslint, so in VSCode it looks softer:
Use alt+shift+G to fix eslint error on a file, as well as dprint/prettier errors: