on-destroy - Check for common misspelling $on('destroy', ...).
February 26, 2018 · View on GitHub
It should be destroy', ...).
Rule based on Angular 1.x
Examples
The following patterns are considered problems;
/*eslint angular/on-destroy: 2*/
// invalid
$rootScope.$on('destroy', function () {
// ...
}); // error: You probably misspelled $on("$destroy").
The following patterns are not considered problems;
/*eslint angular/on-destroy: 2*/
// valid
$scope.$on('$destroy', function () {
// ...
});
// valid
var unregister = $rootScope.$on('$destroy', function () {
// ...
});
Version
This rule was introduced in eslint-plugin-angular 0.1.0