Matt
Matt

Reputation: 8962

eslint custom rule - disable specific html elements in jsx syntax

I would like to know how is it possible to create a custom rule, where I can define fobidden html elements in jsx syntax.

For example, I want to be sure that only <Button /> and <Input /> compontents from my ui library are used. If <input> or <button> html elements are used in jsx, eslint should throw an error.

Upvotes: 1

Views: 1519

Answers (1)

paolostyle
paolostyle

Reputation: 1988

If you want to create an ESLint rule by yourself (e.g. to learn something new) then this won't be helpful and it's certainly out of scope for a StackOverflow question, but if you need it for practical reasons, there is already a rule that does exactly what you want.

Upvotes: 3

Related Questions