create: angularRule()

in rules/component-limit.js [30:58]


    create: angularRule(function(context) {
        var limit = context.options[0] || 1;
        var count = 0;
        var msg = 'There may be at most {{limit}} AngularJS {{component}} per file, but found {{number}}';

        function checkLimit(callee) {
            count++;
            if (count > limit) {
                context.report(callee, msg, {
                    limit: limit,
                    component: limit === 1 ? 'component' : 'components',
                    number: count
                });
            }
        }

        return {
            'angular?animation': checkLimit,
            'angular?config': checkLimit,
            'angular?controller': checkLimit,
            'angular?directive': checkLimit,
            'angular?factory': checkLimit,
            'angular?filter': checkLimit,
            'angular?provider': checkLimit,
            'angular?run': checkLimit,
            'angular?service': checkLimit,
            'angular?component': checkLimit
        };
    })