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

Log warnings to the console #84

Merged
merged 6 commits into from
Nov 3, 2024
Merged

Conversation

leonvogt
Copy link
Owner

@leonvogt leonvogt commented Oct 20, 2024

Warnings added:

  • data-controller doesn't match any registered controller
  • Turbo Frame ID is not unique
  • Elements with data-turbo-permanent but no id (or no unique id)
  • Stimulus targets that aren't nested within the corresponding controller
  • Stimulus values that aren't defined on the controller element but instead on child element
  • Stimulus outlet selector is defined but does not match any elements on the page

@leonvogt leonvogt linked an issue Oct 20, 2024 that may be closed by this pull request
7 tasks
@leonvogt leonvogt changed the title Log warnings to the console #81 Log warnings to the console Oct 20, 2024
@leonvogt leonvogt marked this pull request as draft October 20, 2024 17:19
@leonvogt leonvogt marked this pull request as ready for review November 3, 2024 12:01
@leonvogt
Copy link
Owner Author

leonvogt commented Nov 3, 2024

The last two warning were not added because I'm currently unsure how to approach them.
The data attributes for values and and outlets are dynamic:

  • data-[identifier]-[outlet]-outlet=
  • data-[identifier]-[value]-value=

This extension has currently no information about the possible values or outlets, defined in the controllers.
Since I didn't find a good regex style of querying the DOM, to find the right data-attributes, it seems quite difficult to spot wrong placement or content for these.

The only good option I see, would be to extract the possibles values and outlets from the window.Stimulus object.
With that it would be a lot easier to query the right data attributes.

But I would like to tackle that in a different PR, since I feel like it would be handy to grab more than just the values and targets from the window object.

@leonvogt leonvogt merged commit dbf610e into main Nov 3, 2024
4 checks passed
@leonvogt leonvogt deleted the 81-log-warnings-to-the-console branch November 3, 2024 12:36
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.

Log warnings to the console
1 participant