aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/spaceWithinParensRule.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/tslint/lib/rules/spaceWithinParensRule.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/tslint/lib/rules/spaceWithinParensRule.js')
-rw-r--r--node_modules/tslint/lib/rules/spaceWithinParensRule.js14
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;