[New]: forbid-dom-props: support React Strict Dom elements (html.div, etc)#3946
[New]: forbid-dom-props: support React Strict Dom elements (html.div, etc)#3946mdjastrzebski wants to merge 6 commits intojsx-eslint:masterfrom
forbid-dom-props: support React Strict Dom elements (html.div, etc)#3946Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3946 +/- ##
==========================================
- Coverage 97.84% 97.72% -0.12%
==========================================
Files 136 133 -3
Lines 10008 9999 -9
Branches 3717 3720 +3
==========================================
- Hits 9792 9772 -20
- Misses 216 227 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Note: the failing checks seems to be related to other rules this PR is not chaning: |
|
interesting, i'd never heard of this before. seems like an evolution of react-native-web? |
ljharb
left a comment
There was a problem hiding this comment.
This seems like something that needs to be behind an option - i assume that the lowercase only works because of the .? (meaning that const { div } = html; <div /> wouldn't work?
|
@ljharb re RSD: RSD is alternative approach for React Native + Web codesharing. RN Web took RN-first approach, while RSD takes. web-first approach. re impl: Since RSD closely resembles regular DOM elements, I though that |
|
I think either one is fine as long as it's behind an option, since this is an official react offering (if it was unofficial, then it should go in the component rule for sure) |
|
@ljharb how should I implement such option? Is it an extra param for the rule, like |
|
Sure, let's go with that for now. |
Summary
Add suport for React Strict DOM notation of DOM nodes:
html.div,html.span,h.h1, etcDetails
The code is based on
forbid-component-propsrule that already supportedNamespace.Componentnotation.Testing
Added pass/fail tests for
html.div,h.span, etc