-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add basic lints to the HTML macro. #1748
Conversation
I thought I'd broken something, but this seems to be failing in other pull requests as well :D |
Visit the preview URL for this PR (updated for commit bfcb04c): https://yew-rs--pr1748-alt-text-lint-efwbd9d4.web.app (expires Sun, 28 Nov 2021 13:04:21 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
I'm also confused about the unit tests because they work on my local machine (with the identical toolchain). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing!
Did you manage to gather some feedback yet? |
Working on it :D |
Thanks 😊 |
3647c54
to
cd69bd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from these relatively small issues I think this initial version is ready to be merged
24d0664
to
2f9c6a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lints look great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really excited for those!
|
||
fn main() { | ||
let bad_a = html! { | ||
<a>{"I don't have a href attribute"}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think the official style used by Yew has spaces between the {
and the quotes (e.g. <a>{ "I don't have a href attribute" }</a>
. Although #1774 would make this redundant.
3ce5917
to
9e5e620
Compare
9e5e620
to
cd0edda
Compare
2d1d751
to
3d5d2a7
Compare
This should be ready for another review :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, can't wait to see what other lints could spring from these!
Hope the review helps :)
d46598e
to
2d1fbc1
Compare
As mentioned in #1334 this is not considered blocked - @teymour-aldridge I know you mentioned about lack of reviewing power but I'm ready and able :) |
bc69f95
to
8c41db3
Compare
I had to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit-picks from me 🙃
I generally would prefer seeing the router changes in a different PR - seems odd to stick them in a PR adding lints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also console.warn
these lints at runtime when compiled in debug mode? That way, people who don't use nightly will also be able to see the warnings
"'#' is not a suitable value for the `href` attribute. \ | ||
Without a meaningful attribute assistive technologies \ | ||
will struggle to understand your webpage." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we link to documentation or add help
information like clippy
or cargo check
do? A link to docs about ARIA roles would be nice to have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added simple links to https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML#onclick_events but i think in the future this can be improved upon
@hamza1311 Since this PR was not my initial idea, i would prefer to merge what we have now, and if you want you can improve it later by making it log to |
Is there any way to opt out of certain lints, like for clippy we have |
No, not right now. Also, it would be better if you comment on the tracking issue instead of this already merged PR. |
This adds some basic accessibility-related lints to the HTML macro.
(Part of) #1334