-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faulty check for angular/function-type #449
Comments
Oops, forgot to mention the versions: |
I started seeing a similar issue to this today with |
|
I am also having an issue with underscore's _.filter function getting caught in this. |
I have just pushed a unit test, but I was unable to reproduce the problem. Can you update my unit test ? |
I am unable to reproduce the issue anymore. |
I'm still seeing this issue occur: Rule:
Failures are with The unit test added looks like it's for |
Just tested this and I can confirm the issue is still there... The code in the original post still fails. |
"angular/function-type": [2, "named"] "angular/function-type": [2, "anonymous"] or the equivalent "angular/function-type": 2 So I'm pretty sure @calling is on to something. |
I've added test case that reproduces the issue described by @taa-autorola-com
First two cases pass, the third one (local variable) fails |
@jfgreffier have you sent a PR ? |
No, I just did a fork with the unit test. I don't have fix to put in in a pull request Here's the commit with the test: It appears in this conversation since it reference this bug. Do you want me to do a PR with this unit test ? |
It would be great :) thanks a lot. |
Done ;) It seems to be linked with utils.isAngularComponent() yielding a false positive; as it does indeed look like Angular code... |
I think the problem come from this snippet
The node.id looks to be null. I do not know why. still looking at this issue. |
Here is a pull request with a proposed fix. This code fits the conditions of
Callee can be anything My solution is to explicitly rule out callee from a reserved name list.
|
The fule angular/function-type fails when using specific function names and argument patterns. More specific, the reserved names are defined in the rule as
var angularObjectList = ['animation', 'config', 'constant', 'controller', 'directive', 'factory', 'filter', 'provider', 'service', 'value', 'decorator'];
When any of those predefined functions are seen and the parameters match the rule specification , the rule is enforced.
I've created a minimal example here, which shows a function named filter, which should probably not be checked by the rule.
`(function () {
'use strict';
})();
`
It seems it is the argument checking that fails in this case, since it works when using functions or global variables. Only local variables (and as function parameters) are affected.
The text was updated successfully, but these errors were encountered: