Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexkalderimis/coffeelint-ensure-super
Ensure that super is called in methods that need it.
https://github.com/alexkalderimis/coffeelint-ensure-super
Last synced: 11 days ago
JSON representation
Ensure that super is called in methods that need it.
- Host: GitHub
- URL: https://github.com/alexkalderimis/coffeelint-ensure-super
- Owner: alexkalderimis
- Created: 2014-12-28T18:06:02.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-23T16:46:57.000Z (over 7 years ago)
- Last Synced: 2024-04-09T22:22:31.290Z (10 months ago)
- Language: CoffeeScript
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ensure Super
======================A [CoffeeLint][coffeelint] rule that ensures that super is called.
Description
---------------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][bb]
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).
Installation
-----------------```sh
npm install coffeelint-ensure-super
```Usage
-----Add the following configuration to `coffeelint.json`:
```json
"ensure_super": {
"module": "coffeelint-ensure-super",
"check": {
"SuperClassName": ["method1", "method2"],
"AnotherSuperClass": ["methodX", "methodY"]
}
}
```Configuration
----------------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:```json
"ensure_super": {
"module": "coffeelint-ensure-super",
"check": {
"View": ["remove"]
}
}
```[coffeelint]: http://www.coffeelint.org/
[bb]: http://backbonejs.org/