Skip to content

Commit da9ff73

Browse files
committed
add notice only if parameter supplied
1 parent c32d347 commit da9ff73

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/rules/converters.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,10 @@ export const converters = new Map([
272272
["quotemark", convertQuotemark],
273273
["triple-equals", convertTripleEquals],
274274

275-
// these converters are all for rules that need more complex option conversions.
276-
// some of them will likely need to have notices about changed lint behaviors...
277-
// if you're willing to take on that work, that'd be great! Please send PRs! 💖
278-
// as these are enabled, they should be added in sorted order to the list above.
275+
// These converters are all for rules that need more complex option conversions.
276+
// Some of them will likely need to have notices about changed lint behaviors...
277+
// If you're willing to take on that work, that'd be great! Please send PRs! 💖
278+
// As these are enabled, they should be added in sorted order to the list above.
279279

280280
// TSLint core rules:
281281
// ["ban", convertBan], // no-restricted-properties

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import { RuleConverter } from "../converter";
22

33
export const convertSpaceWithinParens: RuleConverter = tslintRule => {
4-
const arg = tslintRule.ruleArguments.length === 1 ? "always" : "never";
4+
let arg = "never";
5+
const notices = [];
6+
7+
if (tslintRule.ruleArguments.length === 1) {
8+
arg = "always";
9+
notices.push("The number of spaces will be ignored");
10+
}
11+
512
return {
613
rules: [
714
{
815
ruleArguments: [arg],
916
ruleName: "@typescript-eslint/space-within-parens",
10-
notices: ["The number of spaces will be ignored"],
17+
notices,
1118
},
1219
],
1320
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe(convertSpaceWithinParens, () => {
1111
{
1212
ruleArguments: ["never"],
1313
ruleName: "@typescript-eslint/space-within-parens",
14-
notices: ["The number of spaces will be ignored"],
14+
notices: [],
1515
},
1616
],
1717
});

0 commit comments

Comments
 (0)