diff --git a/src/rules/converters.ts b/src/rules/converters.ts index 78b2b9e94..5bb763a2b 100644 --- a/src/rules/converters.ts +++ b/src/rules/converters.ts @@ -43,6 +43,7 @@ import { convertNoDebugger } from "./converters/no-debugger"; import { convertNoDuplicateImports } from "./converters/no-duplicate-imports"; import { convertNoDuplicateSuper } from "./converters/no-duplicate-super"; import { convertNoDuplicateSwitchCase } from "./converters/no-duplicate-switch-case"; +import { convertNoDuplicateVariable } from "./converters/no-duplicate-variable"; import { convertNoEmpty } from "./converters/no-empty"; import { convertNoEmptyInterface } from "./converters/no-empty-interface"; import { convertNoEval } from "./converters/no-eval"; @@ -161,6 +162,7 @@ export const converters = new Map([ ["no-duplicate-imports", convertNoDuplicateImports], ["no-duplicate-super", convertNoDuplicateSuper], ["no-duplicate-switch-case", convertNoDuplicateSwitchCase], + ["no-duplicate-variable", convertNoDuplicateVariable], ["no-empty-interface", convertNoEmptyInterface], ["no-empty", convertNoEmpty], ["no-eval", convertNoEval], diff --git a/src/rules/converters/no-duplicate-variable.ts b/src/rules/converters/no-duplicate-variable.ts new file mode 100644 index 000000000..8d0a64c73 --- /dev/null +++ b/src/rules/converters/no-duplicate-variable.ts @@ -0,0 +1,14 @@ +import { RuleConverter } from "../converter"; + +export const convertNoDuplicateVariable: RuleConverter = tslintRule => { + return { + rules: [ + { + ...(tslintRule.ruleArguments.includes("check-parameters") && { + notices: ["ESLint does not support check-parameters."], + }), + ruleName: "no-redeclare", + }, + ], + }; +}; diff --git a/src/rules/converters/tests/no-duplicate-variable.test.ts b/src/rules/converters/tests/no-duplicate-variable.test.ts new file mode 100644 index 000000000..329e225b4 --- /dev/null +++ b/src/rules/converters/tests/no-duplicate-variable.test.ts @@ -0,0 +1,32 @@ +import { convertNoDuplicateVariable } from "../no-duplicate-variable"; + +describe(convertNoDuplicateVariable, () => { + test("conversion without arguments", () => { + const result = convertNoDuplicateVariable({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "no-redeclare", + }, + ], + }); + }); + + test("conversion with check parameters argument", () => { + const result = convertNoDuplicateVariable({ + ruleArguments: ["check-parameters"], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "no-redeclare", + notices: ["ESLint does not support check-parameters."], + }, + ], + }); + }); +});