diff options
Diffstat (limited to 'node_modules/tslint/lib/rules/spaceWithinParensRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/spaceWithinParensRule.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/node_modules/tslint/lib/rules/spaceWithinParensRule.js b/node_modules/tslint/lib/rules/spaceWithinParensRule.js index 55e7de0a9..c53cc75ce 100644 --- a/node_modules/tslint/lib/rules/spaceWithinParensRule.js +++ b/node_modules/tslint/lib/rules/spaceWithinParensRule.js @@ -37,9 +37,9 @@ var Rule = /** @class */ (function (_super) { /* tslint:disable:object-literal-sort-keys */ Rule.metadata = { ruleName: "space-within-parens", - description: "Enforces spaces within parentheses or disallow them.", + description: "Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.", hasFix: true, - optionsDescription: (_a = ["\n You may enforce the amount of whitespace within parentheses.\n "], _a.raw = ["\n You may enforce the amount of whitespace within parentheses.\n "], Lint.Utils.dedent(_a)), + optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n You may enforce the amount of whitespace within parentheses.\n "], ["\n You may enforce the amount of whitespace within parentheses.\n "]))), options: { type: "number", min: 0 }, type: "style", typescriptOnly: false, @@ -75,10 +75,14 @@ var SpaceWithinParensWalker = /** @class */ (function (_super) { var _this = this; tsutils_1.forEachToken(sourceFile, function (token) { if (token.kind === ts.SyntaxKind.OpenParenToken) { - _this.checkOpenParenToken(token); + if (sourceFile.text.charAt(token.end) !== ")") { + _this.checkOpenParenToken(token); + } } else if (token.kind === ts.SyntaxKind.CloseParenToken) { - _this.checkCloseParenToken(token); + if (sourceFile.text.charAt(token.end - 2) !== "(") { + _this.checkCloseParenToken(token); + } } }); }; @@ -151,4 +155,4 @@ var SpaceWithinParensWalker = /** @class */ (function (_super) { }; return SpaceWithinParensWalker; }(Lint.AbstractWalker)); -var _a; +var templateObject_1; |