diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/tslint/lib/rules/arrowParensRule.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/tslint/lib/rules/arrowParensRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/arrowParensRule.js | 8 |
1 files changed, 5 insertions, 3 deletions
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; |