docs: add convention/anti-pattern around shadowing HTMLElement names#46
Merged
docs: add convention/anti-pattern around shadowing HTMLElement names#46
Conversation
mr-mig
reviewed
Jun 24, 2020
Based on user feedback this section has been re-written for a few reasons: - It focusses more on the `@controller` decorator and less on Custom Elements - It repeats (multiple times, including a call-out box) that the class name must consist of two words, as this is something users miss.
koddsson
approved these changes
Jul 14, 2020
Contributor
koddsson
left a comment
There was a problem hiding this comment.
Looks good to me. I wonder if we could also take the interactive form functionality and package it into a eslint rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds some more docs around method naming, per @muan's comment in #45 (comment): it discusses how people should avoid method names that shadow existing HTMLElement properties, also adding an interactive form so people can type out their method name to see it (originally I had a list but it was a bit boring and very long).
It also has warnings for method names which, while allowed, we'd like to not see:
The form is live, and makes a dynamic check against
HTMLElement.prototype, it also checks ancestors to see which particular class has the shadowed property, for quicker googling if the user wants to google.