nanos-lint 2.8.1 → 2.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,11 +33,13 @@ A dedicated, fast linter and type-checker for **[nanos world](https://nanos-worl
33
33
  ### 1. Run via `npx` (No installation needed)
34
34
 
35
35
  Check the current directory:
36
+
36
37
  ```bash
37
38
  npx nanos-lint
38
39
  ```
39
40
 
40
41
  Check a specific directory or file:
42
+
41
43
  ```bash
42
44
  npx nanos-lint check ./my-package
43
45
  npx nanos-lint check ./my-package/Server/Index.lua
@@ -55,14 +57,17 @@ nanos-lint check .
55
57
  ### 3. Setup VS Code / Neovim IntelliSense
56
58
 
57
59
  To configure autocompletion, type annotations, and diagnostics in your local editor:
60
+
58
61
  ```bash
59
62
  npx nanos-lint init
60
63
  ```
64
+
61
65
  This generates a `.luarc.json` file in your workspace pointing to the nanos world definitions and schemas.
62
66
 
63
67
  ### 4. Pre-warm Cache for Offline / Docker Environments
64
68
 
65
69
  To pre-populate all required assets (both LuaLS binary and nanos world annotations) for air-gapped CI or container builds:
70
+
66
71
  ```bash
67
72
  npx nanos-lint warmup
68
73
  ```
@@ -78,9 +83,9 @@ name: Lint Lua Scripts
78
83
 
79
84
  on:
80
85
  push:
81
- branches: [ main, master ]
86
+ branches: [main, master]
82
87
  pull_request:
83
- branches: [ main, master ]
88
+ branches: [main, master]
84
89
 
85
90
  jobs:
86
91
  lint:
@@ -92,23 +97,23 @@ jobs:
92
97
  - name: Lint nanos world Lua scripts
93
98
  uses: vugi99/nanos-lint@v2
94
99
  with:
95
- path: '.'
96
- checklevel: 'Warning'
100
+ path: "."
101
+ checklevel: "Warning"
97
102
  ```
98
103
 
99
104
  ### Action Inputs
100
105
 
101
- | Input | Description | Default |
102
- | :--- | :--- | :--- |
103
- | `path` | Path to workspace directory or Lua file to check | `.` |
104
- | `checklevel` | Minimum severity to report (`Error`, `Warning`, `Information`, `Hint`) | `Warning` |
105
- | `config` | Path to a custom `.luarc.json` configuration file | `""` |
106
- | `annotations` | Path to a custom `annotations.lua` file | `""` |
107
- | `ignore` | Files or directories to ignore (supports glob patterns, newline or comma separated) | `""` |
108
- | `luals-version` | Version of `lua-language-server` to use | `latest` |
109
- | `fail-on-error` | Fail the workflow step if diagnostics are found | `true` |
110
- | `quiet` | Suppress progress messages | `false` |
111
- | `cache` | Whether to cache the LuaLS binary and annotations across workflow runs | `true` |
106
+ | Input | Description | Default |
107
+ | :-------------- | :---------------------------------------------------------------------------------- | :-------- |
108
+ | `path` | Path to workspace directory or Lua file to check | `.` |
109
+ | `checklevel` | Minimum severity to report (`Error`, `Warning`, `Information`, `Hint`) | `Warning` |
110
+ | `config` | Path to a custom `.luarc.json` configuration file | `""` |
111
+ | `annotations` | Path to a custom `annotations.lua` file | `""` |
112
+ | `ignore` | Files or directories to ignore (supports glob patterns, newline or comma separated) | `""` |
113
+ | `luals-version` | Version of `lua-language-server` to use | `latest` |
114
+ | `fail-on-error` | Fail the workflow step if diagnostics are found | `true` |
115
+ | `quiet` | Suppress progress messages | `false` |
116
+ | `cache` | Whether to cache the LuaLS binary and annotations across workflow runs | `true` |
112
117
 
113
118
  When caching is enabled, the cache key rolls over each ISO week, so a freshly downloaded LuaLS binary is actually persisted under the new week's key; in the meantime the previous week's entry is restored from the cache.
114
119
 
@@ -152,14 +157,14 @@ OPTIONS:
152
157
 
153
158
  ### Environment Variables
154
159
 
155
- | Variable | Description |
156
- | :--- | :--- |
157
- | `LUALS_BIN` | Explicit path to a pre-installed `lua-language-server` binary; it must be a regular file that reports its version via `--version` (thin wrapper scripts are accepted), otherwise nanos-lint fails with `ERR_LUALS_BIN_INVALID` |
158
- | `NANOS_ANNOTATIONS_PATH`, `NANOS_ANNOTATIONS` | Explicit path to a custom `annotations.lua` file |
159
- | `NANOS_LOG_LEVEL` | Default logging level: `error`, `warn`, `info`, `debug`, `silent` (default: `warn`) |
160
- | `GITHUB_TOKEN` | GitHub personal access token used for authenticated GitHub API requests (avoids unauthenticated rate limits) |
161
- | `NO_COLOR` | Disables ANSI color output when set to any non-empty value |
162
- | `FORCE_COLOR` | Forces ANSI color output even in non-TTY environments |
160
+ | Variable | Description |
161
+ | :-------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
162
+ | `LUALS_BIN` | Explicit path to a pre-installed `lua-language-server` binary; it must be a regular file that reports its version via `--version` (thin wrapper scripts are accepted), otherwise nanos-lint fails with `ERR_LUALS_BIN_INVALID` |
163
+ | `NANOS_ANNOTATIONS_PATH`, `NANOS_ANNOTATIONS` | Explicit path to a custom `annotations.lua` file |
164
+ | `NANOS_LOG_LEVEL` | Default logging level: `error`, `warn`, `info`, `debug`, `silent` (default: `warn`) |
165
+ | `GITHUB_TOKEN` | GitHub personal access token used for authenticated GitHub API requests (avoids unauthenticated rate limits) |
166
+ | `NO_COLOR` | Disables ANSI color output when set to any non-empty value |
167
+ | `FORCE_COLOR` | Forces ANSI color output even in non-TTY environments |
163
168
 
164
169
  Only `NANOS_LOG_LEVEL` controls the logging level; a generic `LOG_LEVEL` environment variable is intentionally not read, because CI images commonly set it.
165
170
 
@@ -175,17 +180,14 @@ If your project already has a `.luarc.json`, `nanos-lint` automatically merges i
175
180
  {
176
181
  "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
177
182
  "diagnostics": {
178
- "disable": [
179
- "lowercase-global"
180
- ],
181
- "globals": [
182
- "MyCustomGlobal"
183
- ]
183
+ "disable": ["lowercase-global"],
184
+ "globals": ["MyCustomGlobal"]
184
185
  }
185
186
  }
186
187
  ```
187
188
 
188
189
  To scaffold a portable `.luarc.json` with vendored type annotations in your project, run:
190
+
189
191
  ```bash
190
192
  npx nanos-lint init
191
193
  # Or overwrite an existing configuration:
@@ -218,17 +220,20 @@ cd nanos-lint
218
220
  # Install dependencies
219
221
  npm install
220
222
 
221
- # Run ESLint
222
- npm run lint
223
-
224
- # Run type check
225
- npm run typecheck
226
-
227
- # Build distribution bundle
228
- npm run build
229
-
230
- # Run Vitest test suite with coverage (unit + live LuaLS integration tests)
231
- npm run test:coverage
223
+ # Run all quality gates (recommended before commit/PR)
224
+ npm run gates
225
+ # Or alias
226
+ npm run check:all
227
+
228
+ # Run individual quality gates
229
+ npm run format:check # Prettier code formatting (auto-fix via npm run format:fix)
230
+ npm run lint # ESLint
231
+ npm run lint:deps # Dependency architecture & license checks (dependency-cruiser)
232
+ npm run lint:comments # Comment density limit (<= 15%)
233
+ npm run lint:docstrings # Docstring coverage (>= 90% top-level/exported function coverage per file in src/)
234
+ npm run typecheck # TypeScript typecheck
235
+ npm run build # Build distribution bundle
236
+ npm run test:coverage # Vitest unit + live LuaLS integration tests with coverage
232
237
 
233
238
  # Offline: skip live LuaLS tests, perform no network access, disable coverage thresholds
234
239
  NANOS_LIVE_TESTS=0 npm run test:coverage
@@ -238,10 +243,10 @@ NANOS_LIVE_TESTS=0 npm run test:coverage
238
243
 
239
244
  `tests/global-setup.ts` downloads the LuaLS binary and annotations **once per run** into an isolated temporary cache, so the real `~/.cache/nanos-lint` is never touched; the run fails if anything downloads LuaLS a second time.
240
245
 
241
- | Variable | Description |
242
- | :--- | :--- |
243
- | `NANOS_LIVE_TESTS` | `0` (or `false`/`no`/`off`) skips the live LuaLS/annotations tests, performs no network access, and does not enforce the coverage thresholds. Any other value or unset requires the shared fixtures; if they cannot be resolved the run fails. |
244
- | `NANOS_TEST_CACHE_ROOT` | Reuses the given directory as the isolated test cache instead of a fresh one, avoiding a re-download on repeat runs. |
246
+ | Variable | Description |
247
+ | :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
248
+ | `NANOS_LIVE_TESTS` | `0` (or `false`/`no`/`off`) skips the live LuaLS/annotations tests, performs no network access, and does not enforce the coverage thresholds. Any other value or unset requires the shared fixtures; if they cannot be resolved the run fails. |
249
+ | `NANOS_TEST_CACHE_ROOT` | Reuses the given directory as the isolated test cache instead of a fresh one, avoiding a re-download on repeat runs. |
245
250
 
246
251
  ```bash
247
252
  NANOS_LIVE_TESTS=0 npm run test:coverage # fully offline
package/action.yml CHANGED
@@ -1,55 +1,55 @@
1
- name: 'nanos-world Lua Linter'
2
- description: 'Fast, accurate linter and type-checker for nanos world Lua scripts powered by LuaLS'
3
- author: 'nanos-world'
1
+ name: "nanos-world Lua Linter"
2
+ description: "Fast, accurate linter and type-checker for nanos world Lua scripts powered by LuaLS"
3
+ author: "nanos-world"
4
4
  branding:
5
- icon: 'check-circle'
6
- color: 'yellow'
5
+ icon: "check-circle"
6
+ color: "yellow"
7
7
 
8
8
  inputs:
9
9
  path:
10
- description: 'Path to workspace directory or Lua file to check'
10
+ description: "Path to workspace directory or Lua file to check"
11
11
  required: false
12
- default: '.'
12
+ default: "."
13
13
  checklevel:
14
- description: 'Minimum diagnostic severity level to report (Error, Warning, Information, Hint)'
14
+ description: "Minimum diagnostic severity level to report (Error, Warning, Information, Hint)"
15
15
  required: false
16
- default: 'Warning'
16
+ default: "Warning"
17
17
  config:
18
- description: 'Path to a custom .luarc.json configuration file'
18
+ description: "Path to a custom .luarc.json configuration file"
19
19
  required: false
20
- default: ''
20
+ default: ""
21
21
  annotations:
22
- description: 'Path to a custom annotations.lua file'
22
+ description: "Path to a custom annotations.lua file"
23
23
  required: false
24
- default: ''
24
+ default: ""
25
25
  luals-version:
26
26
  description: 'Version of LuaLS to use (or "latest")'
27
27
  required: false
28
- default: 'latest'
28
+ default: "latest"
29
29
  fail-on-error:
30
- description: 'Whether to fail the action step if diagnostic errors/warnings are found'
30
+ description: "Whether to fail the action step if diagnostic errors/warnings are found"
31
31
  required: false
32
- default: 'true'
32
+ default: "true"
33
33
  quiet:
34
- description: 'Suppress progress output'
34
+ description: "Suppress progress output"
35
35
  required: false
36
- default: 'false'
36
+ default: "false"
37
37
  ignore:
38
- description: 'Files or directories to ignore (supports glob patterns, multiple entries can be newline or comma separated)'
38
+ description: "Files or directories to ignore (supports glob patterns, multiple entries can be newline or comma separated)"
39
39
  required: false
40
- default: ''
40
+ default: ""
41
41
  cache:
42
- description: 'Whether to cache the LuaLS binary and annotations across workflow runs'
42
+ description: "Whether to cache the LuaLS binary and annotations across workflow runs"
43
43
  required: false
44
- default: 'true'
44
+ default: "true"
45
45
 
46
46
  runs:
47
- using: 'composite'
47
+ using: "composite"
48
48
  steps:
49
49
  - name: Setup Node.js
50
50
  uses: actions/setup-node@v7
51
51
  with:
52
- node-version: '24'
52
+ node-version: "24"
53
53
 
54
54
  # The ISO week refreshes the cache entry (a static key would never be saved
55
55
  # again); restore-keys fall back to previous weeks. Cheap: one `date` call.
@@ -118,5 +118,5 @@ runs:
118
118
  else
119
119
  # Exact version: a range could run a different release than the pinned
120
120
  # tag. Bump together with "version" in package.json.
121
- npx --yes nanos-lint@2.8.1 "${ARGS[@]}"
121
+ npx --yes nanos-lint@2.8.2 "${ARGS[@]}"
122
122
  fi
package/bin/nanos-lint.js CHANGED
@@ -13,5 +13,3 @@ runCLI()
13
13
  }
14
14
  process.exit(1);
15
15
  });
16
-
17
-