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

Add JSDoc type annotations #3731

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

y-hsgw
Copy link
Contributor

@y-hsgw y-hsgw commented Apr 9, 2024

I have added type annotations and fixed associated type errors.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

this isn't just adding type annotations and a lot of the changes are potentially breaking.

lib/rules/button-has-type.js Outdated Show resolved Hide resolved
lib/rules/checked-requires-onchange-or-readonly.js Outdated Show resolved Hide resolved
lib/rules/checked-requires-onchange-or-readonly.js Outdated Show resolved Hide resolved
lib/rules/forbid-elements.js Outdated Show resolved Hide resolved
lib/rules/forbid-foreign-prop-types.js Outdated Show resolved Hide resolved
@ljharb ljharb marked this pull request as draft April 9, 2024 02:52
@y-hsgw
Copy link
Contributor Author

y-hsgw commented Apr 10, 2024

I have addressed this in pull request #3732 and will proceed to close this one. I'll handle the areas requiring type changes separately.

@y-hsgw y-hsgw closed this Apr 10, 2024
@y-hsgw y-hsgw deleted the feature/add-jsdoc-annotations branch April 10, 2024 05:45
@ljharb
Copy link
Member

ljharb commented Apr 10, 2024

I would prefer to update this PR with those changes rather than abandoning it.

@y-hsgw y-hsgw restored the feature/add-jsdoc-annotations branch April 10, 2024 06:10
@y-hsgw y-hsgw reopened this Apr 10, 2024
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

i only went like 20% through, but this should help you refine the entire thing

lib/rules/checked-requires-onchange-or-readonly.js Outdated Show resolved Hide resolved
lib/rules/forbid-foreign-prop-types.js Outdated Show resolved Hide resolved
lib/rules/forbid-prop-types.js Outdated Show resolved Hide resolved
lib/rules/jsx-closing-bracket-location.js Outdated Show resolved Hide resolved
lib/rules/jsx-curly-spacing.js Outdated Show resolved Hide resolved
lib/rules/jsx-indent.js Outdated Show resolved Hide resolved
lib/rules/jsx-no-bind.js Outdated Show resolved Hide resolved
lib/rules/jsx-no-bind.js Outdated Show resolved Hide resolved
lib/rules/jsx-sort-default-props.js Outdated Show resolved Hide resolved
lib/rules/jsx-space-before-closing.js Outdated Show resolved Hide resolved
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 98.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.64%. Comparing base (cef8123) to head (4467e3a).
Report is 6 commits behind head on master.

Files Patch % Lines
lib/rules/no-unused-class-component-methods.js 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3731      +/-   ##
==========================================
+ Coverage   97.62%   97.64%   +0.01%     
==========================================
  Files         134      134              
  Lines        9617     9662      +45     
  Branches     3488     3514      +26     
==========================================
+ Hits         9389     9434      +45     
  Misses        228      228              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@y-hsgw y-hsgw changed the title Add JSDoc annotations Add JSDoc type annotations Apr 11, 2024
@y-hsgw y-hsgw requested a review from ljharb April 17, 2024 10:09
@ljharb ljharb force-pushed the master branch 2 times, most recently from 380e32c to 51d342b Compare July 4, 2024 15:25
@y-hsgw y-hsgw marked this pull request as ready for review July 5, 2024 14:05
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Please rebase this PR, and extract any changes that aren't about whitespace/parens, or adding/editing comments, to separate commits - and then all the "type annotations" changes can be in a single commit i can review separately. Thanks!

@ljharb ljharb marked this pull request as draft July 30, 2024 18:28
@y-hsgw y-hsgw force-pushed the feature/add-jsdoc-annotations branch from fe9ced2 to 6e0c30f Compare August 1, 2024 07:39
@y-hsgw
Copy link
Contributor Author

y-hsgw commented Aug 1, 2024

I have rebased and cleaned up the commits. Please check.

@y-hsgw y-hsgw requested a review from ljharb August 1, 2024 07:46
@y-hsgw y-hsgw force-pushed the feature/add-jsdoc-annotations branch from d687e25 to fbaf8e3 Compare August 11, 2024 03:35
@y-hsgw y-hsgw marked this pull request as ready for review August 12, 2024 07:27
@ljharb ljharb force-pushed the feature/add-jsdoc-annotations branch from fbaf8e3 to 605b6af Compare September 11, 2024 17:07
@ljharb
Copy link
Member

ljharb commented Sep 11, 2024

I've gone ahead and updated this to remove all the breaking changes. The way to safely resolve TypeScript's inability to understand that an x.foo check is identical to 'foo' in x && x.foo semantically is not to hardcode AST node types (that a custom parser might not match) but to add 'foo' in x and let TS do the narrowing.

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.

3 participants