all files / eslint-plugin-angular/rules/ no-digest.js

100% Statements 5/5
100% Branches 4/4
100% Functions 2/2
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                            12×     10×                
/**
 * use `$apply()` instead of `$digest()`
 *
 * The scope's $digest() method shouldn't be used.
 * You should prefer the $apply method.
 *
 * The `watchers-execution` rule can be configured to enforce the use of `$apply()` or `$digest()`.
 *
 * @linkDescription use `$apply()` instead of `$digest()` (replaced by [watchers-execution](docs/watchers-execution.md))
 * @version 0.1.0
 * @deprecated There is no reason to forbid the use of `$digest()` in general.
 */
'use strict';
 
module.exports = function(context) {
    return {
 
        MemberExpression: function(node) {
            if (node.property.type === 'Identifier' && node.property.name === '$digest') {
                context.report(node, 'Instead of using the $digest() method, you should prefer $apply()', {});
            }
        }
    };
};
 
module.exports.schema = [
    // JSON Schema for rule options goes here
];