Skip to content

Commit

Permalink
feat(eslint-plugin-template): [accessibility-interactive-supports-foc…
Browse files Browse the repository at this point in the history
…us] prefix rule name
  • Loading branch information
sandikbarr committed Sep 18, 2022
1 parent 8a263ac commit b2d6a47
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
DO NOT EDIT.
This markdown file was autogenerated using a mixture of the following files as the source of truth for its data:
- ../../src/rules/interactive-supports-focus.ts
- ../../tests/rules/interactive-supports-focus/cases.ts
- ../../src/rules/accessibility-interactive-supports-focus.ts
- ../../tests/rules/accessibility-interactive-supports-focus/cases.ts
In order to update this file, it is therefore those files which need to be updated, as well as potentially the generator script:
- ../../../../tools/scripts/generate-rule-docs.ts
Expand All @@ -13,7 +13,7 @@

<br>

# `@angular-eslint/template/interactive-supports-focus`
# `@angular-eslint/template/accessibility-interactive-supports-focus`

Ensures that elements with interactive handlers like `(click)` are focusable.

Expand Down Expand Up @@ -43,7 +43,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -70,7 +70,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -97,7 +97,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -124,7 +124,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -151,7 +151,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -178,7 +178,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -205,7 +205,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -232,7 +232,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -259,7 +259,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -286,7 +286,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -313,7 +313,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -329,6 +329,33 @@ The rule does not have any configuration options.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

<br>

---

<br>

#### Default Config

```json
{
"rules": {
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
}
```

<br>

#### ❌ Invalid Code

```html
<div [attr.contenteditable]="false" (keyup)="onKeyUp()">Cannot be focused</div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

</details>

<br>
Expand All @@ -347,7 +374,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -373,7 +400,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -401,7 +428,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -428,7 +455,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -455,7 +482,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -482,7 +509,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -510,7 +537,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -543,7 +570,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -571,7 +598,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -598,7 +625,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -628,7 +655,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -654,7 +681,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -682,7 +709,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -709,7 +736,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -736,7 +763,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -765,7 +792,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand Down Expand Up @@ -794,7 +821,7 @@ The rule does not have any configuration options.
```json
{
"rules": {
"@angular-eslint/template/interactive-supports-focus": [
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
Expand All @@ -821,6 +848,34 @@ The rule does not have any configuration options.
<div role="textbox" tabindex="0" (click)="onClick()"></div>
```

<br>

---

<br>

#### Default Config

```json
{
"rules": {
"@angular-eslint/template/accessibility-interactive-supports-focus": [
"error"
]
}
}
```

<br>

#### ✅ Valid Code

```html
<div contenteditable="true" (keyup)="onKeyUp()">Edit this text</div>
<div [attr.contenteditable]="true" (keydown)="onKeyDown()">Edit this text</div>
<div contenteditable (keypress)="onKeyPress()">Edit this too!</div>
```

</details>

<br>
2 changes: 1 addition & 1 deletion packages/eslint-plugin-template/src/configs/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"rules": {
"@angular-eslint/template/accessibility-alt-text": "error",
"@angular-eslint/template/accessibility-elements-content": "error",
"@angular-eslint/template/accessibility-interactive-supports-focus": "error",
"@angular-eslint/template/accessibility-label-for": "error",
"@angular-eslint/template/accessibility-label-has-associated-control": "error",
"@angular-eslint/template/accessibility-table-scope": "error",
Expand All @@ -13,7 +14,6 @@
"@angular-eslint/template/cyclomatic-complexity": "error",
"@angular-eslint/template/eqeqeq": "error",
"@angular-eslint/template/i18n": "error",
"@angular-eslint/template/interactive-supports-focus": "error",
"@angular-eslint/template/mouse-events-have-key-events": "error",
"@angular-eslint/template/no-any": "error",
"@angular-eslint/template/no-autofocus": "error",
Expand Down
9 changes: 5 additions & 4 deletions packages/eslint-plugin-template/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import accessibilityAltText, {
import accessibilityElementsContent, {
RULE_NAME as accessibilityElementsContentRuleName,
} from './rules/accessibility-elements-content';
import accessibilityInteractiveSupportsFocus, {
RULE_NAME as accessibilityInteractiveSupportsFocusRuleName,
} from './rules/accessibility-interactive-supports-focus';
import accessibilityLabelFor, {
RULE_NAME as accessibilityLabelForRuleName,
} from './rules/accessibility-label-for';
Expand All @@ -35,9 +38,6 @@ import cyclomaticComplexity, {
} from './rules/cyclomatic-complexity';
import eqeqeq, { RULE_NAME as eqeqeqRuleName } from './rules/eqeqeq';
import i18n, { RULE_NAME as i18nRuleName } from './rules/i18n';
import interactiveSupportsFocus, {
RULE_NAME as interactiveSupportsFocusRuleName,
} from './rules/interactive-supports-focus';
import mouseEventsHaveKeyEvents, {
RULE_NAME as mouseEventsHaveKeyEventsRuleName,
} from './rules/mouse-events-have-key-events';
Expand Down Expand Up @@ -78,6 +78,8 @@ export default {
rules: {
[accessibilityAltTextRuleName]: accessibilityAltText,
[accessibilityElementsContentRuleName]: accessibilityElementsContent,
[accessibilityInteractiveSupportsFocusRuleName]:
accessibilityInteractiveSupportsFocus,
[accessibilityLabelForRuleName]: accessibilityLabelFor,
[accessibilityLabelHasAssociatedControlRuleName]:
accessibilityLabelHasAssociatedControl,
Expand All @@ -89,7 +91,6 @@ export default {
[cyclomaticComplexityRuleName]: cyclomaticComplexity,
[eqeqeqRuleName]: eqeqeq,
[i18nRuleName]: i18n,
[interactiveSupportsFocusRuleName]: interactiveSupportsFocus,
[mouseEventsHaveKeyEventsRuleName]: mouseEventsHaveKeyEvents,
[noAnyRuleName]: noAny,
[noAutofocusRuleName]: noAutofocus,
Expand Down

0 comments on commit b2d6a47

Please sign in to comment.