eslint-plugin-angular icon indicating copy to clipboard operation
eslint-plugin-angular copied to clipboard

directive-restrict AE always not work in some case

Open delagen opened this issue 10 years ago • 6 comments

.directive("snapContainer", [
            "$injector", "$rootScope", "$rootElement", "$timeout", "ibRoutePathSaver",
            /*jshint maxparams:5*/
            function($injector, $rootScope, $rootElement, $timeout, ibRoutePathSaver) {
                return {
                    restrict:   "A",

directive-restrict AE always generate error triple error [angular/directive-restrict] Line:11 Column:2 Missing directive restriction [angular/directive-restrict] Line:11 Column:2 Missing directive restriction [angular/directive-restrict] Line:11 Column:2 Missing directive restriction

delagen avatar Dec 23 '15 09:12 delagen

Hi, I've got the same problem. Given that my rule was defined as follow:

"angular/directive-restrict": [2, {
    "explicit": "always"
}],

when I write the following code:

angular
    .module('tuleap.pull-request')
    .directive('overview', OverviewDirective);

function OverviewDirective() {
    return {
        restrict        : 'A', // I also get the same error with 'AE'
        scope           : {},
        templateUrl     : 'overview/overview.tpl.html',
        controller      : 'OverviewController as overview',
        bindToController: true
    };
}

Then I will get an error (I only get one error though, not three as above):

<file-path-to-the-file>/overview-directive.js
  1:1  error  Missing directive restriction  angular/directive-restrict

I should not have an error since 'A' is explicitly defined in the directive.

Hyzual avatar Jun 23 '16 13:06 Hyzual

+1

thiagogarbazza avatar Jul 12 '16 13:07 thiagogarbazza

+1

ramonvicelli avatar Jul 12 '16 14:07 ramonvicelli

+1

rarkins avatar Dec 11 '16 06:12 rarkins

+1

mdownes avatar Feb 28 '17 11:02 mdownes

I can not reproduct the problem. I have added a unit test

EmmanuelDemey avatar Mar 19 '17 16:03 EmmanuelDemey