Skip to content

Commit 3aede48

Browse files
Fix space-within-parens with option 0 (#332)
* Add test for space-within-parens with option 0 * Fix space-within-parens with 0 spaces
1 parent 3cd31c3 commit 3aede48

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/rules/converters/space-within-parens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const convertSpaceWithinParens: RuleConverter = tslintRule => {
44
let notices: string[] | undefined;
55
let arg: string;
66

7-
if (tslintRule.ruleArguments.length === 1) {
7+
if (tslintRule.ruleArguments.length === 1 && tslintRule.ruleArguments[0] !== 0) {
88
arg = "always";
99
notices = ["The number of spaces will be ignored"];
1010
} else {

src/rules/converters/tests/space-within-parens.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ describe(convertSpaceWithinParens, () => {
1616
});
1717
});
1818

19+
test("conversion with 0 spaces required", () => {
20+
const result = convertSpaceWithinParens({
21+
ruleArguments: [0],
22+
});
23+
24+
expect(result).toEqual({
25+
rules: [
26+
{
27+
ruleArguments: ["never"],
28+
ruleName: "space-in-parens",
29+
},
30+
],
31+
});
32+
});
33+
1934
test("conversion with min spaces arguement", () => {
2035
const result = convertSpaceWithinParens({
2136
ruleArguments: [5],

0 commit comments

Comments
 (0)