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
Add new rule: no-restricted-html-elements #1820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR.
I think the rule name should be no-restricted-html-elements
, just like any other user-specified disallow rule.
e.g.
- https://eslint.vuejs.org/rules/no-restricted-block.html
- https://eslint.org/docs/rules/no-restricted-imports
- https://eslint.org/docs/rules/no-restricted-globals
Could you change the rule name?
Also, like any other no-restricted rules, could you change the options to be accepted in an array, and allow users to specify custom messages in the options using object forms?
Perhaps the source code for the following rule will be helpful to you.
https://eslint.vuejs.org/rules/no-restricted-block.html
@ota-meshi Thank you so much for leaving a review so quickly! It's my first time contributing to this repo, so it was rough around the edges, and I appreciate your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only suggest some minor spelling/wording and code style improvements. The rest looks fine though from my side. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost LGTM. I have some simple change requests in usage.
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing the feedback! :)
Hi there! I would like to add a new rule to the plugin inspired by the React forbid-elements rule. I'm trying to solve a problem with a large project we're working on at work where developers aren't using our Button component from our component library, but are instead are using the button html element. I would like to forbid use of the button html tag altogether to encourage adoption, so I would like to add:
to our eslintrc file and then emit linting errors when new button tags are added. I will likely also use this for anchor tags to encourage use of our Link component.
Another use case might be to restrict use of deprecated html elements, like marquee.