Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react/no-invalid-html-attribute seems to report false positives #3172

Closed
Primajin opened this issue Jan 10, 2022 · 7 comments · Fixed by #3174
Closed

react/no-invalid-html-attribute seems to report false positives #3172

Primajin opened this issue Jan 10, 2022 · 7 comments · Fixed by #3174

Comments

@Primajin
Copy link
Contributor

Hey there, I've got an automatic lint bump in my repo that introduces react/no-invalid-html-attribute as a new rule and it fails with two/three errors:

https://github.com/Primajin/eyesbound/runs/4760311505?check_suite_focus=true

Error - “home” is never a valid “rel” attribute value.

By adding rel="home" to a hyperlink, a page indicates that the destination of that hyperlink is the homepage of the site [...]
https://microformats.org/wiki/rel-home
This is a draft from 2005... Not sure if it was ever official?

Error - “shortcut” is never a valid “rel” attribute value.

If I read https://mathiasbynens.be/notes/rel-shortcut-icon correctly this is not according to specification but older IE need it when the file is not exactly called favicon.ico, is that correct?

So are these arguably false positives, or instead everyone is just using it wrong and it was never a specification - thus I still wonder if everyone uses it kind of makes it a default 🤔 😅
Thanks for looking into it folks.

@ljharb
Copy link
Member

ljharb commented Jan 10, 2022

I'm pretty sure a rel of "home" was never official; that link is to a draft.

If you choose not to name the file favicon.ico for some reason, then you should use an override comment to disable the rule - but it's far easier to just name the file that.

@Primajin
Copy link
Contributor Author

Alright fair enough, thanks for checking 👍🏻

@Primajin
Copy link
Contributor Author

OK I will just remove that line entirely. 👍🏻

For future people stranding here it might also be worth mentioning:

For historical reasons, the HTML specification now allows the use of shortcut as a link relation if it’s immediately followed by a single U+0020 space character and the icon keyword. Of course, it’s still better not to use any HTML at all.

@ljharb
Copy link
Member

ljharb commented Jan 11, 2022

If the html specification allows it, then we should also, to be clear.

@Primajin
Copy link
Contributor Author

Yeah I just wonder how much "quirks mode" that is 😅

@ljharb
Copy link
Member

ljharb commented Jan 11, 2022

Very, but if it’s valid, then it can’t hurt to support it.

@Primajin
Copy link
Contributor Author

Then I can offer you #3174 😄

@Primajin Primajin reopened this Jan 16, 2022
Primajin added a commit to Primajin/eslint-plugin-react that referenced this issue Jan 17, 2022
@ljharb ljharb closed this as completed in e0af60b Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants