🏗 Create eslint rule for preferred Preact props#35722
Merged
caroqliu merged 11 commits intoampproject:mainfrom Aug 23, 2021
Merged
🏗 Create eslint rule for preferred Preact props#35722caroqliu merged 11 commits intoampproject:mainfrom
caroqliu merged 11 commits intoampproject:mainfrom
Conversation
4864fee to
49503f4
Compare
jridgewell
approved these changes
Aug 19, 2021
|
Hey @erwinmombay, @jridgewell! These files were changed: |
jridgewell
reviewed
Aug 20, 2021
developit
approved these changes
Aug 20, 2021
developit
left a comment
There was a problem hiding this comment.
Internally Preact doesn't care about class vs className, the only important thing is that components use them consistently (so that destructured class doesn't get overwritten by rest-collected className, etc). I would guess that class is preferable there though because of the proximity to the Web Component wrappers 👍.
jridgewell
approved these changes
Aug 20, 2021
10 tasks
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 PR introduces
preact-preferred-propswhich enforces two things on files written insrc/preact, Bento components, and Storybooks:props) should access keys of expected styles.component.type.jsIn particular, both of the above expect
classoverclassName,tabIndexovertabindex, and kebab-cased SVG attributes. Of these,tabIndexis the only one that is a preferred style in common by both the preact and react libraries.In the long term we may consider breaking out
tabIndexinto acommon-preferred-propsrule that deals with properties both libraries will approve of. This may include aria attributes and others from possibleStandardNames.js.Partial for #35678
/to @developit