marcoroth / stimulus-parser

Statically analyze Stimulus controllers in your project.

Home Page:https://hotwire.io/ecosystem/tooling/stimulus-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support inheritance for `methods`, `targets`, `values`, etc.

marcoroth opened this issue · comments

It's common for Stimulus controllers to inherit some behaviour from an (abstract) base controller.

Currently the inherited methods, targets, values, etc. aren't provided on the child controller.

Like:

// base_controller.js

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = ["base"]
}
// specfic_controller.js

import BaseController from "./base_controller"

export default class extends BaseController {
  static targets = ["specific"]
}

The specific controller should now have both the base and specific target.