🌐 AI搜索 & 代理 主页
Skip to content

Commit 0b5fa5d

Browse files
committed
chore: lint docs
1 parent 1cc5393 commit 0b5fa5d

File tree

5 files changed

+32
-42
lines changed

5 files changed

+32
-42
lines changed

docs/1.getting-started/18.upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ However, to take advantage of improved type checking, you can opt in to the new
12381238
// ...
12391239
},
12401240
},
1241-
}
1241+
},
12421242
})
12431243
```
12441244

docs/2.guide/1.directory-structure/3.tsconfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ export default defineNuxtConfig({
6464
// ...
6565
},
6666
},
67-
}
67+
},
6868
})
6969
```

docs/3.api/2.composables/use-head-safe.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,6 @@ links:
1212

1313
The `useHeadSafe` composable is a wrapper around the [`useHead`](/docs/4.x/api/composables/use-head) composable that restricts the input to only allow safe values. This is the recommended way to manage head data when working with user input, as it prevents XSS attacks by sanitizing potentially dangerous attributes.
1414

15-
```vue [app/app.vue]
16-
<script setup lang="ts">
17-
useHeadSafe({
18-
script: [
19-
{ id: 'xss-script', innerHTML: 'alert("xss")' },
20-
],
21-
meta: [
22-
{ 'http-equiv': 'refresh', content: '0;javascript:alert(1)' },
23-
],
24-
})
25-
// Will safely generate
26-
// <script id="xss-script"></script>
27-
// <meta content="0;javascript:alert(1)">
28-
</script>
29-
```
30-
3115
::warning
3216
When using `useHeadSafe`, potentially dangerous attributes like `innerHTML` in scripts or `http-equiv` in meta tags are automatically stripped out to prevent XSS attacks. Use this composable whenever you're working with user-generated content.
3317
::
@@ -69,7 +53,7 @@ This composable does not return any value.
6953
```vue [app/pages/user-profile.vue]
7054
<script setup lang="ts">
7155
// User-generated content that might contain malicious code
72-
const userBio = ref('<script>alert("xss")</script>')
56+
const userBio = ref('<script>alert("xss")<' + '/script>')
7357
7458
useHeadSafe({
7559
title: `User Profile`,

docs/3.api/2.composables/use-head.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ The `useHead` composable allows you to manage your head tags in a programmatic a
1717
useHead({
1818
title: 'My App',
1919
meta: [
20-
{ name: 'description', content: 'My amazing site.' }
20+
{ name: 'description', content: 'My amazing site.' },
2121
],
2222
bodyAttrs: {
23-
class: 'test'
23+
class: 'test',
2424
},
25-
script: [{ innerHTML: 'console.log(\'Hello world\')' }]
25+
script: [{ innerHTML: 'console.log(\'Hello world\')' }],
2626
})
2727
</script>
2828
```
@@ -88,8 +88,8 @@ useHead({
8888
meta: [
8989
{ name: 'description', content: 'Learn more about our company' },
9090
{ property: 'og:title', content: 'About Us' },
91-
{ property: 'og:description', content: 'Learn more about our company' }
92-
]
91+
{ property: 'og:description', content: 'Learn more about our company' },
92+
],
9393
})
9494
</script>
9595
```
@@ -103,11 +103,11 @@ const profile = ref({ name: 'John Doe' })
103103
useHead({
104104
title: computed(() => profile.value.name),
105105
meta: [
106-
{
107-
name: 'description',
108-
content: computed(() => `Profile page for ${profile.value.name}`)
109-
}
110-
]
106+
{
107+
name: 'description',
108+
content: computed(() => `Profile page for ${profile.value.name}`),
109+
},
110+
],
111111
})
112112
</script>
113113
```
@@ -121,8 +121,8 @@ const count = ref(0)
121121
useHead(() => ({
122122
title: `Count: ${count.value}`,
123123
meta: [
124-
{ name: 'description', content: `Current count is ${count.value}` }
125-
]
124+
{ name: 'description', content: `Current count is ${count.value}` },
125+
],
126126
}))
127127
</script>
128128
```
@@ -135,15 +135,15 @@ useHead({
135135
link: [
136136
{
137137
rel: 'stylesheet',
138-
href: 'https://cdn.example.com/styles.css'
139-
}
138+
href: 'https://cdn.example.com/styles.css',
139+
},
140140
],
141141
script: [
142142
{
143143
src: 'https://cdn.example.com/script.js',
144-
async: true
145-
}
146-
]
144+
async: true,
145+
},
146+
],
147147
})
148148
</script>
149149
```
@@ -157,11 +157,11 @@ const isDark = ref(true)
157157
useHead({
158158
htmlAttrs: {
159159
lang: 'en',
160-
class: computed(() => isDark.value ? 'dark' : 'light')
160+
class: computed(() => isDark.value ? 'dark' : 'light'),
161161
},
162162
bodyAttrs: {
163-
class: 'themed-page'
164-
}
163+
class: 'themed-page',
164+
},
165165
})
166166
</script>
167167
```

docs/3.api/2.composables/use-lazy-async-data.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ const { status, data: posts } = await useLazyAsyncData('posts', () => $fetch('/a
2323
2424
<template>
2525
<div>
26-
<div v-if="status === 'pending'">Loading...</div>
27-
<div v-else-if="status === 'error'">Error loading posts</div>
28-
<div v-else>{{ posts }}</div>
26+
<div v-if="status === 'pending'">
27+
Loading...
28+
</div>
29+
<div v-else-if="status === 'error'">
30+
Error loading posts
31+
</div>
32+
<div v-else>
33+
{{ posts }}
34+
</div>
2935
</div>
3036
</template>
3137
```

0 commit comments

Comments
 (0)