diff options
Diffstat (limited to 'packages/tslint-config')
-rw-r--r-- | packages/tslint-config/CHANGELOG.md | 4 | ||||
-rw-r--r-- | packages/tslint-config/README.md | 6 | ||||
-rw-r--r-- | packages/tslint-config/package.json | 5 | ||||
-rw-r--r-- | packages/tslint-config/rules/underscorePrivateAndProtectedRule.ts (renamed from packages/tslint-config/rules/underscorePrivatesRule.ts) | 4 | ||||
-rw-r--r-- | packages/tslint-config/tslint.json | 3 |
5 files changed, 16 insertions, 6 deletions
diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md index 1d56bca5b..04d705941 100644 --- a/packages/tslint-config/CHANGELOG.md +++ b/packages/tslint-config/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.5.0 - _TBD, 2018_ + + * Modified custom 'underscore-privates' rule, changing it to 'underscore-private-and-protected' requiring underscores to be prepended to both private and protected variable names (#354) + ## v0.4.0 - _December 28, 2017_ * Added custom 'underscore-privates' rule, requiring underscores to be prepended to private variable names diff --git a/packages/tslint-config/README.md b/packages/tslint-config/README.md index 8a6fa8a2f..b517f2d95 100644 --- a/packages/tslint-config/README.md +++ b/packages/tslint-config/README.md @@ -44,6 +44,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 3b616ba3a..c2a8b0692 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,9 +1,10 @@ { "name": "@0xproject/tslint-config", - "version": "0.4.5", + "version": "0.4.6", "description": "Lint rules related to 0xProject for TSLint", "main": "tslint.json", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf lib", "lint": "tslint --project . 'rules/**/*.ts'" @@ -38,7 +39,7 @@ "shx": "^0.2.2", "tslint": "5.8.0", "tslint-eslint-rules": "^4.1.1", - "typescript": "~2.6.1" + "typescript": "2.7.1" }, "dependencies": { "lodash": "^4.17.4", 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; diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json index 971588b08..3266b022f 100644 --- a/packages/tslint-config/tslint.json +++ b/packages/tslint-config/tslint.json @@ -44,7 +44,6 @@ "no-string-throw": true, "no-submodule-imports": false, "no-unnecessary-type-assertion": true, - "no-unused-variable": [true, { "ignore-pattern": "^_\\d*" }], "no-implicit-dependencies": [true, "dev"], "number-literal-format": true, "object-literal-sort-keys": false, @@ -74,7 +73,7 @@ ], "space-within-parens": false, "type-literal-delimiter": true, - "underscore-privates": true, + "underscore-private-and-protected": true, "variable-name": [true, "ban-keywords", "allow-pascal-case"], "whitespace": [ true, |