diff options
author | Brandon Millman <brandon@0xproject.com> | 2018-02-01 06:55:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-01 06:55:50 +0800 |
commit | 6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2 (patch) | |
tree | 5a7b3b1601cf34c14be2ba462f5fd2db711e1f2b /packages/tslint-config/rules | |
parent | 75539bf67537f202bc1075b096fd70f64705867e (diff) | |
parent | 78fbf0f7bade62a3d1c36bddf20cbe89c86aac18 (diff) | |
download | dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.gz dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.bz2 dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.lz dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.xz dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.zst dexon-sol-tools-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.zip |
Merge pull request #354 from 0xProject/feature/tslint-config/underscore-protected-members
Modify lint rules to enforce underscore for protected members
Diffstat (limited to 'packages/tslint-config/rules')
-rw-r--r-- | packages/tslint-config/rules/underscorePrivateAndProtectedRule.ts (renamed from packages/tslint-config/rules/underscorePrivatesRule.ts) | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/tslint-config/rules/underscorePrivatesRule.ts b/packages/tslint-config/rules/underscorePrivateAndProtectedRule.ts index 472ea09ff..2f05b0c18 100644 --- a/packages/tslint-config/rules/underscorePrivatesRule.ts +++ b/packages/tslint-config/rules/underscorePrivateAndProtectedRule.ts @@ -12,7 +12,7 @@ type RelevantClassMember = // Copied from: https://github.com/DanielRosenwasser/underscore-privates-tslint-rule // The version on github is not published on npm export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING = 'private members must be prefixed with an underscore'; + public static FAILURE_STRING = 'private and protected members must be prefixed with an underscore'; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { return this.applyWithFunction(sourceFile, walk); @@ -54,7 +54,7 @@ function nameStartsWithUnderscore(text: string) { return text.charCodeAt(0) === UNDERSCORE.charCodeAt(0); } function memberIsPrivate(node: ts.Declaration) { - return Lint.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword); + return Lint.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ProtectedKeyword); } function nameIsIdentifier(node: ts.Node): node is ts.Identifier { return node.kind === ts.SyntaxKind.Identifier; |