Skip to content

Commit

Permalink
Merge pull request #28 from ilyavolodin/render-return
Browse files Browse the repository at this point in the history
Fixing empty return bug (Fixes #27)
  • Loading branch information
ilyavolodin committed Oct 17, 2014
2 parents 3161e1c + d7bddb9 commit d618990
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules/render-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function(context) {
},
"ReturnStatement": function(node) {
if (inBackboneRender) {
returnFound = node.argument.type === "ThisExpression";
returnFound = node.argument && node.argument.type === "ThisExpression";
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-backbone",
"version": "0.0.6",
"version": "0.1.0",
"description": "Eslint rules for Backbone.",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/render-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ eslintTester.addRuleTest("lib/rules/render-return", {
{
code: "Backbone.View.extend({ render: function() { return 1; } });",
errors: [ { message: "render method should always return 'this'" } ]
},
{
code: "Backbone.View.extend({ render: function() { return; } });",
errors: [ { message: "render method should always return 'this'" } ]
}
]
});

0 comments on commit d618990

Please sign in to comment.