Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator Controller Comment Uses Incorrect Syntax #82

Closed
tsmith-dev opened this issue Oct 14, 2021 · 1 comment
Closed

Generator Controller Comment Uses Incorrect Syntax #82

tsmith-dev opened this issue Oct 14, 2021 · 1 comment

Comments

@tsmith-dev
Copy link

Steps to reproduce

rails g stimulus hello_world

Expected behavior

According to documentation, "when an identifier is composed of more than one word, write the words in kebab-case (i.e., by using dashes: date-picker, list-item)." Therefore, the generated help text in the controller should read:

// Connects to data-controller="hello-world"

Actual behavior

Auto-generated help text in the controller incorrectly reads:

// Connects to data-controller="hello_world"

Using this format data-controller="hello_world" in your view results in the following error

Warning connecting controller "hello_world"

Element references undefined controller "hello_world"

Generated comment doesn't compensate for underscored controller filenames, which are acceptable according to the documentation. "In filenames, separate multiple words using either underscores or dashes (snake_case or kebab-case: controllers/date_picker_controller.js, controllers/list-item-controller.js)."

System configuration

Rails version: Rails 7.0.0.alpha2

Ruby version: ruby 3.0.1p64

Stimulus-rails version: 0.5.4

Stimulus version: 3.0.0-beta.2

@dhh
Copy link
Member

dhh commented Oct 14, 2021

Fixed via #79 and #80.

@dhh dhh closed this as completed Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants