tslint-eslint-rules
Advanced tools
Comparing version 1.3.0 to 1.4.0
## Change Log | ||
### v1.2.0 (2016/04/04 17:27 +00:00) | ||
### v1.4.0 (2016/09/05 13:47 +00:00) | ||
- [8477b21](https://github.com/buzinas/tslint-eslint-rules/commit/8477b2135c46b38dcfd3ab613d43d6c8194dcda6) [feat] updated dependencies and improved formatting (@buzinas) | ||
- [eee3dc3](https://github.com/buzinas/tslint-eslint-rules/commit/eee3dc3769cd019988c0772d089e541c49c8c31b) Update noInvalidRegexpRuleTests.ts (@buzinas) | ||
- [#104](https://github.com/buzinas/tslint-eslint-rules/pull/104) Merge pull request #104 from hadalin/brace-style (@hadalin) | ||
- [#98](https://github.com/buzinas/tslint-eslint-rules/pull/98) Merge pull request #98 from jigawot/no-inner-decl-ns (@jigawot) | ||
- [#91](https://github.com/buzinas/tslint-eslint-rules/pull/91) Merge pull request #91 from blakeembrey/patch-1 (@blakeembrey) | ||
- [#88](https://github.com/buzinas/tslint-eslint-rules/pull/88) Merge pull request #88 from rictic/patch-1 (@rictic) | ||
- [#84](https://github.com/buzinas/tslint-eslint-rules/pull/84) Merge pull request #84 from Fank/master (@Fank) | ||
- [b9dbf53](https://github.com/buzinas/tslint-eslint-rules/commit/b9dbf530da4cd3e7d6af94b73b79e9c142f2bcdd) Update .travis.yml (@buzinas) | ||
- [#101](https://github.com/buzinas/tslint-eslint-rules/pull/101) Merge pull request #101 from jmlopez-rod/valid-jsdoc-bug (@jmlopez-rod) | ||
- [874440f](https://github.com/buzinas/tslint-eslint-rules/commit/874440f99f2a37a3acf42939bdcd0212ec0dd148) [bug] fixed brace-style rule (closes #93) (@hadalin) | ||
- [951a64c](https://github.com/buzinas/tslint-eslint-rules/commit/951a64cbb0c11070ab0fa26c2672cc0bed08e0e3) [bug] fixed valid-jsdoc rule (closes #100) (@jmlopez-rod) | ||
- [a8830c4](https://github.com/buzinas/tslint-eslint-rules/commit/a8830c494be3a230ece30f5c9e21514b29bba44f) [fix] Add constructors as valid location for function declaration | ||
- [2c092be](https://github.com/buzinas/tslint-eslint-rules/commit/2c092be7495401d68acf19c9b4c877f75ec734f8) [fix] add namespaces as valid location for function declaration | ||
- [23af906](https://github.com/buzinas/tslint-eslint-rules/commit/23af9061b4551232a7483d50b2d7d420db74e736) Use `highlights` truthy test over `==` (@blakeembrey) | ||
- [b60b848](https://github.com/buzinas/tslint-eslint-rules/commit/b60b8486396194f966236b2cd681e37613dbaeef) Fix `validateReferenceForVariable` call (@blakeembrey) | ||
- [428480f](https://github.com/buzinas/tslint-eslint-rules/commit/428480fd213f262267de3eee69a90e257d02b187) Minor: Add missing quote mark to README.md (@rictic) | ||
- [2be950f](https://github.com/buzinas/tslint-eslint-rules/commit/2be950f19d081e254374a9a1c6089d4f749a62aa) Syntax fixes (@Fank) | ||
- [8ba8d47](https://github.com/buzinas/tslint-eslint-rules/commit/8ba8d47179f3cd1fd681395e83361865d14f39ce) [docs] updated changelog to v1.3.0 (@buzinas) | ||
### v1.3.0 (2016/04/28 22:05 +00:00) | ||
- [d40b919](https://github.com/buzinas/tslint-eslint-rules/commit/d40b9190434491acd919f27e70f518eb1464d93b) [feat] added handleCallbackErr rule (refs #81) (@buzinas) | ||
- [9f57505](https://github.com/buzinas/tslint-eslint-rules/commit/9f5750567da35d43388280bfe4f1c3ef5270f0af) [fix] changed travis.yml while NodeJS 6.0.0 isn't stable yet (@buzinas) | ||
- [#82](https://github.com/buzinas/tslint-eslint-rules/pull/82) Merge pull request #82 from krzkaczor/handle-callback-err (@krzkaczor) | ||
- [8f6f4c3](https://github.com/buzinas/tslint-eslint-rules/commit/8f6f4c3bf147647ed66de5bf5baf37e96e7886f7) [feat] added handle-callback-err rule (closes #81) (@krzkaczor) | ||
- [#77](https://github.com/buzinas/tslint-eslint-rules/pull/77) Merge pull request #77 from nfriend/update-brace-style-docs (@nfriend) | ||
- [7d53918](https://github.com/buzinas/tslint-eslint-rules/commit/7d53918ca3e4b270d98bc2b35b79d5d522fcc98d) [docs] updated README and eslint_tslint.json for brace-style rule | ||
- [#76](https://github.com/buzinas/tslint-eslint-rules/pull/76) Merge pull request #76 from nfriend/add-brace-style (@nfriend) | ||
- [34b97dc](https://github.com/buzinas/tslint-eslint-rules/commit/34b97dc92f6fa9ff0d5115b8493322e0c90811ab) [feat] added brace-style rule (closes #73) | ||
- [49f410c](https://github.com/buzinas/tslint-eslint-rules/commit/49f410caefe92a34c81aba425712758a4ac723af) [bug] fixed no-inner-declarations rule (refs #75) (@buzinas) | ||
- [#72](https://github.com/buzinas/tslint-eslint-rules/pull/72) Merge pull request #72 from nfriend/add-block-spacing (@nfriend) | ||
- [d0de347](https://github.com/buzinas/tslint-eslint-rules/commit/d0de34796ac0953113f52eee32c74101efb2fb12) [feat] added block-spacing rule (closes #71) | ||
- [#70](https://github.com/buzinas/tslint-eslint-rules/pull/70) Merge pull request #70 from nfriend/update-docs-and-example (@nfriend) | ||
- [46998a3](https://github.com/buzinas/tslint-eslint-rules/commit/46998a3bbed4597279c8ef18737ec7fe74fc770a) updated README and eslint_tslint.json | ||
### v1.2.0 (2016/04/04 17:28 +00:00) | ||
- [8bfd9cb](https://github.com/buzinas/tslint-eslint-rules/commit/8bfd9cb217596a12bd015840c427e59deae94975) [feat] added v1.2.0 (@buzinas) | ||
- [#69](https://github.com/buzinas/tslint-eslint-rules/pull/69) Merge pull request #69 from nfriend/add-array-bracket-spacing (@nfriend) | ||
@@ -114,2 +150,2 @@ - [fe725c5](https://github.com/buzinas/tslint-eslint-rules/commit/fe725c5621474c434c4fcd424e97b22bacd8df2f) added rule exceptions to array-bracket-spacing | ||
- [17580af](https://github.com/buzinas/tslint-eslint-rules/commit/17580af112cd34647b27eab6a45f00b8585da8f9) Changed 'Contributing' description (@buzinas) | ||
- [2601ba4](https://github.com/buzinas/tslint-eslint-rules/commit/2601ba448c8e8d639539dc461d8b2dc43bb908fa) Initial version (@buzinas) | ||
- [2601ba4](https://github.com/buzinas/tslint-eslint-rules/commit/2601ba448c8e8d639539dc461d8b2dc43bb908fa) Initial version (@buzinas) |
@@ -43,3 +43,3 @@ "use strict"; | ||
var closeBraceLocation = this.getStartPosition(blockChildren[blockChildren.length - 1]); | ||
if (syntaxList.getChildCount() > 0 && openBraceLocation.line === closeBraceLocation.line) { | ||
if (syntaxList && syntaxList.getChildCount() > 0 && openBraceLocation.line === closeBraceLocation.line) { | ||
if (this.isSpaceBetween(blockChildren[0], blockChildren[1]) !== this.always | ||
@@ -46,0 +46,0 @@ || this.isSpaceBetween(blockChildren[blockChildren.length - 2], blockChildren[blockChildren.length - 1]) !== this.always) { |
@@ -57,12 +57,22 @@ "use strict"; | ||
BraceStyleWalker.prototype.visitTryStatement = function (tryStatement) { | ||
var _this = this; | ||
_super.prototype.visitTryStatement.call(this, tryStatement); | ||
var catchClause = tryStatement.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.CatchClause; }).shift(); | ||
var previousNode = tryStatement.getChildren()[tryStatement.getChildren().indexOf(catchClause) - 1]; | ||
var openingBracketError = this.areOnSameLine(previousNode, catchClause) !== (this.braceStyle === BraceStyle.OneTBS); | ||
if (this.allowSingleLine && this.getStartPosition(catchClause).line === this.getEndPosition(tryStatement).line) { | ||
return; | ||
var checkTryStatementError = function (node) { | ||
var previousNode = _this.getPreviousNode(tryStatement.getChildren(), node); | ||
var openingBracketError = _this.areOnSameLine(previousNode, node) !== (_this.braceStyle === BraceStyle.OneTBS); | ||
if (_this.allowSingleLine && _this.getStartPosition(node).line === _this.getEndPosition(tryStatement).line) { | ||
return; | ||
} | ||
if (openingBracketError) { | ||
var failureString = _this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; | ||
_this.addFailure(_this.createFailure(node.getStart(), node.getWidth(), failureString)); | ||
} | ||
}; | ||
var catchClause = tryStatement.catchClause; | ||
if (catchClause) { | ||
checkTryStatementError(catchClause); | ||
} | ||
if (openingBracketError) { | ||
var failureString = this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; | ||
this.addFailure(this.createFailure(catchClause.getStart(), catchClause.getWidth(), failureString)); | ||
var finallyBlock = tryStatement.finallyBlock; | ||
if (finallyBlock) { | ||
checkTryStatementError(finallyBlock); | ||
} | ||
@@ -128,3 +138,12 @@ }; | ||
}; | ||
BraceStyleWalker.prototype.getPreviousNode = function (children, node) { | ||
var position = children.indexOf(node) - 1; | ||
while (position >= 0) { | ||
if (children[position].kind === ts.SyntaxKind.Block || children[position].kind === ts.SyntaxKind.CatchClause) { | ||
return children[position]; | ||
} | ||
position -= 1; | ||
} | ||
}; | ||
return BraceStyleWalker; | ||
}(Lint.RuleWalker)); |
@@ -46,3 +46,3 @@ "use strict"; | ||
var highlights = this.languageService.getDocumentHighlights(fileName, position, [fileName]); | ||
if (highlights === null || highlights[0].highlightSpans.length <= 1) { | ||
if (!highlights || highlights[0].highlightSpans.length <= 1) { | ||
this.addFailure(this.createFailure(position, name.length, Rule.FAILURE_STRING + "'" + name + "'")); | ||
@@ -49,0 +49,0 @@ } |
@@ -30,3 +30,5 @@ "use strict"; | ||
ts.SyntaxKind.ArrowFunction, | ||
ts.SyntaxKind.MethodDeclaration | ||
ts.SyntaxKind.MethodDeclaration, | ||
ts.SyntaxKind.ModuleDeclaration, | ||
ts.SyntaxKind.Constructor | ||
]; | ||
@@ -33,0 +35,0 @@ } |
@@ -86,3 +86,3 @@ "use strict"; | ||
this.startFunction(node); | ||
_super.prototype.visitNode.call(this, node); | ||
_super.prototype.visitClassExpression.call(this, node); | ||
this.checkJSDoc(node); | ||
@@ -89,0 +89,0 @@ }; |
{ | ||
"name": "tslint-eslint-rules", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Improve your TSLint with the missing ESLint Rules", | ||
@@ -32,10 +32,10 @@ "main": "index.js", | ||
"gulp-tslint": "^3.6.0", | ||
"gulp-typescript": "^2.12.1", | ||
"mocha": "^2.4.5", | ||
"typescript": "^1.8.9" | ||
"gulp-typescript": "^2.13.6", | ||
"mocha": "^2.5.3", | ||
"typescript": "^1.8.10" | ||
}, | ||
"dependencies": { | ||
"doctrine": "^0.7.2", | ||
"tslint": "^3.6.0" | ||
"tslint": "^3.15.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
158583
1484
Updatedtslint@^3.15.1