Skip to content

Commit

Permalink
feat(eslint-plugin-template): [accessibility-elements-content] camelC…
Browse files Browse the repository at this point in the history
…ase allowList option
  • Loading branch information
sandikbarr committed Nov 16, 2022
1 parent de35b29 commit def4b21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Expand Up @@ -30,7 +30,7 @@ interface Options {
/**
* Default: `["aria-label","innerHtml","innerHTML","innerText","outerHTML","title"]`
*/
allowlist?: string[];
allowList?: string[];
}

```
Expand Down Expand Up @@ -137,7 +137,7 @@ interface Options {
"@angular-eslint/template/accessibility-elements-content": [
"error",
{
"allowlist": [
"allowList": [
"aria-labelledby"
]
}
Expand Down Expand Up @@ -214,7 +214,7 @@ interface Options {
"@angular-eslint/template/accessibility-elements-content": [
"error",
{
"allowlist": [
"allowList": [
"appTooltipLabel",
"ariaLabel"
]
Expand Down
Expand Up @@ -7,7 +7,7 @@ import { isHiddenFromScreenReader } from '../utils/is-hidden-from-screen-reader'

type Options = [
{
readonly allowlist?: readonly string[];
readonly allowList?: readonly string[];
},
];
export type MessageIds = 'accessibilityElementsContent';
Expand All @@ -21,7 +21,7 @@ const DEFAULT_SAFELIST_ATTRIBUTES: readonly string[] = [
'title',
];
const DEFAULT_OPTIONS: Options[0] = {
allowlist: DEFAULT_SAFELIST_ATTRIBUTES,
allowList: DEFAULT_SAFELIST_ATTRIBUTES,
};

export default createESLintRule<Options, MessageIds>({
Expand All @@ -37,7 +37,7 @@ export default createESLintRule<Options, MessageIds>({
{
additionalProperties: false,
properties: {
allowlist: {
allowList: {
items: { type: 'string' },
type: 'array',
uniqueItems: true,
Expand All @@ -51,7 +51,7 @@ export default createESLintRule<Options, MessageIds>({
},
},
defaultOptions: [DEFAULT_OPTIONS],
create(context, [{ allowlist }]) {
create(context, [{ allowList }]) {
const parserServices = getTemplateParserServices(context);

return {
Expand All @@ -63,7 +63,7 @@ export default createESLintRule<Options, MessageIds>({
const { attributes, inputs, name: element, sourceSpan } = node;
const safelistAttributes: ReadonlySet<string> = new Set([
...DEFAULT_SAFELIST_ATTRIBUTES,
...(allowlist ?? []),
...(allowList ?? []),
]);
const hasAttributeSafelisted = [...attributes, ...inputs]
.map(({ name }) => name)
Expand Down
Expand Up @@ -28,7 +28,7 @@ export const valid = [
`,
options: [
{
allowlist: ['appTooltipLabel', 'ariaLabel'],
allowList: ['appTooltipLabel', 'ariaLabel'],
},
],
},
Expand Down Expand Up @@ -65,12 +65,12 @@ export const invalid = [
convertAnnotatedSourceToFailureCase({
messageId,
description:
'should fail if attribute/input/directive is not configured in allowlist',
'should fail if attribute/input/directive is not configured in allowList',
annotatedSource: `
<button [ariaLabelledBy]="label"></button>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`,
options: [{ allowlist: ['aria-labelledby'] }],
options: [{ allowList: ['aria-labelledby'] }],
data: { element: 'button' },
}),
];

0 comments on commit def4b21

Please sign in to comment.