File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,23 @@ title: Code Hygiene
66Code hygiene is the practice of writing code that is readable and maintainable.
77In this chapter, we'll let tools automatically clean up our code for us.
88
9+ ## Type checks with LuaCATS annotations
10+
11+ Lua is incredibly responsive when used for configuration or scripting, giving immediate feedback.
12+ But in the context of a project that needs to be maintained long-term, its dynamic typing casts
13+ shadows of unpredictability, making Lua projects susceptible to unexpected bugs at the wrong time.
14+
15+ To help mitigate this, Lux provides a ` lx check ` command, which uses [ emmylua_check] ( https://github.com/EmmyLuaLs/emmylua-analyzer-rust )
16+ to statically type-check your codebase based on [ LuaCATS annotations] ( https://github.com/EmmyLuaLs/emmylua-analyzer-rust ) .
17+
18+ The command will:
19+
20+ 1 . Build your project and its dependencies if not done already.
21+ 2 . Generate workspace library entries for a [ ` .luarc.json ` file] ( https://github.com/LuaLS/lua-language-server/wiki/Configuration-File ) .
22+ 3 . Run the static checker.
23+
24+ <!-- TODO: show output of lx check and fix the errors that exist there-->
25+
926## Linting with ` lx lint `
1027
1128Linting is the process of analyzing code for potential errors and stylistic issues (lines too long, unused variables, etc.).
You can’t perform that action at this time.
0 commit comments