-
-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add support for page-meta component in Mini Program #61
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request focuses on formatting improvements in the Changes
Suggested Reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (8)
src/context.ts (8)
1-17
: Consistency in Import Statements
The imports and type declarations now end consistently with semicolons, which improves readability. However, note that the static analysis hints indicate potential issues with string quoting (e.g. preferring single quotes) and extra semicolons. Please double-check that these formatting choices align with your team’s ESLint configuration and overall coding standards.🧰 Tools
🪛 ESLint
[error] 1-1: Strings must use singlequote.
(style/quotes)
[error] 1-1: Extra semicolon.
(style/semi)
[error] 2-2: Strings must use singlequote.
(style/quotes)
[error] 2-2: Extra semicolon.
(style/semi)
[error] 8-8: Strings must use singlequote.
(style/quotes)
[error] 8-8: Extra semicolon.
(style/semi)
[error] 9-9: Strings must use singlequote.
(style/quotes)
[error] 9-9: Extra semicolon.
(style/semi)
[error] 10-10: Strings must use singlequote.
(style/quotes)
[error] 10-10: Extra semicolon.
(style/semi)
[error] 11-11: Strings must use singlequote.
(style/quotes)
[error] 11-11: Extra semicolon.
(style/semi)
[error] 12-12: Strings must use singlequote.
(style/quotes)
[error] 12-12: Extra semicolon.
(style/semi)
[error] 13-13: Strings must use singlequote.
(style/quotes)
[error] 13-13: Extra semicolon.
(style/semi)
[error] 14-14: Strings must use singlequote.
(style/quotes)
[error] 14-14: Extra semicolon.
(style/semi)
[error] 15-15: Strings must use singlequote.
(style/quotes)
[error] 15-15: Extra semicolon.
(style/semi)
[error] 16-16: Strings must use singlequote.
(style/quotes)
[error] 16-16: Extra semicolon.
(style/semi)
18-30
: Uniform Class Property Declarations and Constructor Initialization
The property declarations and constructor assignments now end with semicolons, enforcing a consistent style. This change is purely cosmetic and does not affect functionality. Just ensure that the style (including semicolon usage) is in agreement with your project’s guidelines.🧰 Tools
🪛 ESLint
[error] 19-19: Extra semicolon.
(style/semi)
[error] 20-20: Extra semicolon.
(style/semi)
[error] 21-21: Extra semicolon.
(style/semi)
[error] 22-22: Extra semicolon.
(style/semi)
[error] 23-23: Extra semicolon.
(style/semi)
[error] 24-24: Extra semicolon.
(style/semi)
[error] 26-26: Extra semicolon.
(style/semi)
[error] 27-27: Extra semicolon.
(style/semi)
[error] 28-28: Extra semicolon.
(style/semi)
[error] 29-29: Strings must use singlequote.
(style/quotes)
[error] 29-29: Extra semicolon.
(style/semi)
32-37
: Consistent Formatting in Vite Server Setup
ThesetupViteServer
method now uses semicolons after assignments and control flow statements. The early return in line 33 (after checking for an identical server instance) is concise, though double-check that the newline after theif
condition satisfies your style rules.🧰 Tools
🪛 ESLint
[error] 33-33: Expect newline after if
(antfu/if-newline)
[error] 33-33: Extra semicolon.
(style/semi)
[error] 35-35: Extra semicolon.
(style/semi)
[error] 36-36: Extra semicolon.
(style/semi)
39-46
: Event Handling in Watcher Setup
ThesetupWatcher
method leverages consistent semicolon usage in its event listener registration. The inline callback formatting (including the semicolon in line 45) maintains uniformity—just verify that this aligns with your coding standards.🧰 Tools
🪛 ESLint
[error] 40-40: Strings must use singlequote.
(style/quotes)
[error] 41-41: Strings must use singlequote.
(style/quotes)
[error] 42-42: Extra semicolon.
(style/semi)
[error] 45-45: Extra semicolon.
(style/semi)
105-112
: Page-Meta Component Extraction
The extraction logic forpage-meta
components via filtering the template AST is implemented correctly. As an optional refinement, consider normalizing the condition by always applyingkebabCase
tov.tag
if the tag naming is reliably consistent.🧰 Tools
🪛 ESLint
[error] 106-106: Extra semicolon.
(style/semi)
[error] 109-109: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 110-110: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 111-111: Strings must use singlequote.
(style/quotes)
[error] 111-111: Strings must use singlequote.
(style/quotes)
[error] 111-112: Missing trailing comma.
(style/comma-dangle)
[error] 112-112: Extra semicolon.
(style/semi)
129-154
: Reinserting Page-Meta Content Outside the Layout
The else branch elegantly extracts the content of thepage-meta
components, removes them from the original template, and then injects them outside the layout component. One suggestion: instead of using string replacement in a loop (lines 137–141), consider using MagicString’s dedicated removal methods (if available) to avoid potential pitfalls with non-unique substrings.🧰 Tools
🪛 ESLint
[error] 132-132: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 133-133: Strings must use singlequote.
(style/quotes)
[error] 133-133: Extra semicolon.
(style/semi)
[error] 136-136: Extra semicolon.
(style/semi)
[error] 140-140: Strings must use singlequote.
(style/quotes)
[error] 140-141: Missing trailing comma.
(style/comma-dangle)
[error] 141-141: Extra semicolon.
(style/semi)
[error] 151-151: Strings must use singlequote.
(style/quotes)
[error] 151-152: Missing trailing comma.
(style/comma-dangle)
[error] 152-153: Missing trailing comma.
(style/comma-dangle)
[error] 153-153: Extra semicolon.
(style/semi)
193-262
: Responsive Dynamic Layout Generation
ThegenerateDynamicLayout
method deftly handles both static and dynamic layout name bindings to reconstruct the layout markup. The bifurcation for Mini Program (MP) environments using theisMp
flag and the corresponding template generation is well implemented. The use of a console warning for a missing layout bind is a useful debugging aid.🧰 Tools
🪛 ESLint
[error] 195-195: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 195-195: Strings must use singlequote.
(style/quotes)
[error] 195-196: Missing trailing comma.
(style/comma-dangle)
[error] 196-196: Extra semicolon.
(style/semi)
[error] 198-198: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 199-199: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 200-200: Strings must use singlequote.
(style/quotes)
[error] 200-200: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 201-201: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 202-202: Strings must use singlequote.
(style/quotes)
[error] 202-202: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 203-203: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 204-205: Missing trailing comma.
(style/comma-dangle)
[error] 205-205: Extra semicolon.
(style/semi)
[error] 206-206: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 206-206: Strings must use singlequote.
(style/quotes)
[error] 206-206: Extra semicolon.
(style/semi)
[error] 209-209: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 210-211: Missing trailing comma.
(style/comma-dangle)
[error] 212-212: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 212-212: Extra semicolon.
(style/semi)
[error] 215-217: Expected { after 'if' condition.
(curly)
[error] 216-216: Strings must use singlequote.
(style/quotes)
[error] 216-217: Missing trailing comma.
(style/comma-dangle)
[error] 217-217: Extra semicolon.
(style/semi)
[error] 220-220: Extra semicolon.
(style/semi)
[error] 222-222: Extra semicolon.
(style/semi)
[error] 224-224: Strings must use singlequote.
(style/quotes)
[error] 224-225: Missing trailing comma.
(style/comma-dangle)
[error] 225-225: Extra semicolon.
(style/semi)
[error] 228-228: Extra semicolon.
(style/semi)
[error] 232-232: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 232-232: Strings must use singlequote.
(style/quotes)
[error] 232-233: Missing trailing comma.
(style/comma-dangle)
[error] 233-233: Extra semicolon.
(style/semi)
[error] 234-234: Expect newline after if
(antfu/if-newline)
[error] 234-234: Strings must use singlequote.
(style/quotes)
[error] 234-234: Extra semicolon.
(style/semi)
[error] 236-236: Extra semicolon.
(style/semi)
[error] 237-237: Extra semicolon.
(style/semi)
[error] 238-238: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 238-238: Strings must use singlequote.
(style/quotes)
[error] 238-238: Extra semicolon.
(style/semi)
[error] 242-242: Strings must use singlequote.
(style/quotes)
[error] 242-242: Strings must use singlequote.
(style/quotes)
[error] 244-244: Strings must use singlequote.
(style/quotes)
[error] 244-245: Missing trailing comma.
(style/comma-dangle)
[error] 245-246: Missing trailing comma.
(style/comma-dangle)
[error] 246-246: Extra semicolon.
(style/semi)
[error] 247-247: Extra semicolon.
(style/semi)
[error] 249-249: Strings must use singlequote.
(style/quotes)
[error] 249-249: Extra semicolon.
(style/semi)
[error] 250-250: Closing curly brace appears on the same line as the subsequent block.
(style/brace-style)
[error] 251-251: Extra semicolon.
(style/semi)
[error] 253-253: Expected { after 'if' condition.
(curly)
[error] 253-253: Extra semicolon.
(style/semi)
[error] 255-259: Expected { after 'else'.
(curly)
[error] 258-259: Missing trailing comma.
(style/comma-dangle)
[error] 259-259: Extra semicolon.
(style/semi)
[error] 260-260: Strings must use singlequote.
(style/quotes)
[error] 260-260: Extra semicolon.
(style/semi)
264-291
: Injection of Layout Components into the Application Instance
TheimportLayoutComponents
method builds import and registration strings for layout components and uses a regex-based replacement to inject component registration code into the createApp block. While effective, the regex (lines 278–280) is somewhat “magic” and could be brittle if the surrounding source changes. It may help to document the assumptions behind it for future maintainers.🧰 Tools
🪛 ESLint
[error] 265-265: Extra semicolon.
(style/semi)
[error] 266-266: Extra semicolon.
(style/semi)
[error] 267-267: Extra semicolon.
(style/semi)
[error] 270-271: Missing trailing comma.
(style/comma-dangle)
[error] 271-271: Extra semicolon.
(style/semi)
[error] 273-274: Missing trailing comma.
(style/comma-dangle)
[error] 274-274: Extra semicolon.
(style/semi)
[error] 276-276: Strings must use singlequote.
(style/quotes)
[error] 276-276: Extra semicolon.
(style/semi)
[error] 279-279: Strings must use singlequote.
(style/quotes)
[error] 279-280: Missing trailing comma.
(style/comma-dangle)
[error] 280-280: Extra semicolon.
(style/semi)
[error] 285-285: Extra semicolon.
(style/semi)
[error] 286-286: Extra semicolon.
(style/semi)
[error] 290-290: Extra semicolon.
(style/semi)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/context.ts
(1 hunks)
🧰 Additional context used
🪛 ESLint
src/context.ts
[error] 1-1: Strings must use singlequote.
(style/quotes)
[error] 1-1: Extra semicolon.
(style/semi)
[error] 2-2: Strings must use singlequote.
(style/quotes)
[error] 2-2: Extra semicolon.
(style/semi)
[error] 8-8: Strings must use singlequote.
(style/quotes)
[error] 8-8: Extra semicolon.
(style/semi)
[error] 9-9: Strings must use singlequote.
(style/quotes)
[error] 9-9: Extra semicolon.
(style/semi)
[error] 10-10: Strings must use singlequote.
(style/quotes)
[error] 10-10: Extra semicolon.
(style/semi)
[error] 11-11: Strings must use singlequote.
(style/quotes)
[error] 11-11: Extra semicolon.
(style/semi)
[error] 12-12: Strings must use singlequote.
(style/quotes)
[error] 12-12: Extra semicolon.
(style/semi)
[error] 13-13: Strings must use singlequote.
(style/quotes)
[error] 13-13: Extra semicolon.
(style/semi)
[error] 14-14: Strings must use singlequote.
(style/quotes)
[error] 14-14: Extra semicolon.
(style/semi)
[error] 15-15: Strings must use singlequote.
(style/quotes)
[error] 15-15: Extra semicolon.
(style/semi)
[error] 16-16: Strings must use singlequote.
(style/quotes)
[error] 16-16: Extra semicolon.
(style/semi)
[error] 19-19: Extra semicolon.
(style/semi)
[error] 20-20: Extra semicolon.
(style/semi)
[error] 21-21: Extra semicolon.
(style/semi)
[error] 22-22: Extra semicolon.
(style/semi)
[error] 23-23: Extra semicolon.
(style/semi)
[error] 24-24: Extra semicolon.
(style/semi)
[error] 26-26: Extra semicolon.
(style/semi)
[error] 27-27: Extra semicolon.
(style/semi)
[error] 28-28: Extra semicolon.
(style/semi)
[error] 29-29: Strings must use singlequote.
(style/quotes)
[error] 29-29: Extra semicolon.
(style/semi)
[error] 33-33: Expect newline after if
(antfu/if-newline)
[error] 33-33: Extra semicolon.
(style/semi)
[error] 35-35: Extra semicolon.
(style/semi)
[error] 36-36: Extra semicolon.
(style/semi)
[error] 40-40: Strings must use singlequote.
(style/quotes)
[error] 41-41: Strings must use singlequote.
(style/quotes)
[error] 42-42: Extra semicolon.
(style/semi)
[error] 45-45: Extra semicolon.
(style/semi)
[error] 50-50: Expect newline after if
(antfu/if-newline)
[error] 50-50: Extra semicolon.
(style/semi)
[error] 53-53: Extra semicolon.
(style/semi)
[error] 59-60: Missing trailing comma.
(style/comma-dangle)
[error] 60-60: Extra semicolon.
(style/semi)
[error] 63-63: Expect newline after if
(antfu/if-newline)
[error] 63-63: Extra semicolon.
(style/semi)
[error] 65-65: Extra semicolon.
(style/semi)
[error] 66-66: Extra semicolon.
(style/semi)
[error] 67-67: Extra semicolon.
(style/semi)
[error] 69-69: Strings must use singlequote.
(style/quotes)
[error] 70-70: Strings must use singlequote.
(style/quotes)
[error] 70-70: Extra semicolon.
(style/semi)
[error] 72-72: Strings must use singlequote.
(style/quotes)
[error] 74-74: Expect newline after if
(antfu/if-newline)
[error] 74-74: Extra semicolon.
(style/semi)
[error] 76-76: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 76-77: Missing trailing comma.
(style/comma-dangle)
[error] 77-77: Extra semicolon.
(style/semi)
[error] 79-79: Expect newline after if
(antfu/if-newline)
[error] 79-79: Extra semicolon.
(style/semi)
[error] 81-81: Strings must use singlequote.
(style/quotes)
[error] 81-81: Extra semicolon.
(style/semi)
[error] 83-83: Extra semicolon.
(style/semi)
[error] 84-84: Extra semicolon.
(style/semi)
[error] 85-85: Extra semicolon.
(style/semi)
[error] 88-88: Extra semicolon.
(style/semi)
[error] 91-91: Strings must use singlequote.
(style/quotes)
[error] 92-92: '=' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 93-93: Strings must use singlequote.
(style/quotes)
[error] 93-93: Strings must use singlequote.
(style/quotes)
[error] 93-93: Extra semicolon.
(style/semi)
[error] 94-94: '=' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 95-95: Strings must use singlequote.
(style/quotes)
[error] 95-95: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 96-96: Strings must use singlequote.
(style/quotes)
[error] 96-96: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 97-97: Strings must use singlequote.
(style/quotes)
[error] 97-97: Extra semicolon.
(style/semi)
[error] 99-99: Extra semicolon.
(style/semi)
[error] 102-102: Extra semicolon.
(style/semi)
[error] 106-106: Extra semicolon.
(style/semi)
[error] 109-109: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 110-110: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 111-111: Strings must use singlequote.
(style/quotes)
[error] 111-111: Strings must use singlequote.
(style/quotes)
[error] 111-112: Missing trailing comma.
(style/comma-dangle)
[error] 112-112: Extra semicolon.
(style/semi)
[error] 118-118: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 118-118: Strings must use singlequote.
(style/quotes)
[error] 118-119: Missing trailing comma.
(style/comma-dangle)
[error] 119-119: Extra semicolon.
(style/semi)
[error] 121-121: Expect newline after if
(antfu/if-newline)
[error] 121-121: Extra semicolon.
(style/semi)
[error] 126-127: Missing trailing comma.
(style/comma-dangle)
[error] 127-127: Extra semicolon.
(style/semi)
[error] 128-128: Closing curly brace appears on the same line as the subsequent block.
(style/brace-style)
[error] 132-132: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 133-133: Strings must use singlequote.
(style/quotes)
[error] 133-133: Extra semicolon.
(style/semi)
[error] 136-136: Extra semicolon.
(style/semi)
[error] 140-140: Strings must use singlequote.
(style/quotes)
[error] 140-141: Missing trailing comma.
(style/comma-dangle)
[error] 141-141: Extra semicolon.
(style/semi)
[error] 151-151: Strings must use singlequote.
(style/quotes)
[error] 151-152: Missing trailing comma.
(style/comma-dangle)
[error] 152-153: Missing trailing comma.
(style/comma-dangle)
[error] 153-153: Extra semicolon.
(style/semi)
[error] 162-162: Extra semicolon.
(style/semi)
[error] 166-166: Extra semicolon.
(style/semi)
[error] 171-171: Extra semicolon.
(style/semi)
[error] 172-172: Extra semicolon.
(style/semi)
[error] 175-176: Missing trailing comma.
(style/comma-dangle)
[error] 176-176: Extra semicolon.
(style/semi)
[error] 178-179: Missing trailing comma.
(style/comma-dangle)
[error] 179-179: Extra semicolon.
(style/semi)
[error] 180-180: Extra semicolon.
(style/semi)
[error] 181-181: Extra semicolon.
(style/semi)
[error] 182-182: Strings must use singlequote.
(style/quotes)
[error] 184-184: Strings must use singlequote.
(style/quotes)
[error] 188-188: Strings must use singlequote.
(style/quotes)
[error] 190-190: Extra semicolon.
(style/semi)
[error] 195-195: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 195-195: Strings must use singlequote.
(style/quotes)
[error] 195-196: Missing trailing comma.
(style/comma-dangle)
[error] 196-196: Extra semicolon.
(style/semi)
[error] 198-198: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 199-199: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 200-200: Strings must use singlequote.
(style/quotes)
[error] 200-200: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 201-201: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 202-202: Strings must use singlequote.
(style/quotes)
[error] 202-202: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 203-203: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 204-205: Missing trailing comma.
(style/comma-dangle)
[error] 205-205: Extra semicolon.
(style/semi)
[error] 206-206: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 206-206: Strings must use singlequote.
(style/quotes)
[error] 206-206: Extra semicolon.
(style/semi)
[error] 209-209: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 210-211: Missing trailing comma.
(style/comma-dangle)
[error] 212-212: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 212-212: Extra semicolon.
(style/semi)
[error] 215-217: Expected { after 'if' condition.
(curly)
[error] 216-216: Strings must use singlequote.
(style/quotes)
[error] 216-217: Missing trailing comma.
(style/comma-dangle)
[error] 217-217: Extra semicolon.
(style/semi)
[error] 220-220: Extra semicolon.
(style/semi)
[error] 222-222: Extra semicolon.
(style/semi)
[error] 224-224: Strings must use singlequote.
(style/quotes)
[error] 224-225: Missing trailing comma.
(style/comma-dangle)
[error] 225-225: Extra semicolon.
(style/semi)
[error] 228-228: Extra semicolon.
(style/semi)
[error] 232-232: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 232-232: Strings must use singlequote.
(style/quotes)
[error] 232-233: Missing trailing comma.
(style/comma-dangle)
[error] 233-233: Extra semicolon.
(style/semi)
[error] 234-234: Expect newline after if
(antfu/if-newline)
[error] 234-234: Strings must use singlequote.
(style/quotes)
[error] 234-234: Extra semicolon.
(style/semi)
[error] 236-236: Extra semicolon.
(style/semi)
[error] 237-237: Extra semicolon.
(style/semi)
[error] 238-238: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 238-238: Strings must use singlequote.
(style/quotes)
[error] 238-238: Extra semicolon.
(style/semi)
[error] 242-242: Strings must use singlequote.
(style/quotes)
[error] 242-242: Strings must use singlequote.
(style/quotes)
[error] 244-244: Strings must use singlequote.
(style/quotes)
[error] 244-245: Missing trailing comma.
(style/comma-dangle)
[error] 245-246: Missing trailing comma.
(style/comma-dangle)
[error] 246-246: Extra semicolon.
(style/semi)
[error] 247-247: Extra semicolon.
(style/semi)
[error] 249-249: Strings must use singlequote.
(style/quotes)
[error] 249-249: Extra semicolon.
(style/semi)
[error] 250-250: Closing curly brace appears on the same line as the subsequent block.
(style/brace-style)
[error] 251-251: Extra semicolon.
(style/semi)
[error] 253-253: Expected { after 'if' condition.
(curly)
[error] 253-253: Extra semicolon.
(style/semi)
[error] 255-259: Expected { after 'else'.
(curly)
[error] 258-259: Missing trailing comma.
(style/comma-dangle)
[error] 259-259: Extra semicolon.
(style/semi)
[error] 260-260: Strings must use singlequote.
(style/quotes)
[error] 260-260: Extra semicolon.
(style/semi)
[error] 265-265: Extra semicolon.
(style/semi)
[error] 266-266: Extra semicolon.
(style/semi)
[error] 267-267: Extra semicolon.
(style/semi)
[error] 270-271: Missing trailing comma.
(style/comma-dangle)
[error] 271-271: Extra semicolon.
(style/semi)
[error] 273-274: Missing trailing comma.
(style/comma-dangle)
[error] 274-274: Extra semicolon.
(style/semi)
[error] 276-276: Strings must use singlequote.
(style/quotes)
[error] 276-276: Extra semicolon.
(style/semi)
[error] 279-279: Strings must use singlequote.
(style/quotes)
[error] 279-280: Missing trailing comma.
(style/comma-dangle)
[error] 280-280: Extra semicolon.
(style/semi)
[error] 285-285: Extra semicolon.
(style/semi)
[error] 286-286: Extra semicolon.
(style/semi)
[error] 290-290: Extra semicolon.
(style/semi)
🔇 Additional comments (5)
src/context.ts (5)
48-68
: Early Returns and Target Page Detection in Transform Method
The first section of thetransform
method checks for available layouts and pages, then retrieves the target page viagetTarget
. The addition of semicolons in these conditionals and assignments improves consistency without altering the logic.🧰 Tools
🪛 ESLint
[error] 50-50: Expect newline after if
(antfu/if-newline)
[error] 50-50: Extra semicolon.
(style/semi)
[error] 53-53: Extra semicolon.
(style/semi)
[error] 59-60: Missing trailing comma.
(style/comma-dangle)
[error] 60-60: Extra semicolon.
(style/semi)
[error] 63-63: Expect newline after if
(antfu/if-newline)
[error] 63-63: Extra semicolon.
(style/semi)
[error] 65-65: Extra semicolon.
(style/semi)
[error] 66-66: Extra semicolon.
(style/semi)
[error] 67-67: Extra semicolon.
(style/semi)
83-103
: AST Parsing and 'uniLayout' Variable Detection
UsingbabelParse
to obtain the AST from the script setup and then traversing it withwalkAST
is implemented correctly. The detection of a variable nameduniLayout
(and appending a corresponding property if it’s a ref) is both clear and functional.🧰 Tools
🪛 ESLint
[error] 83-83: Extra semicolon.
(style/semi)
[error] 84-84: Extra semicolon.
(style/semi)
[error] 85-85: Extra semicolon.
(style/semi)
[error] 88-88: Extra semicolon.
(style/semi)
[error] 91-91: Strings must use singlequote.
(style/quotes)
[error] 92-92: '=' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 93-93: Strings must use singlequote.
(style/quotes)
[error] 93-93: Strings must use singlequote.
(style/quotes)
[error] 93-93: Extra semicolon.
(style/semi)
[error] 94-94: '=' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 95-95: Strings must use singlequote.
(style/quotes)
[error] 95-95: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 96-96: Strings must use singlequote.
(style/quotes)
[error] 96-96: '&&' should be placed at the beginning of the line.
(style/operator-linebreak)
[error] 97-97: Strings must use singlequote.
(style/quotes)
[error] 97-97: Extra semicolon.
(style/semi)
[error] 99-99: Extra semicolon.
(style/semi)
[error] 102-102: Extra semicolon.
(style/semi)
115-128
: Dynamic Layout Handling in Disabled Mode
In the disabled branch of thetransform
method, the code locates theuni-layout
element and usesms.overwrite
in conjunction withthis.generateDynamicLayout
to update the template. This approach is sound; however, verify that returning early when the layout node isn’t found (line 121) is the intended behavior for all edge cases.🧰 Tools
🪛 ESLint
[error] 118-118: Unexpected parentheses around single function argument having a body with no curly braces.
(arrow-parens)
[error] 118-118: Strings must use singlequote.
(style/quotes)
[error] 118-119: Missing trailing comma.
(style/comma-dangle)
[error] 119-119: Extra semicolon.
(style/semi)
[error] 121-121: Expect newline after if
(antfu/if-newline)
[error] 121-121: Extra semicolon.
(style/semi)
[error] 126-127: Missing trailing comma.
(style/comma-dangle)
[error] 127-127: Extra semicolon.
(style/semi)
[error] 128-128: Closing curly brace appears on the same line as the subsequent block.
(style/brace-style)
157-167
: Source Map Generation Post-Transformation
The check usingms.hasChanged()
and the subsequent generation of a source map are standard practices that ensure the transformation is tracked accurately. This implementation is clear and effective.🧰 Tools
🪛 ESLint
[error] 162-162: Extra semicolon.
(style/semi)
[error] 166-166: Extra semicolon.
(style/semi)
170-191
: Dynamic Import and Component Registration via Virtual Module
ThevirtualModule
method correctly constructs layout import statements and registers components with the app. The concatenation of strings and usage of template literals are clear. Just confirm that runtime component registration via this virtual module integrates seamlessly with the rest of your application architecture.🧰 Tools
🪛 ESLint
[error] 171-171: Extra semicolon.
(style/semi)
[error] 172-172: Extra semicolon.
(style/semi)
[error] 175-176: Missing trailing comma.
(style/comma-dangle)
[error] 176-176: Extra semicolon.
(style/semi)
[error] 178-179: Missing trailing comma.
(style/comma-dangle)
[error] 179-179: Extra semicolon.
(style/semi)
[error] 180-180: Extra semicolon.
(style/semi)
[error] 181-181: Extra semicolon.
(style/semi)
[error] 182-182: Strings must use singlequote.
(style/quotes)
[error] 184-184: Strings must use singlequote.
(style/quotes)
[error] 188-188: Strings must use singlequote.
(style/quotes)
[error] 190-190: Extra semicolon.
(style/semi)
抱歉现在才来看,请问你有时间来处理下 lint 的问题吗? |
Description 描述
在使用 vite-plugin-uni-layouts 插件时,小程序的 page-meta 组件不能正常工作,因为它需要作为页面的直接子元素才能生效。当页面被布局组件包裹后,page-meta 就不再是页面的直接子元素了。
解决方案
修改了插件的 transform 方法,使其能够:
Linked Issues 关联的 Issues
fixes #34
Summary by CodeRabbit