phil294 / GitLG

A free, interactive Git UI for VSCode
MIT License
151 stars 12 forks source link

Internal: Code formatter #24

Closed lens0021 closed 1 month ago

lens0021 commented 1 year ago

There are trailing whitespaces and my vscode complained about it.

phil294 commented 1 year ago

Are you using some kind of extension that warns you about it? I wanna use it too.

It's probably not possible to apply semantic language-agnostic code formatting due to the amount of preprocessors: Vue/SLM/Coffee/Stylus. For example, there's coffeelint but it doesn't work in Vue files. So all that could be done is integrating some generic language-indifferent checker which I'd then integrate in the build script release.sh. The whole process is still pretty manual, after all.

lens0021 commented 1 year ago

What I am using is not an extension but VSCode's files.trimTrailingWhitespace setting.

When enabled, will trim trailing whitespace when saving a file.

But, if you prefer, pre-commit could help you by the trailing-whitespace hook I think. Anyway, I didn't know the limitation you mentioned, sorry.

phil294 commented 1 month ago

This has become obsolete since the removal of coffeescript etc and the addition of eslint which does indeed enforce a unified code style