A common problem that occurs (especially with lots of external contributors to a project) is when the version of the stylua binary installed and the version of the binary used to initially format a project differ. This can lead to different formatting outputs, and confusing CI failures (no diff locally, but get an error on CI).
There are tools out there to help manage binary versions for projects, such as foreman, asdf or bvm, but it may also be worthwhile to try and provide some support in the binary itself to help warn people of these issues.
One solution is to allow an optional version
field in stylua.toml
, which can be pinned to a semver version of the binary. Then when StyLua is run and the versions differ, we can emit a warning.
We can also take this a step further in the VSCode Extension and GitHub Action, where we read the version field in the config file (if present) and use that specific version for the project.
The caveat to this is that users may expect a "version" field in the configuration to imply that the version is automatically managed for them, and changing this field would automatically update the binary. This is not the case, the field just acts as a hint to the binary to warn on version mismatches.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4