question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better eslint a11y rule defaults

See original GitHub issue

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 🤔 :

<label>lovely label<input type="text/></label>

The recommended config for this rule is much more sane.

Would you accept a PR to fix this?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
herecydevcommented, Jun 21, 2020

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

0reactions
dmordacommented, Jun 20, 2020

Since this change, I noticed I’m getting warnings for the rule when using in combination with the Formik <Field> tag.

No warning

<label htmlFor="phone">
   Phone
   <input type="text" id="phone" name="phone" />
</label>

Get warning

<label htmlFor="phone">
   Phone
   <Field type="input" id="phone" name="phone" />
</label>

Both approaches produce the same HTML output. Is there a way to address that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using ESLint Plugin jsx-a11y With Recommended and ...
Customizing rules with warn is a way to disable recommended rules. jsx-a11y Docs, NPM, and Rules List. The documentation is extensive and ...
Read more >
12 essential ESLint rules for React - LogRocket Blog
This rule is good at finding potential dependency-related bugs, but there are some limitations: By default, custom Hooks with dependency arrays ...
Read more >
Working with Rules - ESLint - Pluggable JavaScript Linter
"suggestion" means the rule is identifying something that could be done in a better way but no errors will occur if the code...
Read more >
Set up ESLint to Audit Accessibility Issues in React | egghead.io
This should include adding static analysis checking for common accessibility standards and best practices. We can get this with the latest eslint plugin:...
Read more >
eslint-plugin-react-native-a11y - Formidable Labs
Eslint -plugin-react-native-a11y is a collection of React Native specific ESLint rules for identifying accessibility issues. Building upon the foundation set ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found