-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
Improve detection of globals and catch additional jQuery function calls in no-jquery
rule
#1063
Improve detection of globals and catch additional jQuery function calls in no-jquery
rule
#1063
Conversation
ad2d280
to
2e97005
Compare
Thanks for your work so far! |
2e97005
to
b82af74
Compare
tests/lib/rules/no-global-jquery.js
Outdated
@@ -457,5 +457,21 @@ ruleTester.run('no-global-jquery', rule, { | |||
}, | |||
], | |||
}, | |||
{ | |||
code: ` | |||
export default Ember.Component({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to include the Ember import statement for this. Alternatively, you could just simplify the entire test case to jQuery.extend()
since the rule does not actually care if the Ember component is involved and the Ember component just adds unnecessary clutter to the test case.
no-jquery
ruleno-jquery
rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this! This really improves and simplifies these rules.
Thank you! I've appreciated your help and feedback with this. I think we've ended up in a good place 👍🏻 |
@BarryThePenguin it looks like the |
I can take a look 👀 What shortcomings did you notice? |
@BarryThePenguin the |
I ran into three situations when using the
no-jquery
rule that I thought might be worth fixing. I've added test cases for each.MemberExpression
like$.extend()
does not trigger the ruleMemberExpression
likethis.$.extend()
does not trigger the ruleParameter
likefunction foo($) { ... }
does trigger the ruleFor the last one, I'd expect it to not trigger the rule, as
eslint
cannot know for certain where$
came from..I put together the failing test cases and spent some time investigating what might need to change. The end result is quite a significant change to how the rule works..
All the existing test cases still work, including the new ones I've added. There may be some history behind the original implementation that I'm not aware of, so I understand if this new approach is too big a change
Fixes #211 #279