Skip to content

fix(worma): use LF line endings + remove apostrophe from generated JSDoc headers - #182

Open
zengyishou wants to merge 1 commit into
alovajs:mainfrom
zengyishou:fix/crlf-and-apostrophe
Open

fix(worma): use LF line endings + remove apostrophe from generated JSDoc headers#182
zengyishou wants to merge 1 commit into
alovajs:mainfrom
zengyishou:fix/crlf-and-apostrophe

Conversation

@zengyishou

Copy link
Copy Markdown

Summary

Fixes #180

Problem

Generated .ts files from wormajs gen contain two issues that break TypeScript/vue-tsc compilation:

  1. CRLF line endings: utils/format.ts uses prettier endOfLine: 'auto' which can produce \r\n output. The TypeScript lexer does not handle CRLF well inside JSDoc comments.

  2. Apostrophe in JSDoc: The generated header comment contains the alova's vscode plugin. The ' (apostrophe) character inside JSDoc comments causes the TypeScript lexer to go into an error state — especially when combined with CRLF — producing errors like:

    TS1005: ';' expected
    TS1002: Unterminated string literal
    TS1109: Expression expected
    

Changes

Fix 1 — packages/worma/src/utils/format.ts

-  endOfLine: 'auto',
+  endOfLine: 'lf',

This matches the existing usage in src/core/loader/callingCodeLoader/index.ts which already uses endOfLine: 'lf'.

Fix 2 — All 5 comment.handlebars templates

- * NOTE: This file is auto generated by the alova's vscode plugin.
+ * NOTE: This file is auto generated by the alova team (https://alova.js.org).

Updated in all 5 presets:

  • alova/partials/comment.handlebars
  • alova-globals/partials/comment.handlebars
  • fetch/partials/comment.handlebars
  • axios/partials/comment.handlebars
  • ky/partials/comment.handlebars

Testing

  • TypeScript compilation of generated output passes without JSDoc-related lexer errors
  • endOfLine: 'lf' produces consistent LF output on all platforms
  • All affected templates still render the comment block correctly

Additional context

This fix eliminates the most common cause of "generated code won't compile" for users running vue-tsc --noEmit or tsc --noEmit against wormajs output.

…Doc headers

- Fix endOfLine: 'auto' → 'lf' in prettier config (format.ts)
  The 'auto' option could produce CRLF on some platforms, breaking vue-tsc
  and TypeScript compilation of generated .ts files.
- Replace the alova's vscode plugin → the alova team (https://alova.js.org)
  in all 5 preset comment.handlebars templates. The apostrophe character
  inside JSDoc comments was triggering TS lexer errors.

Closes alovajs#180
@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e727a46

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the worma label Jul 30, 2026
@JOU-amjs

JOU-amjs commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

only modify auto to lf, and ensure tests are passed.

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.

Bug: Generated .ts files contain CRLF line endings + apostrophe in JSDoc, breaking vue-tsc

2 participants