ilyavolodin / eslint-plugin-backbone

Backbone specific linting rules for ESLint
MIT License
95 stars 11 forks source link

Support for comments #39

Open ilyavolodin opened 9 years ago

ilyavolodin commented 9 years ago

Currently this plugin will only support the following construct:

var view = Backbone.View.extend({ ... });

However, a lot of people create an object first, and then use extend on it.

var view = { ... };
return Backbone.View.extend(view);

In the case above, this plugin will not identify the view object as a Backbone View. It should be possible to add comments around an object, to specify that it's going to be Backbone View/Model/Collection like this:

/* Backbone.View */
var view = { ... };
/* Backbone.View end */
return Backbone.View.extend(view);
platinumazure commented 8 years ago

Not that I would recommend trying to cover all cases, but for the simple cases, couldn't you use escope to read write references to the variable passed in to Backbone.View.extend (and similar)?