diff --git a/src/rules/converters/space-within-parens.ts b/src/rules/converters/space-within-parens.ts index f24c89870..01779e0d3 100644 --- a/src/rules/converters/space-within-parens.ts +++ b/src/rules/converters/space-within-parens.ts @@ -4,7 +4,7 @@ export const convertSpaceWithinParens: RuleConverter = tslintRule => { let notices: string[] | undefined; let arg: string; - if (tslintRule.ruleArguments.length === 1) { + if (tslintRule.ruleArguments.length === 1 && tslintRule.ruleArguments[0] !== 0) { arg = "always"; notices = ["The number of spaces will be ignored"]; } else { diff --git a/src/rules/converters/tests/space-within-parens.test.ts b/src/rules/converters/tests/space-within-parens.test.ts index 32aed65ce..83fe604a5 100644 --- a/src/rules/converters/tests/space-within-parens.test.ts +++ b/src/rules/converters/tests/space-within-parens.test.ts @@ -16,6 +16,21 @@ describe(convertSpaceWithinParens, () => { }); }); + test("conversion with 0 spaces required", () => { + const result = convertSpaceWithinParens({ + ruleArguments: [0], + }); + + expect(result).toEqual({ + rules: [ + { + ruleArguments: ["never"], + ruleName: "space-in-parens", + }, + ], + }); + }); + test("conversion with min spaces arguement", () => { const result = convertSpaceWithinParens({ ruleArguments: [5],