Skip to content
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

feat(utils): update eslint types #4896

Merged
merged 3 commits into from May 3, 2022
Merged

Conversation

bradzacher
Copy link
Member

This just updates eslint types to be in sync with the last few versions.
I just went through the history on the nodejs api docs file and compared the commits to what we have.

This just updates eslint types to be in sync with the last few versions.
@bradzacher bradzacher added the enhancement New feature or request label May 3, 2022
@nx-cloud
Copy link

nx-cloud bot commented May 3, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit c78f146. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 43 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @bradzacher!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@netlify
Copy link

netlify bot commented May 3, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit c78f146
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6271ac8bb2b3800008e3b385
😎 Deploy Preview https://deploy-preview-4896--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #4896 (d72c612) into main (47f4605) will decrease coverage by 0.19%.
The diff coverage is n/a.

❗ Current head d72c612 differs from pull request most recent head 10f5c0c. Consider uploading reports for the commit 10f5c0c to get more accurate results

@@            Coverage Diff             @@
##             main    #4896      +/-   ##
==========================================
- Coverage   91.76%   91.56%   -0.20%     
==========================================
  Files         226      210      -16     
  Lines       10586     9239    -1347     
  Branches     3280     2915     -365     
==========================================
- Hits         9714     8460    -1254     
+ Misses        591      522      -69     
+ Partials      281      257      -24     
Flag Coverage Δ
unittest 91.56% <ø> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/utils/src/ts-eslint/ESLint.ts 50.00% <ø> (ø)
packages/utils/src/ts-eslint/RuleTester.ts 100.00% <ø> (ø)
packages/utils/src/ts-eslint/SourceCode.ts 100.00% <ø> (ø)
packages/typescript-estree/src/convert.ts
packages/typescript-estree/src/convert-comments.ts
...ges/typescript-estree/src/create-program/shared.ts
...-estree/src/create-program/createDefaultProgram.ts
packages/visitor-keys/src/get-keys.ts
packages/typescript-estree/src/simple-traverse.ts
packages/visitor-keys/src/visitor-keys.ts
... and 13 more

* The method to asynchronously convert the LintResult objects to text.
* @since 8.4.0
*/
format(results: LintResult[]): Promise<string>;
Copy link
Member

Choose a reason for hiding this comment

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

I could be wrong, but does this actually work? Can you have overloads that differ only by return types? My test suggests TS never picks up this overload

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this should apparently be a union: string | Promise<string>. Which I find weird but 🤷 compatibility.

eslint/eslint#15242
eslint/eslint#15243
https://eslint.org/docs/developer-guide/nodejs-api#-loadedformatter-type

Copy link
Member Author

Choose a reason for hiding this comment

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

I was kind of hoping that TS would be smart here and merge the return value type.

I wanted to document the promise-based return separately as it is only accepted in a later version of ESLint.

But if TS won't let me, I'll just merge them together and describe it in the JSDoc 😢

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM - reviewed the ESLint blog posts for the versions and confirmed they all match up. Just need to change the overload to a union and it's good to go!

@bradzacher bradzacher merged commit da48527 into main May 3, 2022
@JoshuaKGoldberg JoshuaKGoldberg deleted the update-eslint-types-2022-05-02 branch May 3, 2022 23:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants