Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Rule react-a11y-input-elements incorrectly requiring placeholder for radio, checkbox, and file inputs #749

Closed
narthollis opened this issue Dec 30, 2018 · 1 comment · Fixed by #754
Assignees
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Status: Accepting PRs Type: Bug
Milestone

Comments

@narthollis
Copy link

Bug Report

  • tslint-microsoft-contrib version: 6.0.0
  • TSLint version: 5.12.0
  • TypeScript version: 3.2.2
  • Running TSLint via: CLI

TypeScript code being linted

<input
    type="checkbox"
    checked={props.isSelected}
    onChange={onChange}
/>

with tslint.json configuration:

  "extends": [
    "tslint:latest",
    "tslint-microsoft-contrib/recommended_ruleset"
  ],

  "rulesDirectory": [
    "tslint-microsoft-contrib"
  ],

  "rules": {
    "quotemark": [true, "single", "jsx-double"],
  }
}

Actual behavior

ERROR: 40:17 react-a11y-input-elements Input elements must include default, place-holding characters if empty

Expected behavior

Inputs with type checkbox, radio, and, file should not require a placeholder value.

@JoshuaKGoldberg JoshuaKGoldberg added Type: Bug Status: Accepting PRs Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. labels Dec 31, 2018
@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Dec 31, 2018

Agreed, thanks for pointing this out @narthollis! Accepting PRs to no longer complain for input elements of those types.

For future reference: it looks like the following if statement should also check the type attribute to make sure it's not one of the above types that don't need a placeholder value.

https://github.com/Microsoft/tslint-microsoft-contrib/blob/6c6e1d1fe6991ae3bb3f267e6f8c468316a00131/src/reactA11yInputElementsRule.ts#L53

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Status: Accepting PRs Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants