From 7443c60dae7d1f6f94550ae004d660ceae8bce3f Mon Sep 17 00:00:00 2001 From: Jeremy Hough Date: Sat, 27 Feb 2021 14:32:57 -0500 Subject: [PATCH] Add codelyzer template-accessibility-label-for converter --- .../lintConfigs/rules/ruleConverters.ts | 2 ++ .../template-accessibility-label-for.ts | 12 ++++++++++++ .../template-accessibility-label-for.test.ts | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-accessibility-label-for.ts create mode 100644 src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-accessibility-label-for.test.ts diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 748fb774f..633426ba1 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -162,6 +162,7 @@ import { convertPipePrefix } from "./ruleConverters/codelyzer/pipe-prefix"; import { convertPreferOnPushComponentChangeDetection } from "./ruleConverters/codelyzer/prefer-on-push-component-change-detection"; import { convertPreferOutputReadonly } from "./ruleConverters/codelyzer/prefer-output-readonly"; import { convertRelativeUrlPrefix } from "./ruleConverters/codelyzer/relative-url-prefix"; +import { convertTemplateAccessibilityLabelFor } from "./ruleConverters/codelyzer/template-accessibility-label-for"; import { convertTemplateAccessibilityTabindexNoPositive } from "./ruleConverters/codelyzer/template-accessibility-tabindex-no-positive"; import { convertTemplateBananaInBox } from "./ruleConverters/codelyzer/template-banana-in-box"; import { convertTemplateCyclomaticComplexity } from "./ruleConverters/codelyzer/template-cyclomatic-complexity"; @@ -371,6 +372,7 @@ export const ruleConverters = new Map([ ["space-within-parens", convertSpaceWithinParens], ["strict-boolean-expressions", convertStrictBooleanExpressions], ["switch-default", convertSwitchDefault], + ["template-accessibility-label-for", convertTemplateAccessibilityLabelFor], ["template-accessibility-tabindex-no-positive", convertTemplateAccessibilityTabindexNoPositive], ["template-banana-in-box", convertTemplateBananaInBox], ["template-cyclomatic-complexity", convertTemplateCyclomaticComplexity], diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-accessibility-label-for.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-accessibility-label-for.ts new file mode 100644 index 000000000..405ecf007 --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-accessibility-label-for.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../../ruleConverter"; + +export const convertTemplateAccessibilityLabelFor: RuleConverter = () => { + return { + rules: [ + { + ruleName: "@angular-eslint/template/accessibility-label-for", + }, + ], + plugins: ["@angular-eslint/eslint-plugin-template"], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-accessibility-label-for.test.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-accessibility-label-for.test.ts new file mode 100644 index 000000000..309d32afe --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-accessibility-label-for.test.ts @@ -0,0 +1,18 @@ +import { convertTemplateAccessibilityLabelFor } from "../template-accessibility-label-for"; + +describe(convertTemplateAccessibilityLabelFor, () => { + test("conversion without arguments", () => { + const result = convertTemplateAccessibilityLabelFor({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "@angular-eslint/template/accessibility-label-for", + }, + ], + plugins: ["@angular-eslint/eslint-plugin-template"], + }); + }); +});