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

chore: Convert helpers.js to TypeScript #1156

Merged
merged 3 commits into from
Aug 9, 2022

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Aug 9, 2022

What:

Part of #494

Why:

To use generated TypeScript declaration files eventually

How:

Fairly low level helpers where most types are unknown. Uses any for pragmatic reasons.

Checklist:

  • Documentation added to the
    docs site
  • Tests
  • TypeScript definitions updated
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 9, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d971798:

Sandbox Source
react-testing-library-examples Configuration

@@ -65,6 +65,9 @@
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/prefer-optional-chain": "off",
Copy link
Member Author

Choose a reason for hiding this comment

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

Stylistic rule whose rational is not suitable for a lint rule (false-positive rate needs to be next to zero).

@@ -65,6 +65,9 @@
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/no-explicit-any": "off",
Copy link
Member Author

Choose a reason for hiding this comment

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

Typed languages have won over JS because we have these escape hatches. They're still relevant especially in a library

@@ -65,6 +65,9 @@
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
Copy link
Member Author

Choose a reason for hiding this comment

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

Once this rule can distiginguish between explicit any and implicit/external any we can disable. Until then its false-positive rate is too high.

@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #1156 (d971798) into main (d50a967) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1156   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          990       990           
  Branches       322       322           
=========================================
  Hits           990       990           
Flag Coverage Δ
node-12 100.00% <100.00%> (ø)
node-14 100.00% <100.00%> (ø)
node-16 100.00% <100.00%> (ø)

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

Impacted Files Coverage Δ
src/helpers.ts 100.00% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

👍 the turned off eslint rules also makes sense to me

@timdeschryver timdeschryver merged commit a21bb3d into testing-library:main Aug 9, 2022
@eps1lon eps1lon deleted the chore/ts/helpers branch August 9, 2022 18:16
@github-actions
Copy link

🎉 This PR is included in version 8.18.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants