-
Notifications
You must be signed in to change notification settings - Fork 61
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
'no-sibling-hooks': false-positives inside functions #113
Comments
Thanks for the issue. The problem with the example you provided is that it depends on where |
This looks like a very complex setup for your tests, and maybe it makes sense in your case, but this seems like an edge case to me. I would rather advocate to disable the rule on this file, unless you have a reasonable way to handle non-direct children. I'd prefer handling this case correctly describe('foo', function() {
before(function() {});
if (FOO) {
before(function() {}); // No sibling hook
}
}); (and also in switch cases, etc... you never know) than to allow @nhardy's example. Sometimes eslint-disable are fine. Feel free to disagree, and I don't mind if you go ahead and skip hook functions that are not direct children, but it'd be nice if we don't get a lot of false positives due to this change. |
I just got this when upgrading from v5 to v8 - i have a I do not think this is an edge case; I think the rule is broken, because it's not using eslint's AST information to determine whether the hook functions are in fact globals (as opposed to file-local variables). |
@ljharb I think this is not the same issue as described here, but I fully agree with you that rules in this plugin should track where the identifiers are coming from (either globals or from an import/require). I hope to find some time in the next days to work on this. |
I have a rough example below:
The text was updated successfully, but these errors were encountered: