Closed HatulaPro closed 1 year ago
Thanks for raising this issue! I think as a rule that defaults to "off"
, this would be great to have, as something like solid/no-array-handlers
.
If you'd like to give it a try I'd appreciate it! You'll probably want to handle namespaced handlers like on:click
(look for a regex beginning with /^on
in solid/reactivity
for an example). I'm happy to help if you run into any issues.
Describe the need Due to the limitations of TypeScript, SolidJS can not typecheck event handlers that are passed as an array.
For example, the following code will compile despite causing a runtime error.
This makes simple mistakes very easy to make.
Suggested Solution Adding a new rule that would error/warn about the usage of this feature. I don't think it should be recommended since it would cause a lot of issues in many projects, but being able to opt in would be nice.
Possible Alternatives Changing the way JSX works is not really an option, but I'm open to alternative solutions.