Skip to content

Commit f112c16

Browse files
committed
feat(eslint-plugin-template)!: add textContent to default allowList
1 parent 446f547 commit f112c16

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

packages/eslint-plugin-template/docs/rules/elements-content.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The rule accepts an options object with the following properties:
3434
```ts
3535
interface Options {
3636
/**
37-
* Default: `["aria-label","innerHtml","innerHTML","innerText","outerHTML","title"]`
37+
* Default: `["aria-label","innerHtml","innerHTML","innerText","outerHTML","textContent","title"]`
3838
*/
3939
allowList?: string[];
4040
}
@@ -200,8 +200,10 @@ interface Options {
200200
<a [innerHTML]="dangerouslySetHTML"></a>
201201
<a [innerText]="text"></a>
202202
<a [outerHTML]="text"></a>
203+
<a [textContent]="text"></a>
203204
<a aria-hidden></a>
204205
<button [attr.aria-hidden]="true"></button>
206+
<button [textContent]="dynamicText"></button>
205207
<h5 [attr.aria-label]="text"></h5>
206208
<h6 title="text"></h6>
207209
```

packages/eslint-plugin-template/src/rules/elements-content.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const DEFAULT_SAFELIST_ATTRIBUTES: readonly string[] = [
1616
'innerHTML',
1717
'innerText',
1818
'outerHTML',
19+
'textContent',
1920
'title',
2021
];
2122
const DEFAULT_OPTIONS: Options[0] = {

packages/eslint-plugin-template/tests/rules/elements-content/cases.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ export const valid: readonly (string | ValidTestCase<Options>)[] = [
1818
<a [innerHTML]="dangerouslySetHTML"></a>
1919
<a [innerText]="text"></a>
2020
<a [outerHTML]="text"></a>
21+
<a [textContent]="text"></a>
2122
<a aria-hidden></a>
2223
<button [attr.aria-hidden]="true"></button>
24+
<button [textContent]="dynamicText"></button>
2325
<h5 [attr.aria-label]="text"></h5>
2426
<h6 title="text"></h6>
2527
`,

0 commit comments

Comments
 (0)