From 4a1964f836ab88d3812cf4449a5f1feabb112039 Mon Sep 17 00:00:00 2001 From: Krzysztof Brilla Date: Sat, 7 Nov 2020 18:46:08 +0100 Subject: [PATCH] Adding the rule, mapping it and writing the tests --- .../lintConfigs/rules/ruleConverters.ts | 2 ++ .../eslint-plugin-rxjs/no-redundant-notify.ts | 12 ++++++++++++ .../tests/no-redundant-notify.test.ts | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/no-redundant-notify.ts create mode 100644 src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/tests/no-redundant-notify.test.ts diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 40c1f9c32..2a564cb70 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -183,6 +183,7 @@ import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/js //eslint-plugin-rxjs converters import { convertNoAsyncSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-async-subscribe"; +import { convertNoRedundantNotify } from "./ruleConverters/eslint-plugin-rxjs/no-redundant-notify"; /** * Keys TSLint rule names to their ESLint rule converters. @@ -368,6 +369,7 @@ export const ruleConverters = new Map([ ["use-pipe-transform-interface", convertUsePipeTransformInterface], ["variable-name", convertVariableName], ["rxjs-no-async-subscribe", convertNoAsyncSubscribe], + ["rxjs-no-redundant-notify", convertNoRedundantNotify], // These converters are all for rules that need more complex option conversions. // Some of them will likely need to have notices about changed lint behaviors... diff --git a/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/no-redundant-notify.ts b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/no-redundant-notify.ts new file mode 100644 index 000000000..1be51833f --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/no-redundant-notify.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../../ruleConverter"; + +export const convertNoRedundantNotify: RuleConverter = () => { + return { + rules: [ + { + ruleName: "rxjs/no-redundant-notify", + }, + ], + plugins: ["eslint-plugin-rxjs"], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/tests/no-redundant-notify.test.ts b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/tests/no-redundant-notify.test.ts new file mode 100644 index 000000000..25d364def --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-rxjs/tests/no-redundant-notify.test.ts @@ -0,0 +1,18 @@ +import { convertNoRedundantNotify } from "../no-redundant-notify"; + +describe(convertNoRedundantNotify, () => { + test("conversion without arguments", () => { + const result = convertNoRedundantNotify({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "rxjs/no-redundant-notify", + }, + ], + plugins: ["eslint-plugin-rxjs"], + }); + }); +});