Name: coffeelint-ensure-super
Owner: PeerLibrary
Description: Ensure that super is called in methods that need it.
Created: 2015-05-26 03:32:15.0
Updated: 2015-05-26 03:32:18.0
Pushed: 2014-12-28 18:49:57.0
Homepage: null
Size: 128
Language: CoffeeScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A CoffeeLint rule that ensures that super is called.
This rule ensures that classes that inherit from a set of defined base classes
and override a set of defined methods call super
in their implementations of
those methods. A good example of this is making sure that all Backbone
views that override View::remove
call super
, since otherwise they will leak
resources, and may not actually be removed from the DOM.
By default no rules are defined - these must be configured (see below).
install coffeelint-ensure-super
Add the following configuration to coffeelint.json
:
ure_super": {
"module": "coffeelint-ensure-super",
"check": {
"SuperClassName": ["method1", "method2"],
"AnotherSuperClass": ["methodX", "methodY"]
}
The check property defines which methods must call super
. It is a
mapping from the parent class name to the list of the methods that must
call super
when overriden. For example, a suitable configuration for
ensuring all Backbone views call super
on removal would be:
ure_super": {
"module": "coffeelint-ensure-super",
"check": {
"View": ["remove"]
}