Skip to content
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

Setup lua linter and formatter #2

Open
bytemain opened this issue Mar 6, 2024 · 10 comments
Open

Setup lua linter and formatter #2

bytemain opened this issue Mar 6, 2024 · 10 comments

Comments

@bytemain
Copy link
Member

bytemain commented Mar 6, 2024

unified code style can reduce the cost of maintaining and reviewing code, and can find potential risks

@aooohan
Copy link
Member

aooohan commented Mar 6, 2024

unified code style can reduce the cost of maintaining and reviewing code, and can find potential risks

Agree! But how do we do that?

@bytemain
Copy link
Member Author

bytemain commented Mar 6, 2024

just a idea, we ship a new binary called vfox-dev(or what ever).

vfox-dev lint
vfox-dev build

https://github.com/CppCXY/EmmyLuaCodeStyle

there are some code styles linters, but most of them need user clone them and build them on machine.

@bytemain
Copy link
Member Author

bytemain commented Mar 6, 2024

or we can use dprint, it is a pluggable and configurable code formatting platform written in rust.

https://dprint.dev/

it has a lua plugin: https://github.com/RubixDev/dprint-plugin-stylua

@bytemain
Copy link
Member Author

bytemain commented Mar 6, 2024

CleanShot 2024-03-06 at 20 47 34@2x

I found that it support install by asdf, ahahahah

@aooohan
Copy link
Member

aooohan commented Mar 7, 2024

I found that it support install by asdf, ahahahah

If we decide to use this, we can also implement a plug-in of our own. After taking a look, it is very easy. 😄

@aooohan
Copy link
Member

aooohan commented Mar 7, 2024

just a idea, we ship a new binary called vfox-dev(or what ever).

I don't think we need to spend too much time on this, dprint is a good choice.

@bytemain
Copy link
Member Author

bytemain commented Mar 7, 2024

ok, I will take a look on install dprint by vfox

@axdank
Copy link

axdank commented Mar 7, 2024

we can also use stylua

and add its configuration to the root of the project:
stylua.toml

column_width = 120
line_endings = "Unix"
indent_type = "Tabs"
indent_width = 4
quote_style = "AutoPreferDouble"
call_parentheses = "Always"
collapse_simple_statement = "Never"

[sort_requires]
enabled = false

@bytemain
Copy link
Member Author

bytemain commented Mar 8, 2024

yes, the dprint plugin we mentioned above in using stylua to format lua files.
and dprint can also format markdown and json files.

@aooohan
Copy link
Member

aooohan commented Mar 20, 2024

@bytemain @axdank Hi guys, I think I've finished working on the templates for the plugin repository, and I think this issue can be resolved in the template repository.

For example, we could put dprint in the plugin repository, tell the user how to use it, or automate do this work by Github Action.

@aooohan aooohan transferred this issue from version-fox/version-fox-plugins Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants