Comments (4)
I was planning to use the same list as https://github.com/yannickcr/eslint-plugin-react/blob/master/lib/rules/no-unknown-property.js so you can safely disable the rule, but am getting a bit hung up on how that rule allows you to pass regular attributes in certain cases, such as custom React components and custom HTML elements.
Custom React components I've used and created have followed the convention of using className
, so transforming class
to className
works for them. Not so sure about other attributes, though.
Initial gut feeling was that we should do the full list of transformations for things which look like HTML tags, but only do class
→ className
for everything else. However, this breaks in cases where a component lets you customise what gets rendered by passing a tag name.
I'm also thinking the for
→ htmlFor
transformation should be restricted to <label>
, but I don't know if people out there are creating <Label>
wrapper components which follow the htmlFor
convention.
You also probably don't want to stop using this ESLint rule because it catches things like using incorrect casing for event handlers.
The solution is probably to create a PR to make the react/no-unknown-property rule customisable for the limited transforms this plugin currently performs.
I'm getting a better understanding of why this behaviour was removed from JSX!
from babel-plugin-react-html-attrs.
I just noticed react/no-unknown-property supports the --fix
option - does that make this plugin slightly redundant, given the potential it has to cause confusion?
from babel-plugin-react-html-attrs.
I still prefer using this plugin because writing markup and using className
has caused enough confusing for our front-end team using React/JSX.
Even for me, there's less cognitive switching when coding. Spending 2 decades writing HTML and all ;)
You can close this issue, if you'd like. I just disable the rule & deal with the minimal number of warnings that may crop up. I have tons more issues without this plugin, TBH.
from babel-plugin-react-html-attrs.
- Document recommended
ignore
config forreact/no-unkown-property
from babel-plugin-react-html-attrs.
Related Issues (14)
- Consider adding colSpan, rowSpan and possibly others HOT 2
- Release new version HOT 7
- How to edit .babelrc HOT 1
- Restrict attribute renaming by JSX element name HOT 1
- The plugin "react-html-attrs" didn't export a Plugin instance while parsing file HOT 1
- Remove the attribute value for boolean attributes
- Option to white-list components HOT 1
- Cannot read property 'type' of undefined
- Consider converting the "style" attribute from a string to a CSSProperties object? HOT 2
- Babel 6 HOT 2
- Inlining elements
- how about style arrtibute HOT 1
- how to handle typescript issue HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-react-html-attrs.