Skip to content

react/no-invalid-html-attribute Shouldn't be auto-fixable #3458

@Janpot

Description

@Janpot

The automatic fix that is performed by the react/no-invalid-html-attribute rule removes invalid values. I'd argue this is dangerous behavior as removing the value is probably not the intended outcome, I mean, I've put it there for a reason in the first place. Some examples:

  • I have a typo in one of the values, auto-fix removes it instead of forcing me to correct it
  • I have a non-standard value e.g. rel="sponsored", I'd like to replace it with nofollow instead of automatically removing it. Or I'd like to add an ignore directive to allow for it.

Activity

ljharb

ljharb commented on Oct 11, 2022

@ljharb
Member

Yes, I agree it should be a suggestion and not an autofix. A PR to fix that is welcome.

himanshu007-creator

himanshu007-creator commented on Oct 19, 2022

@himanshu007-creator
Contributor

Hi, i would like to give it a try

ljharb

ljharb commented on Oct 19, 2022

@ljharb
Member

Go for it!

added 2 commits that reference this issue on Nov 28, 2022
4f1ace7
a522476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @ljharb@Janpot@himanshu007-creator

      Issue actions

        react/no-invalid-html-attribute Shouldn't be auto-fixable · Issue #3458 · jsx-eslint/eslint-plugin-react