From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/tslint/lib/rules/arrowParensRule.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'node_modules/tslint/lib/rules/arrowParensRule.js') diff --git a/node_modules/tslint/lib/rules/arrowParensRule.js b/node_modules/tslint/lib/rules/arrowParensRule.js index 5af83227d..49f869560 100644 --- a/node_modules/tslint/lib/rules/arrowParensRule.js +++ b/node_modules/tslint/lib/rules/arrowParensRule.js @@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) { description: "Requires parentheses around the parameters of arrow function definitions.", hasFix: true, rationale: "Maintains stylistic consistency with other arrow function definitions.", - optionsDescription: (_a = ["\n If `", "` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], _a.raw = ["\n If \\`", "\\` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], Lint.Utils.dedent(_a, BAN_SINGLE_ARG_PARENS)), + optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], ["\n If \\`", "\\` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."])), BAN_SINGLE_ARG_PARENS), options: { type: "string", enum: [BAN_SINGLE_ARG_PARENS], @@ -69,8 +69,10 @@ function walk(ctx) { } else if (ctx.options.banSingleArgParens) { var closeParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.CloseParenToken); + var charBeforeOpenParen = ctx.sourceFile.text.substring(openParen.pos - 1, openParen.pos); + var replaceValue = charBeforeOpenParen.match(/[a-z]/i) !== null ? " " : ""; ctx.addFailureAtNode(node.parameters[0], Rule.FAILURE_STRING_EXISTS, [ - Lint.Replacement.replaceFromTo(openParen.pos, node.parameters[0].getStart(ctx.sourceFile), " "), + Lint.Replacement.replaceFromTo(openParen.pos, node.parameters[0].getStart(ctx.sourceFile), replaceValue), Lint.Replacement.deleteFromTo(node.parameters[0].end, closeParen.end), ]); } @@ -92,4 +94,4 @@ function isSimpleParameter(parameter) { && parameter.questionToken === undefined && parameter.type === undefined; } -var _a; +var templateObject_1; -- cgit v1.2.3