From d2444d223cd230e2ccc7a7f93de9d5957b650016 Mon Sep 17 00:00:00 2001 From: Jeremy Hough Date: Sat, 27 Feb 2021 15:07:13 -0500 Subject: [PATCH] Add codelyzer template-no-any converter --- .../lintConfigs/rules/ruleConverters.ts | 2 ++ .../codelyzer/template-no-any.ts | 12 ++++++++++++ .../codelyzer/tests/template-no-any.test.ts | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-no-any.ts create mode 100644 src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-no-any.test.ts diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 748fb774f..072f4b53d 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 { convertTemplateNoAny } from "./ruleConverters/codelyzer/template-no-any"; 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-no-any", convertTemplateNoAny], ["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-no-any.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-no-any.ts new file mode 100644 index 000000000..99b7c8c76 --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-no-any.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../../ruleConverter"; + +export const convertTemplateNoAny: RuleConverter = () => { + return { + rules: [ + { + ruleName: "@angular-eslint/template/no-any", + }, + ], + plugins: ["@angular-eslint/eslint-plugin-template"], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-no-any.test.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-no-any.test.ts new file mode 100644 index 000000000..c3c962b2e --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-no-any.test.ts @@ -0,0 +1,18 @@ +import { convertTemplateNoAny } from "../template-no-any"; + +describe(convertTemplateNoAny, () => { + test("conversion without arguments", () => { + const result = convertTemplateNoAny({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "@angular-eslint/template/no-any", + }, + ], + plugins: ["@angular-eslint/eslint-plugin-template"], + }); + }); +});