marcoroth/stimulus-lsp

Diagnostic: Make sure that Stimulus Controllers are exported

Opened this issue · 0 comments

We should add a warning if you define/extend the Stimulus Controller class in a file and you are not exporting it.

Bad:

import { Controller } from "@hotwired/stimulus"

class HelloController extends Controller {

}

Good:

import { Controller } from "@hotwired/stimulus"

export default class HelloController extends Controller {

}

or:

import { Controller } from "@hotwired/stimulus"

class HelloController extends Controller {

}

export default HelloController