Skip to content

Conversation

@ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Apr 24, 2025

Half-working solution

  • jsdoc/require-property-type makes no harm in TS, there are no @property
  • In .vue files (that can be both TS and JS):
    • Use jsdoc/no-types only if there are TS types
    • Use jsdoc/require-param-type only if there are no TS types
    • Disable jsdoc/require-returns-type (because a return type is often inferred, not specified)
    • Allow type-tags in jsdoc/check-tag-names (because it can be used in a JS component)

So it doesn't break existing JS components (like before).
But it applies only ~half of JSDoc + TS rules in TS components.

Alternative

Generate files on the fly by checking <script lang> to distinguish between JS and TS Vue files.

@ShGKme ShGKme added the bug Something isn't working label Apr 24, 2025
@ShGKme ShGKme requested a review from susnux April 24, 2025 16:46
@ShGKme ShGKme self-assigned this Apr 24, 2025
@ShGKme ShGKme force-pushed the fix/jsdoc-in-mixed-ts branch from d71ce12 to 062ad14 Compare April 24, 2025 16:48
@ShGKme
Copy link
Contributor Author

ShGKme commented Apr 24, 2025

I'll add tests if the idea is fine

Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

I like the idea! Did not check yet!

Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

seems to work 🚀

@susnux
Copy link
Contributor

susnux commented May 12, 2025

what is missing here @ShGKme ?

@ShGKme
Copy link
Contributor Author

ShGKme commented May 13, 2025

what is missing here @ShGKme ?

My willing to add tests here with all the cases.
I'll do it now.

Oh, and a general dislike of the solution, as it is a half-solution. For example, it just disables jsdoc/require-returns-type at all.

@ShGKme ShGKme force-pushed the fix/jsdoc-in-mixed-ts branch from 062ad14 to 3ad54d6 Compare May 13, 2025 18:43
@ShGKme ShGKme marked this pull request as ready for review May 13, 2025 18:43
@ShGKme ShGKme force-pushed the fix/jsdoc-in-mixed-ts branch from 3ad54d6 to c461e0a Compare May 13, 2025 18:44
@ShGKme ShGKme force-pushed the fix/jsdoc-in-mixed-ts branch from c461e0a to e1587f3 Compare May 13, 2025 18:44
@ShGKme
Copy link
Contributor Author

ShGKme commented May 13, 2025

  • Rebased onto main
  • Added tests
  • No changes in the rules

@susnux susnux merged commit 50063d1 into main May 13, 2025
10 checks passed
@susnux susnux deleted the fix/jsdoc-in-mixed-ts branch May 13, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Types are removed from JSDoc in .vue when there it has no lang="ts"

3 participants