From cd50ab2fc98caa639a66bf4509ae77040b7da9e7 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 10 May 2020 11:30:21 -0400 Subject: [PATCH] Added Codelyzer template-no-any converter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Another non-configurable rule. ⚡ http://codelyzer.com/rules/template-no-any / https://github.com/angular-eslint/angular-eslint/blob/master/packages/eslint-plugin/src/rules/template-no-any.ts --- .../converters/codelyzer/template-no-any.ts | 12 ++++++++++++ .../codelyzer/tests/template-no-any.test.ts | 18 ++++++++++++++++++ src/rules/rulesConverters.ts | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 src/rules/converters/codelyzer/template-no-any.ts create mode 100644 src/rules/converters/codelyzer/tests/template-no-any.test.ts diff --git a/src/rules/converters/codelyzer/template-no-any.ts b/src/rules/converters/codelyzer/template-no-any.ts new file mode 100644 index 00000000..caec92bd --- /dev/null +++ b/src/rules/converters/codelyzer/template-no-any.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../../converter"; + +export const convertTemplateNoAny: RuleConverter = () => { + return { + rules: [ + { + ruleName: "@angular-eslint/template-no-any", + }, + ], + plugins: ["@angular-eslint/eslint-plugin"], + }; +}; diff --git a/src/rules/converters/codelyzer/tests/template-no-any.test.ts b/src/rules/converters/codelyzer/tests/template-no-any.test.ts new file mode 100644 index 00000000..d9e75e21 --- /dev/null +++ b/src/rules/converters/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"], + }); + }); +}); diff --git a/src/rules/rulesConverters.ts b/src/rules/rulesConverters.ts index e0402f51..3e4db91d 100644 --- a/src/rules/rulesConverters.ts +++ b/src/rules/rulesConverters.ts @@ -156,6 +156,7 @@ import { convertNoOutputNative } from "./converters/codelyzer/no-output-native"; import { convertNoOutputOnPrefix } from "./converters/codelyzer/no-output-on-prefix"; import { convertNoOutputsMetadataProperty } from "./converters/codelyzer/no-outputs-metadata-property"; import { convertPreferOutputReadonly } from "./converters/codelyzer/prefer-output-readonly"; +import { convertTemplateNoAny } from "./converters/codelyzer/template-no-any"; import { convertUseInjectableProvidedIn } from "./converters/codelyzer/use-injectable-provided-in"; import { convertUseLifecycleInterface } from "./converters/codelyzer/use-lifecycle-interface"; import { convertUsePipeDecorator } from "./converters/codelyzer/use-pipe-decorator"; @@ -310,6 +311,7 @@ export const rulesConverters = new Map([ ["space-within-parens", convertSpaceWithinParens], ["strict-boolean-expressions", convertStrictBooleanExpressions], ["switch-default", convertSwitchDefault], + ["template-no-any", convertTemplateNoAny], ["trailing-comma", convertTrailingComma], ["triple-equals", convertTripleEquals], ["type-literal-delimiter", convertTypeLiteralDelimiter],