-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Default params & duplicate param arguments #2493
Conversation
Added fix for #2494 |
c8eb3d3
to
0ce2250
Compare
The fix for duplicate parameter names does not consider the strictness of the function itself. For instance, the following does not generate an error with this patch applied: // jshint shadow: true
function f(a, a) {
'use strict';
} This is not a regression, though, so I'd be okay with tackling that problem in a follow-up patch. How would you like to handle it, @lukeapage? |
I fixed both comments.. not sure how the squashing should go though since I have two commits and it related to the first one? |
479465e
to
6cebb16
Compare
re-ordered them, didn't realise you could do it :) |
6cebb16
to
4ddae7a
Compare
rebased on master. Changes around how parameters are added in the catch case. |
Hey Luke, thanks for addressing my feedback! There are a few things that I
I've made a patch for your patch here. It addresses some of these concerns directly, while refactoring others away. What do you think? By the way: I know this feedback is delayed, but I usually don't feel |
Thanks, your patch is much better. I think there are a couple of easy-to-fix problems with it (also your link doesn't work, I think you used the pull request format rather than the commit one?) Do you want to make a new PR with both our commits in or? what do you want to do? |
Sorry about that! It sounds like you found it, but just in case: I'm happy to keep this branch/pull request if you don't mind applying that patch and pushing it up.
|
Oh, just now seeing your comments on that commit. Hm, maybe I should incorporate your feedback and make a new commit from that. That's not what I suggested above, so I'll wait to hear back from you before doing anything. |
I think quicker feedback even if inane is beneficial for any open source project. If people raise a PR and don't get feedback they assume it will sit there forever (my colleague contributed to jquery ui a year and half ago and there still hasn't been any negative feedback as to why it isn't being pulled) and that there was no point in raising the PR. In a way I think I matter less than other contributors because I already have time invested and I know you are slowly working through them (though about a minute before I got this response I was wondering if you'd missed the PR's because I made so many of them). That's why I've tried to be quick to review @nicolo-ribaudo code, because I get the feeling, I could be completely wrong, that if he has alot of PR's open, he stops contributing) - hopefully I've shown the balance of leaving the ones I need you to look at and merging the simpler ones. But its possible I'm wrong and that more inane, terse feedback might put people off more than no response. In this particular PR, If you had just come back with those 4 short comments I'm not sure whether I'd have got to the same solution as you or not - I definitely missed it the first time round, but I might have got it if challenged. My style is probably closer to inane/quick feedback on PR's, merging those that are simple asap and then go back and help people on PR's that possibly non-helpful comments were left on, if they haven't in that time figured out a better solution to look at. But its about what you enjoy as well, so, I personally really don't mind. |
thats fine, I'll await the next version. am also happy to push to a jshint branch and create a new PR so you can push directly to it. |
I've pushed up a commit addressing some of your feedback. I don't believe a change is necessary for your other comment, though. I may be mistaken, so please let me know. I'm working from the following branch: https://github.com/jugglinmike/jshint/tree/default-params-improvement . The comparison view with your branch for this pull request is here: lukeapage/jshint@default-params...jugglinmike:default-params-improvement |
I think your commits look good - and I think you've addressed all of your own feedback? So I'm happy with this if you are. Let me know if there is anything else to do. I've put your commits onto this PR. |
Okay! I'm going to try to clean up the history a bit; here's my plan:
...after all that's done, I'll land it in |
Change default argument processing to error if you attempt to access a future argument or the argument you are assigning yourself. Fixes jshint#2422
Fix the behaviour of params to respect shadow inner or outer, which causes a warning and strict mode, which causes an error. Fixes jshint#2492
The extract to scope manager change introduced a regression where by destructured params did not get the right line and char due to the token not being passed to the scope manager. Fixes jshint#2494
Defer parameter validation until after functions are parsed so that the process can be applied according to the strictness of the function body. Define this via a `validateParams` method, and do not trigger warnings related to variable shadowing in cases where the same code triggers an error.
62df53e
to
33749f6
Compare
Teamwork! |
Sorry, 2 more fixes in one because I needed a refactor from one for the other.
Change default argument processing to error if you attempt to access a
future argument or the argument you are assigning yourself.
Fixes #2422
Fix the behaviour of params to respect shadow inner or outer, which causes
a warning and strict mode, which causes an error.
Fixes #2492