Skip to content

Commit 7d763a1

Browse files
author
Marc Jakobi
committed
docs: add lx check to tutorial
1 parent ff541de commit 7d763a1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/tutorial/07-code-hygiene.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ title: Code Hygiene
66
Code hygiene is the practice of writing code that is readable and maintainable.
77
In 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

1128
Linting is the process of analyzing code for potential errors and stylistic issues (lines too long, unused variables, etc.).

0 commit comments

Comments
 (0)