From 49af9e82cbf9fbead996a1021609c1b1c3df393e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Wed, 31 May 2023 22:48:20 +0900 Subject: [PATCH] fix(#10923): invalid class names --- .../rollup-plugin-unwind-css-module-class-name.ts | 10 +++++----- packages/frontend/src/components/MkAutocomplete.vue | 2 +- packages/frontend/src/components/MkClickerGame.vue | 6 +----- packages/frontend/src/components/MkContainer.vue | 2 +- packages/frontend/src/components/MkFolder.vue | 6 +----- packages/frontend/src/components/MkMention.vue | 2 +- packages/frontend/src/components/MkMenu.vue | 2 +- packages/frontend/src/components/MkNote.vue | 8 ++++---- packages/frontend/src/components/MkNoteDetailed.vue | 4 ++-- packages/frontend/src/components/MkNotePreview.vue | 2 +- packages/frontend/src/components/MkNotification.vue | 5 +---- packages/frontend/src/components/MkPoll.vue | 2 +- packages/frontend/src/components/MkPostForm.vue | 8 ++++---- .../frontend/src/components/MkSubNoteContent.vue | 6 +----- packages/frontend/src/components/MkTextarea.vue | 2 +- packages/frontend/src/components/MkUrlPreview.vue | 11 ++--------- .../frontend/src/components/MkUserSelectDialog.vue | 4 +--- packages/frontend/src/components/MkUsersTooltip.vue | 12 ++---------- .../frontend/src/components/MkVisitorDashboard.vue | 6 +----- packages/frontend/src/components/form/link.vue | 4 ++-- packages/frontend/src/components/form/slot.vue | 2 +- packages/frontend/src/components/global/MkUrl.vue | 2 +- .../frontend/src/pages/admin/RolesEditorFormula.vue | 12 ++---------- packages/frontend/src/pages/admin/queue.chart.vue | 7 ++----- packages/frontend/src/pages/admin/server-rules.vue | 2 +- packages/frontend/src/pages/settings/profile.vue | 6 +----- packages/frontend/src/pages/signup-complete.vue | 5 +---- packages/frontend/src/pages/welcome.setup.vue | 5 +---- packages/frontend/src/pages/welcome.timeline.vue | 2 +- .../src/ui/_common_/statusbar-federation.vue | 2 +- packages/frontend/src/ui/_common_/statusbars.vue | 1 - .../frontend/src/ui/_common_/stream-indicator.vue | 7 ++----- packages/frontend/src/ui/deck/column.vue | 2 +- packages/frontend/src/ui/universal.vue | 2 +- packages/frontend/src/ui/universal.widgets.vue | 7 ++----- packages/frontend/src/widgets/WidgetRssTicker.vue | 2 +- 36 files changed, 53 insertions(+), 117 deletions(-) diff --git a/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts b/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts index 225ad5f458..b2d27f0b37 100644 --- a/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts +++ b/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts @@ -11,6 +11,7 @@ export function unwindCssModuleClassName(ast: estree.Node): void { if (node.type !== 'VariableDeclaration') return; if (node.declarations.length !== 1) return; if (node.declarations[0].id.type !== 'Identifier') return; + const name = node.declarations[0].id.name; if (node.declarations[0].init?.type !== 'CallExpression') return; if (node.declarations[0].init.callee.type !== 'Identifier') return; if (node.declarations[0].init.callee.name !== '_export_sfc') return; @@ -121,10 +122,10 @@ export function unwindCssModuleClassName(ast: estree.Node): void { if (childNode.object.property.type !== 'Identifier') return; if (childNode.object.property.name !== key) return; if (childNode.property.type !== 'Identifier') return; - console.error(`${key}.${childNode.property.name} is not a valid css module class name`); + console.error(`Undefined style detected: ${key}.${childNode.property.name} (in ${name})`); this.replace({ - type: 'Literal', - value: null, + type: 'Identifier', + name: 'undefined', }); }, }); @@ -152,9 +153,8 @@ export function unwindCssModuleClassName(ast: estree.Node): void { export default function pluginUnwindCssModuleClassName(): Plugin { return { name: 'UnwindCssModuleClassName', - renderChunk(code, chunk): { code: string } { + renderChunk(code): { code: string } { const ast = this.parse(code) as unknown as estree.Node; - console.log(`======= ${chunk.fileName} =======`); unwindCssModuleClassName(ast); return { code: generate(ast) }; }, diff --git a/packages/frontend/src/components/MkAutocomplete.vue b/packages/frontend/src/components/MkAutocomplete.vue index 4338a8f8e6..2e33fac82d 100644 --- a/packages/frontend/src/components/MkAutocomplete.vue +++ b/packages/frontend/src/components/MkAutocomplete.vue @@ -10,7 +10,7 @@
  • {{ i18n.ts.selectUser }}
  • -
      +
      1. {{ hashtag }}
      2. diff --git a/packages/frontend/src/components/MkClickerGame.vue b/packages/frontend/src/components/MkClickerGame.vue index da6439fd2c..a6ab5aded4 100644 --- a/packages/frontend/src/components/MkClickerGame.vue +++ b/packages/frontend/src/components/MkClickerGame.vue @@ -3,7 +3,7 @@
        {{ number(cps) }}cps
        {{ number(cookies) }}
        -
        @@ -84,10 +84,6 @@ onUnmounted(() => { margin-bottom: 6px; } -.button { - -} - .img { max-width: 90px; } diff --git a/packages/frontend/src/components/MkContainer.vue b/packages/frontend/src/components/MkContainer.vue index d2d0fa3e4b..8b115b4b62 100644 --- a/packages/frontend/src/components/MkContainer.vue +++ b/packages/frontend/src/components/MkContainer.vue @@ -1,5 +1,5 @@