Linting Kendo components

1 Answer 42 Views
General Discussions
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Grant asked on 10 Oct 2024, 05:29 AM

Hi, 

Does your team have an suggestions on how to go about linting Kendo elements?

My situation is that, Im using Kendo buttons inside a KendoForm to do things other than submit (which is the default button type in many browsers).  Best practice says that when using buttons, we hould always delcar the type (as button|submit|reset), but type is not a required attribute. 

I would like to lint my code to make sure taht any button declared has a type. Ths can be acheived on HTML buttons using @jsx-eslint/react/button-has-type rule, however it does not work on KendoButtons, but case those componetns are not HTML buttons.

The only other option i can think of is to extend the KendoButton into a custom component that requires the type attribute, and then only use my custom button interface (TypeScript).

Any thoughts?

Thanks,
Grant

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 11 Oct 2024, 05:20 AM

Hi Grant,

Thank you for contacting us.

Since the "type" attribute is not required in the KendoReact button, as you mentioned, the only option for achieving this would be by extending the Button component and making the "type" property required.

I do agree that specifying the type is a good practice, but in this case, it will be a major breaking change for existing projects if we make it a required field.

 

Regards,
Konstantin Dikov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
General Discussions
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or