Skip to content

feat: adopt Neovim plugin best practices#23

Merged
zuqini merged 1 commit into
mainfrom
feat/nvim-best-practices
May 19, 2026
Merged

feat: adopt Neovim plugin best practices#23
zuqini merged 1 commit into
mainfrom
feat/nvim-best-practices

Conversation

@zuqini

@zuqini zuqini commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Audits zpack against the nvim-best-practices checklist and closes the gaps, plus hardens setup() against malformed input. No behavior change for a correct config — this is robustness, tooling, and CI work.

What's in here

Robustness

  • New validate.lua — advisory type-checking of setup() opts and plugin specs; emits actionable, field-named messages instead of cryptic downstream errors. Intentionally a leaf module (no requires) so health.lua can reuse it.
  • New health.lua:checkhealth zpack diagnostics (Neovim version, vim.pack availability, config validity, deprecated options, plugin status).
  • setup() no longer aborts on a malformed spec: a spec with no plugin source, a non-string import, or a non-string source is now reported and skipped rather than crashing the loader partway through.

Tooling & CI

  • .luarc.json + lua/ made type-clean; lua-language-server --check runs in CI.
  • .luacheckrc + luacheck linting in CI.
  • release-please automates releases and the changelog.
  • Test suite migrated from the custom harness to busted.

Housekeeping

  • goto statements removed for PUC Lua 5.1 / LuaJIT compatibility.

Test plan

  • nvim -u NONE -l tests/busted.lua — 383 tests pass.
  • luacheck lua/ tests/ — clean.
  • lua-language-server --check — clean (runs in CI with VIMRUNTIME resolved).

zuqini added a commit that referenced this pull request May 18, 2026
Each tests/*_test.lua is now a native busted spec that registers its
describe/it blocks at load time, discovered directly via the .busted
pattern. This drops the compatibility shim PR #23 left behind:
helpers.set_busted, helpers.test/helpers.describe, and the
tests/zpack_spec.lua aggregator are gone.

Assertions route through busted's bundled luassert, so a failed
assertion is now classified as a 'failure' rather than an 'error' —
restoring the xUnit failure-vs-error split for triage. assert_table_contains
becomes a registered luassert assertion (assert.contains).

Fixture setup/teardown moves from inline setup_test_env/cleanup_test_env
calls to before_each/after_each, which run uniformly on the passing and
failing path and remove the per-test 'remember to clean up' footgun.

pack_update_test_helpers.lua now exports parameterised cases() instead of
registering describe blocks itself; zupdate_test.lua and zrestore_test.lua
drive them as native specs.

Suite is unchanged at 379 tests; passes shuffled. luacheck clean.

Closes zpack_nvim-8dm
@zuqini
zuqini force-pushed the feat/nvim-best-practices branch 2 times, most recently from d454a30 to d41ac53 Compare May 19, 2026 01:32
Audit zpack against the nvim-best-practices checklist and close the
gaps, plus harden setup() against malformed input. No behavior change
for a correct config — this is robustness, tooling, and CI work.

Robustness:
- Add validate.lua — advisory type-checking of setup() opts and plugin
  specs, emitting actionable field-named messages instead of cryptic
  downstream errors. A leaf module so health.lua can reuse it.
- Add health.lua — :checkhealth zpack diagnostics: Neovim version,
  vim.pack availability, config validity, deprecated options, and
  plugin status.
- setup() no longer aborts on a malformed spec: a spec with no plugin
  source, a non-string import, or a non-string source is reported and
  skipped rather than crashing the loader partway through.

Tooling & CI:
- Add .luarc.json and make lua/ type-clean; lua-language-server --check
  runs in CI.
- Add .luacheckrc and luacheck linting in CI.
- Automate releases and the changelog with release-please.
- Migrate the test suite from the custom harness to busted.

Housekeeping:
- Remove goto statements for PUC Lua 5.1 / LuaJIT compatibility.
@zuqini
zuqini force-pushed the feat/nvim-best-practices branch from d41ac53 to c329797 Compare May 19, 2026 01:49
@zuqini
zuqini merged commit 2f45de6 into main May 19, 2026
4 checks passed
@zuqini
zuqini deleted the feat/nvim-best-practices branch May 19, 2026 01:58
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

Successfully merging this pull request may close these issues.

1 participant