aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/memberAccessRule.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/memberAccessRule.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/tslint/lib/rules/memberAccessRule.js')
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.js b/node_modules/tslint/lib/rules/memberAccessRule.js
index abb843b04..80b90dcad 100644
--- a/node_modules/tslint/lib/rules/memberAccessRule.js
+++ b/node_modules/tslint/lib/rules/memberAccessRule.js
@@ -58,8 +58,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "member-access",
description: "Requires explicit visibility declarations for class members.",
- rationale: "Explicit visibility declarations can make code more readable and accessible for those new to TS.",
- optionsDescription: (_a = ["\n These arguments may be optionally provided:\n\n * `\"no-public\"` forbids public accessibility to be specified, because this is the default.\n * `\"check-accessor\"` enforces explicit visibility on get/set accessors\n * `\"check-constructor\"` enforces explicit visibility on constructors\n * `\"check-parameter-property\"` enforces explicit visibility on parameter properties"], _a.raw = ["\n These arguments may be optionally provided:\n\n * \\`\"no-public\"\\` forbids public accessibility to be specified, because this is the default.\n * \\`\"check-accessor\"\\` enforces explicit visibility on get/set accessors\n * \\`\"check-constructor\"\\` enforces explicit visibility on constructors\n * \\`\"check-parameter-property\"\\` enforces explicit visibility on parameter properties"], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Explicit visibility declarations can make code more readable and accessible for those new to TS.\n\n Other languages such as C# default to `private`, unlike TypeScript's default of `public`.\n Members lacking a visibility declaration may be an indication of an accidental leak of class internals.\n "], ["\n Explicit visibility declarations can make code more readable and accessible for those new to TS.\n\n Other languages such as C# default to \\`private\\`, unlike TypeScript's default of \\`public\\`.\n Members lacking a visibility declaration may be an indication of an accidental leak of class internals.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n These arguments may be optionally provided:\n\n * `\"no-public\"` forbids public accessibility to be specified, because this is the default.\n * `\"check-accessor\"` enforces explicit visibility on get/set accessors\n * `\"check-constructor\"` enforces explicit visibility on constructors\n * `\"check-parameter-property\"` enforces explicit visibility on parameter properties"], ["\n These arguments may be optionally provided:\n\n * \\`\"no-public\"\\` forbids public accessibility to be specified, because this is the default.\n * \\`\"check-accessor\"\\` enforces explicit visibility on get/set accessors\n * \\`\"check-constructor\"\\` enforces explicit visibility on constructors\n * \\`\"check-parameter-property\"\\` enforces explicit visibility on parameter properties"]))),
options: {
type: "array",
items: {
@@ -115,15 +115,13 @@ function walk(ctx) {
}
}
function check(node) {
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
return;
}
var publicKeyword = tsutils_1.getModifier(node, ts.SyntaxKind.PublicKeyword);
if (noPublic && publicKeyword !== undefined) {
- var readonlyKeyword = tsutils_1.getModifier(node, ts.SyntaxKind.ReadonlyKeyword);
// public is not optional for parameter property without the readonly modifier
- var isPublicOptional = node.kind !== ts.SyntaxKind.Parameter || readonlyKeyword !== undefined;
- if (isPublicOptional) {
+ if (node.kind !== ts.SyntaxKind.Parameter || tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ReadonlyKeyword)) {
var start = publicKeyword.end - "public".length;
ctx.addFailure(start, publicKeyword.end, Rule.FAILURE_STRING_NO_PUBLIC, Lint.Replacement.deleteFromTo(start, tsutils_1.getNextToken(publicKeyword, ctx.sourceFile).getStart(ctx.sourceFile)));
}
@@ -159,4 +157,4 @@ function typeToString(node) {
throw new Error("unhandled node type " + ts.SyntaxKind[node.kind]);
}
}
-var _a;
+var templateObject_1, templateObject_2;