AlpineLanguage Server Protocol

a npm: alpinejs-lsp

// before: silent until clicked
<button @click="$refs.pannel.style.color = 'red'">
// alpinelps, at write time:
warn 4:19  alpine/dangling-ref  $refs.pannel matches no x-ref

// the component tree it actually sees
<div x-data="{ count: 0 }">
  <button @click="cont++">        ← "count" exists, "cont" doesn't
  <span x-show="open &&">        ← truncated chain
</div>

alpine/syntax

alpine/unknown-variable

alpine/dangling-ref

alpine/malformed-x-for

alpine/unknown-directive

alpine/unknown-modifier

alpine/unknown-magic

# run it - no install
$ npx alpinejs-lsp --check index.html

# or install globally
$ npm install -g alpinejs-lsp

// opencode.json - any Alpine project
{
  "lsp": {
    "alpinejs": {
      "command": ["npx", "-y", "alpinejs-lsp"],
      "extensions": [".html"]
    }
  }
}

# anywhere else - CI, editor, review
$ npx alpinejs-lsp --check src/**/*.html