Skip to content

jsx-a11y/control-has-associated-label working unstably #21

@algoORgoal

Description

@algoORgoal

Description

eslint rule 중 하나인 jsx-a11y/control-has-associated-label이 정상정으로 동작하지 않는 것을 확인하였습니다. label element에 htmlFor를 추가하고 input element에 id를 추가하였음에도 warning이 사라지지 않습니다.
image

문제: airbnb config에서 두 조건을 모두 만족시키지 않으면 error로 간주합니다.
https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react-a11y.js

해결 방법: 두 조건을 모두 만족시킵니다.

  1. https://stackoverflow.com/questions/57616720/react-jsx-a11y-eslint-throws-unexpected-errors-for-control-label?noredirect=1&lq=1
  2. Consider adding jsx-a11y/control-has-associated-label when it becomes more stable manovotny/eslint-config-get-off-my-lawn#109
  3. My <label> has htmlFor matching an input's id, but jsx-a11y/label-has-associated-control still warns? jsx-eslint/eslint-plugin-jsx-a11y#718 (comment)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions