Skip to content

Commit 389861f

Browse files
refactor(frontend): fix invalid self-closing tags (#17103)
* fix(frontend): fix invalid self-closing tags * apply eslint rules * fix * fix
1 parent ec683f0 commit 389861f

25 files changed

+67
-51
lines changed

packages/frontend-embed/eslint.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ export default [
144144
'vue/return-in-computed-property': 'warn',
145145
'vue/no-setup-props-reactivity-loss': 'warn',
146146
'vue/max-attributes-per-line': 'off',
147-
'vue/html-self-closing': 'off',
147+
'vue/html-self-closing': ['error', {
148+
html: {
149+
void: 'any',
150+
normal: 'never',
151+
component: 'any',
152+
},
153+
svg: 'any',
154+
math: 'any',
155+
}],
148156
'vue/singleline-html-element-content-newline': 'off',
149157
'vue/v-on-event-hyphenation': ['error', 'never', {
150158
autofix: true,

packages/frontend-embed/src/components/EmAvatar.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ SPDX-License-Identifier: AGPL-3.0-only
99
<div v-if="user.isCat" :class="[$style.ears]">
1010
<div :class="$style.earLeft">
1111
<div v-if="false" :class="$style.layer">
12-
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"/>
13-
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"/>
14-
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"/>
12+
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"></div>
13+
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"></div>
14+
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"></div>
1515
</div>
1616
</div>
1717
<div :class="$style.earRight">
1818
<div v-if="false" :class="$style.layer">
19-
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"/>
20-
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"/>
21-
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"/>
19+
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"></div>
20+
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"></div>
21+
<div :class="$style.plot" :style="{ backgroundImage: `url(${JSON.stringify(url)})` }"></div>
2222
</div>
2323
</div>
2424
</div>

packages/frontend-embed/src/components/EmImgWithBlurhash.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
55

66
<template>
77
<div ref="root" :class="['chromatic-ignore', $style.root, { [$style.cover]: cover }]" :title="title ?? ''">
8-
<canvas v-show="hide" key="canvas" ref="canvas" :class="$style.canvas" :width="canvasWidth" :height="canvasHeight" :title="title ?? undefined" tabindex="-1"/>
8+
<canvas v-show="hide" key="canvas" ref="canvas" :class="$style.canvas" :width="canvasWidth" :height="canvasHeight" :title="title ?? undefined" tabindex="-1"></canvas>
99
<img v-show="!hide" key="img" ref="img" :height="imgHeight ?? undefined" :width="imgWidth ?? undefined" :class="$style.img" :src="src ?? undefined" :title="title ?? undefined" :alt="alt ?? undefined" loading="eager" decoding="async" tabindex="-1"/>
1010
</div>
1111
</template>

packages/frontend/eslint.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ export default [
147147
'vue/return-in-computed-property': 'warn',
148148
'vue/no-setup-props-reactivity-loss': 'warn',
149149
'vue/max-attributes-per-line': 'off',
150-
'vue/html-self-closing': 'off',
150+
'vue/html-self-closing': ['error', {
151+
html: {
152+
void: 'any',
153+
normal: 'never',
154+
component: 'any',
155+
},
156+
svg: 'any',
157+
math: 'any',
158+
}],
151159
'vue/singleline-html-element-content-newline': 'off',
152160
'vue/v-on-event-hyphenation': ['error', 'never', {
153161
autofix: true,

packages/frontend/src/components/MkDialog.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ SPDX-License-Identifier: AGPL-3.0-only
2525
<MkInput v-if="input" v-model="inputValue" autofocus :type="input.type || 'text'" :placeholder="input.placeholder || undefined" :autocomplete="input.autocomplete" @keydown="onInputKeydown">
2626
<template v-if="input.type === 'password'" #prefix><i class="ti ti-lock"></i></template>
2727
<template #caption>
28-
<span v-if="okButtonDisabledReason === 'charactersExceeded'" v-text="i18n.tsx._dialog.charactersExceeded({ current: (inputValue as string)?.length ?? 0, max: input.maxLength ?? 'NaN' })"/>
29-
<span v-else-if="okButtonDisabledReason === 'charactersBelow'" v-text="i18n.tsx._dialog.charactersBelow({ current: (inputValue as string)?.length ?? 0, min: input.minLength ?? 'NaN' })"/>
28+
<span v-if="okButtonDisabledReason === 'charactersExceeded'" v-text="i18n.tsx._dialog.charactersExceeded({ current: (inputValue as string)?.length ?? 0, max: input.maxLength ?? 'NaN' })"></span>
29+
<span v-else-if="okButtonDisabledReason === 'charactersBelow'" v-text="i18n.tsx._dialog.charactersBelow({ current: (inputValue as string)?.length ?? 0, min: input.minLength ?? 'NaN' })"></span>
3030
</template>
3131
</MkInput>
3232
<MkSelect v-if="select" v-model="selectedValue" :items="selectDef" autofocus></MkSelect>

packages/frontend/src/components/MkDivider.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
1212
borderWidth ? { borderWidth: borderWidth } : {},
1313
borderColor ? { borderColor: borderColor } : {},
1414
]"
15-
/>
15+
></div>
1616
</template>
1717

1818
<script setup lang="ts">

packages/frontend/src/components/MkImgWithBlurhash.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
2525
draggable="false"
2626
tabindex="-1"
2727
style="-webkit-user-drag: none;"
28-
/>
28+
></canvas>
2929
<img
3030
v-show="!hide"
3131
key="img"

packages/frontend/src/components/MkInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
3333
@input="onInput"
3434
>
3535
<datalist v-if="datalist" :id="id">
36-
<option v-for="data in datalist" :key="data" :value="data"/>
36+
<option v-for="data in datalist" :key="data" :value="data"></option>
3737
</datalist>
3838
<div ref="suffixEl" :class="$style.suffix"><slot name="suffix"></slot></div>
3939
</div>

packages/frontend/src/components/MkNotification.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ SPDX-License-Identifier: AGPL-3.0-only
143143
<template v-else-if="notification.type === 'receiveFollowRequest'">
144144
<span :class="$style.text" style="opacity: 0.6;">{{ i18n.ts.receiveFollowRequest }}</span>
145145
<div v-if="full && !followRequestDone" :class="$style.followRequestCommands">
146-
<MkButton :class="$style.followRequestCommandButton" rounded primary @click="acceptFollowRequest()"><i class="ti ti-check"/> {{ i18n.ts.accept }}</MkButton>
147-
<MkButton :class="$style.followRequestCommandButton" rounded danger @click="rejectFollowRequest()"><i class="ti ti-x"/> {{ i18n.ts.reject }}</MkButton>
146+
<MkButton :class="$style.followRequestCommandButton" rounded primary @click="acceptFollowRequest()"><i class="ti ti-check"></i> {{ i18n.ts.accept }}</MkButton>
147+
<MkButton :class="$style.followRequestCommandButton" rounded danger @click="rejectFollowRequest()"><i class="ti ti-x"></i> {{ i18n.ts.reject }}</MkButton>
148148
</div>
149149
</template>
150150
<span v-else-if="notification.type === 'test'" :class="$style.text">{{ i18n.ts._notification.notificationWillBeDisplayedLikeThis }}</span>

packages/frontend/src/components/MkPagingButtons.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
1010
<div :class="$style.buttons">
1111
<div v-if="prevDotVisible" :class="$style.headTailButtons">
1212
<MkButton @click="onToHeadButtonClicked">{{ min }}</MkButton>
13-
<span class="ti ti-dots"/>
13+
<span class="ti ti-dots"></span>
1414
</div>
1515

1616
<MkButton
@@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
2222
</MkButton>
2323

2424
<div v-if="nextDotVisible" :class="$style.headTailButtons">
25-
<span class="ti ti-dots"/>
25+
<span class="ti ti-dots"></span>
2626
<MkButton @click="onToTailButtonClicked">{{ max }}</MkButton>
2727
</div>
2828
</div>

0 commit comments

Comments
 (0)