Skip to content

fix(documentation): do not remove JSDoc types in Vue JS files #995

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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 🚀

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"
2 participants