🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@JuanMaRuiz
Copy link
Contributor

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"

  "rules": {
	"no-nested-ternary": "warn"
  }

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

- 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
Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@JuanMaRuiz
Copy link
Contributor Author

Thanks for the PR! I left some comments to address.

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
- 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
@JuanMaRuiz
Copy link
Contributor Author

Thanks for the PR! I left some comments to address.

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.

Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my newest comments.

- 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
Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! I added more comments.

- Added all [PR](#442) requested by @mgol

fix: #438
@JuanMaRuiz
Copy link
Contributor Author

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!

- Removed browser support in main .eslintrc.json

fix: #438
- .eslintignore file configured properly to check sizzle file and added
comment for clarification

fix: #438
- Better comments indentation
- Removed .jshintrc file from test/karma folder

fix: #438
Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@JuanMaRuiz
Copy link
Contributor Author

Thanks for all the work! It's getting close. See my newest comments (all the old threads are resolved now).

Great!! I have added all the changes you requested.

Best regards.

- Reverted dot notation to bracket notation in src/sizzle file

fix: #438
@mgol
Copy link
Member

mgol commented May 28, 2019

@timmywil @gibson042 Do you want to review this as well? The PR LGTM so - if not - I'd land it soon.

@mgol
Copy link
Member

mgol commented May 29, 2019

I compared the minified file on master & on this branch & I found two bugs so it's good that I checked! I fixed them, see the screenshot for changes:
Screen Shot 2019-05-29 at 17 00 13
The first issue was forgetting a | when breaking a string into two lines. The second one was that the commit 7d92424 got reverted. After my fixes the only difference in the minified file is the version in the header that wasn't updated before so we should have no more issues. Phew!

@mgol
Copy link
Member

mgol commented May 29, 2019

BTW, especially the first issue means we're lacking test coverage in that area.

@mgol mgol closed this in 62061d0 May 29, 2019
mgol added a commit that referenced this pull request May 29, 2019
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
@mgol
Copy link
Member

mgol commented May 29, 2019

Landed, thanks @JuanMaRuiz for the whole effort!

@JuanMaRuiz
Copy link
Contributor Author

Landed, thanks @JuanMaRuiz for the whole effort!

Thanks to you @mgol for your comments and review.

@JuanMaRuiz JuanMaRuiz deleted the fix-438-use-eslint branch May 29, 2019 15:37
mgol pushed a commit to mgol/sizzle that referenced this pull request Aug 19, 2019
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)
mgol added a commit to mgol/jquery that referenced this pull request Aug 19, 2019
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
mgol added a commit to mgol/jquery that referenced this pull request Aug 19, 2019
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
mgol added a commit to mgol/jquery that referenced this pull request Aug 19, 2019
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
mgol added a commit to mgol/jquery that referenced this pull request Aug 20, 2019
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
mgol pushed a commit to mgol/sizzle that referenced this pull request Aug 21, 2019
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)
mgol added a commit to mgol/jquery that referenced this pull request Aug 22, 2019
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
mgol added a commit to mgol/jquery that referenced this pull request Aug 26, 2019
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
mgol added a commit to jquery/jquery that referenced this pull request Aug 26, 2019
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
@mgol mgol added this to the 2.3.5 milestone Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

jscs has been deprecated

3 participants