fix(worma): use LF line endings + remove apostrophe from generated JSDoc headers - #182
Open
zengyishou wants to merge 1 commit into
Open
fix(worma): use LF line endings + remove apostrophe from generated JSDoc headers#182zengyishou wants to merge 1 commit into
zengyishou wants to merge 1 commit into
Conversation
…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
|
Contributor
|
only modify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #180
Problem
Generated
.tsfiles fromwormajs gencontain two issues that break TypeScript/vue-tsc compilation:CRLF line endings:
utils/format.tsuses prettierendOfLine: 'auto'which can produce\r\noutput. The TypeScript lexer does not handle CRLF well inside JSDoc comments.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:Changes
Fix 1 —
packages/worma/src/utils/format.tsThis matches the existing usage in
src/core/loader/callingCodeLoader/index.tswhich already usesendOfLine: 'lf'.Fix 2 — All 5
comment.handlebarstemplatesUpdated in all 5 presets:
alova/partials/comment.handlebarsalova-globals/partials/comment.handlebarsfetch/partials/comment.handlebarsaxios/partials/comment.handlebarsky/partials/comment.handlebarsTesting
endOfLine: 'lf'produces consistent LF output on all platformsAdditional context
This fix eliminates the most common cause of "generated code won't compile" for users running
vue-tsc --noEmitortsc --noEmitagainst wormajs output.