Skip to content

Commit 7b17a68

Browse files
authored
chore: linting and formatting (#23)
* chore: add linting * refactor: improve formatting * fix: add stylua to mise * fix: diagnostic issues * chore: add lint check to ci * fix: don't ignore .lua_ls
1 parent fe0c928 commit 7b17a68

23 files changed

Lines changed: 1745 additions & 1679 deletions

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ jobs:
2121
- name: Check formatting
2222
run: mise run fmt:check
2323

24+
lint:
25+
name: Run Lua Lint
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout Code
30+
uses: actions/checkout@v6.0.2
31+
32+
- name: Set up tools via mise
33+
uses: jdx/mise-action@v4.0.1
34+
35+
- name: Run Lua lint
36+
run: mise run lua:lint
37+
2438
test:
2539
name: Run Tests
2640
runs-on: ubuntu-latest

.gitignore

Whitespace-only changes.

.lua_ls/busted.lua

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---@meta
2+
3+
---@alias BustedCallback fun()
4+
5+
---@param name string
6+
---@param callback BustedCallback
7+
function describe(name, callback) end
8+
9+
---@param name string
10+
---@param callback BustedCallback
11+
function it(name, callback) end
12+
13+
---@param name string
14+
---@param callback BustedCallback
15+
function active_it(name, callback) end
16+
17+
---@param callback BustedCallback
18+
function before_each(callback) end
19+
20+
---@param callback BustedCallback
21+
function after_each(callback) end
22+
23+
---@param name string
24+
---@param callback? BustedCallback
25+
function pending(name, callback) end
26+
27+
---@class LuassertChain
28+
---@field same fun(expected: any, actual: any, message?: string)
29+
---@field equals fun(expected: any, actual: any, message?: string)
30+
---@field is_true fun(value: any, message?: string)
31+
32+
---@class Luassert: LuassertChain
33+
---@field are LuassertChain
34+
35+
---@type Luassert|function
36+
assert = assert

.luarc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
3+
"runtime.version": "LuaJIT",
4+
"diagnostics.globals": [
5+
"vim"
6+
],
7+
"workspace.library": [
8+
".lua_ls"
9+
],
10+
"workspace.checkThirdParty": false,
11+
"workspace.ignoreDir": [
12+
".git"
13+
]
14+
}

dprint.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33
},
44
"markdown": {
55
},
6-
"toml": {
7-
},
86
"yaml": {
97
},
8+
"exec": {
9+
"commands": [
10+
{
11+
"command": "stylua --allow-hidden --respect-ignores --stdin-filepath {{file_path}} -",
12+
"exts": [".lua"]
13+
},
14+
{
15+
"command": "taplo format -",
16+
"exts": [".toml"]
17+
}
18+
]
19+
},
1020
"excludes": [
1121
"CHANGELOG.md",
1222
"**/*-lock.json"
@@ -20,10 +30,9 @@
2030
"**/*.toml"
2131
],
2232
"plugins": [
23-
"https://plugins.dprint.dev/RubixDev/stylua-v0.2.1.wasm",
2433
"https://plugins.dprint.dev/json-0.21.3.wasm",
2534
"https://plugins.dprint.dev/markdown-0.22.1.wasm",
26-
"https://plugins.dprint.dev/toml-0.7.0.wasm",
27-
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm"
35+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm",
36+
"https://plugins.dprint.dev/exec-0.6.0.json@a054130d458f124f9b5c91484833828950723a5af3f8ff2bd1523bd47b83b364"
2837
]
2938
}

0 commit comments

Comments
 (0)