Skip to content

Latest commit

 

History

History
386 lines (262 loc) · 3.98 KB

no-positive-tabindex.md

File metadata and controls

386 lines (262 loc) · 3.98 KB

@angular-eslint/template/no-positive-tabindex

Ensures that the tabindex attribute is not positive


Rule Options

The rule does not have any configuration options.


Usage Examples

The following examples are generated automatically from the actual unit tests within the plugin, so you can be assured that their behavior is accurate based on the current commit.


❌ - Toggle examples of incorrect code for this rule

Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

❌ Invalid Code

<div tabindex="5"></div>
               ~



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

❌ Invalid Code

<div [attr.tabindex]="21"></div>
                      ~~



✅ - Toggle examples of correct code for this rule

Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span id="2"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span tabindex></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span tabindex="-1"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span tabindex="0"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span [attr.tabindex]="-1"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span [attr.tabindex]="0"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span [attr.tabindex]="tabIndex"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span [attr.tabindex]="null"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<span [attr.tabindex]="undefined"></span>



Default Config

{
  "rules": {
    "@angular-eslint/template/no-positive-tabindex": [
      "error"
    ]
  }
}

✅ Valid Code

<app-test [tabindex]="1"></app-test>