GithubHelp home page GithubHelp logo

Comments (4)

insin avatar insin commented on July 16, 2024

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 classclassName 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 forhtmlFor 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.

insin avatar insin commented on July 16, 2024

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.

ericclemmons avatar ericclemmons commented on July 16, 2024

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.

insin avatar insin commented on July 16, 2024
  • Document recommended ignore config for react/no-unkown-property

from babel-plugin-react-html-attrs.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.