-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Better eslint a11y rule defaults #24582
Comments
Oh wow I don't think it should be warning that much! I'm sorry this is causing you pain, @mojodna! I think we still want the strict configuration for the rule. I'm confused as to why that case is causing it to trigger though. Going by their documentation, your usage (aside from the missing |
Because their default (even in strict mode) is not "warn", instead it's an object that specifies some ignored elements.
100% agree but the issue as I see it is that Gatsby is taking the defaults provided by eslint-a11y and then tweaking them differently. I can't help think that Gatsby should just take what's there and map any rule "errors" to "warn", until Gatsby v3. That way things don't get missed, the TODO there that is out-of-date and that would have been implemented already, etc. Let me know if that helps? |
Hi there @herecydev! Looks like they responded in the issue you linked to with a recommendation for making your example not trigger the warning, using for/ID-linking. Does that resolve your issue? |
Nope, there's nothing broken with using If you look here in the rule code they're trying to cater for specifically the case I've mentioned: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/src/rules/control-has-associated-label.js#L58-L62 I can't stress any more how the issue is that Gatsby has changed the default rule configuration and is causing that issue to manifest |
@herecydev if you'd like to PR, I'll merge it in. I don't want it to be a blocker to your development but want to make sure it's configured properly so it will catch labelling issues. Thank you! |
@madalynrose I've made those changes. |
Since this change, I noticed I'm getting warnings for the rule when using in combination with the Formik tag. No warning
Get warning
Both approaches produce the same HTML output. Is there a way to address that? |
I think this case may be relevant to you: custom component It looks like by supplying that to the config it will then validate the rendered input (that Formik will produce) against the label |
Summary
The default a11y eslint rules are all defined as "warn". This is okay for most rules but for the newly added "jsx-a11y/control-has-associated-label" rule, adding "warn" is making it almost unusable.
Even the following is flagged by eslint 🤔 :
The recommended config for this rule is much more sane.
Would you accept a PR to fix this?
The text was updated successfully, but these errors were encountered: