Add eslint as linter tool - #442
JuanMaRuiz wants to merge 31 commits into
Conversation
- Removed jscs and jshint: Config files and grunt tasks - Added eslint: Added dependencies and grunt task
- Configuring eslint: Using jquery configuration
- Configuring eslint: Using jquery configuration - Fix lint errors: Fixed errors using eslint configuraion
Fixing line length marked as error by eslint jquery configuration
Fixing line length marked as error by eslint jquery configuration
Line 1676 -> error Do not nest ternary expressions no-nested-ternary
- Configured eslint with jQuery configuration for main project and speed folder - Fixed all lint errors - Marked as warning the rule not-nested-ternary fix: #438
mgol
left a comment
There was a problem hiding this comment.
Thanks for the PR! I left some comments to address.
- Reverted indentation of src/sizzle.js file. - Applied reviewer proposal except the use of strict mode fix: #438
Many thanks to you for the quick review!! I have applied almost all the request. If you have any time, could to please review it again? Best regards. |
- Added 'strict mode' (pending of review from reviewers) to fix ci fix: #438
- Added 'strict mode' (pending of review from reviewers) to fix ci fix: #438
…zzle into fix-438-use-eslint
- Reverting dot notation due Google compiler concern
- Fixed eslint error when reverting dot notation due Google compiler concern. - Disable line to avoid error for not using dot notation according eslint config
- Added eslint configuration files for test folder. - Added changes requested in PR #442
- Fixed all style issues detected by eslint using jquery configuration
- Added package-lock.json
Hi @mgol I have noted that I missed the configuration of some test and tasks files. I have tried to mimic the jquery configuration. I hope the configuration is the correct ones. Please, if you have any time let me know if everything is ok now. Best regards. JuanMa. |
- Reverted indentation of src/sizzle.js file. - Remove "use strict" form task files. - Added new eslint configuration files. - Configured lint and default grunt tasks as jquery project. fix: #438
mgol
left a comment
There was a problem hiding this comment.
Thanks for the update! I added more comments.
Many thanks for your quick review @mgol ! I hope is everything is fits the requirements now. Best regards! |
- Better comments indentation - Removed .jshintrc file from test/karma folder fix: #438
mgol
left a comment
There was a problem hiding this comment.
Thanks for all the work! It's getting close. See my newest comments (all the old threads are resolved now).
- Fixed some indentation in comments. - Changed some dot notations to bracket notation.
- Re-indented some comments and code after added eslint - Changed location and setTimeout for window.location and window.setTimeout. fix: #438
Great!! I have added all the changes you requested. Best regards. |
- Reverted dot notation to bracket notation in src/sizzle file fix: #438
|
@timmywil @gibson042 Do you want to review this as well? The PR LGTM so - if not - I'd land it soon. |
|
I compared the minified file on |
|
BTW, especially the first issue means we're lacking test coverage in that area. |
Newest eslint-config-jquery requires prefixing unused function parameters with and underscore; that has been done. The build Grunt task was also fixed to lint the built Sizzle version only after it's built. Ref gh-442
|
Landed, thanks @JuanMaRuiz for the whole effort! |
Thanks to you @mgol for your comments and review. |
This is a resubmit of jquerygh-439 that was lost during the switch from JSHint + JSCS to ESLint Ref jquerygh-442 Ref jquerygh-439 (cherry picked from commit 7d92424)
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Ref jquery/sizzle#442 Ref jquery/sizzle#439
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Ref jquery/sizzle#442 Ref jquery/sizzle#439
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Ref jquery/sizzle#442 Ref jquery/sizzle#439
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Ref jquery/sizzle#442 Ref jquery/sizzle#439
This is a resubmit of jquerygh-439 that was lost during the switch from JSHint + JSCS to ESLint Ref jquerygh-442 Ref jquerygh-439 (cherry picked from commit 7d92424)
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Ref jquery/sizzle#442 Ref jquery/sizzle#439
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Ref jquery/sizzle#442 Ref jquery/sizzle#439
With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Closes gh-4462 Ref jquery/sizzle#442 Ref jquery/sizzle#439

As discussed in the opened issue jscs is deprecated and jQuery is using eslint as linter tool. I have configured eslint as is in the jQuery project. But I have had to configure something in a special way: For example: I have marked as to skip the rule "no-nested-ternary"
because the style of coding of sizzle is not the same as the jQuery.
I have tried to extract to functions but I cannot name the functions with a clear name or because I think it could increase the complexity of the code. I have also tried to replace ternaries with
ifs but it increase the weight of the build.Please, let me know I this PR is useful and/or needs to be updated.
Best regards.
fix: #438