fix(pre-commit/prettier): configure formatter and apply

This commit is contained in:
jon r 2025-02-22 17:19:57 +01:00
parent 824b485416
commit 7f075bdfc6
15 changed files with 55 additions and 24 deletions

View File

@ -129,5 +129,16 @@
"workbox-precaching": "6.5.4", "workbox-precaching": "6.5.4",
"workbox-routing": "6.5.4", "workbox-routing": "6.5.4",
"workbox-strategies": "6.5.4" "workbox-strategies": "6.5.4"
},
"prettier": {
"bracketSameLine": false,
"bracketSpacing": true,
"embeddedLanguageFormatting": "off",
"htmlWhitespaceSensitivity": "strict",
"singleAttributePerLine": true,
"singleQuote": false,
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false
} }
} }

View File

@ -4,7 +4,7 @@ import Button from "~/components/ui/Button.vue"
</script> </script>
```ts ```ts
import Alert from "~/components/ui/Alert.vue"; import Alert from "~/components/ui/Alert.vue"
``` ```
# Alert # Alert

View File

@ -6,7 +6,7 @@ const click = ():Promise<void> => new Promise(resolve => setTimeout(resolve, 100
</script> </script>
```ts ```ts
import Button from "~/components/ui/Button.vue"; import Button from "~/components/ui/Button.vue"
``` ```
# Button # Button

View File

@ -10,7 +10,7 @@
</script> </script>
```ts ```ts
import Card from "~/components/ui/Card.vue"; import Card from "~/components/ui/Card.vue"
``` ```
# Card # Card
@ -356,6 +356,8 @@ Avoid adding buttons and links on top of a [linked card](#card-as-a-link). This
</Card> </Card>
``` ```
<!-- prettier-ignore-start -->
<Card full title="Linked card with interactive elements" <Card full title="Linked card with interactive elements"
to="./card.md" to="./card.md"
:tags="['rock', 'folk', 'punk']" :tags="['rock', 'folk', 'punk']"
@ -365,6 +367,8 @@ Avoid adding buttons and links on top of a [linked card](#card-as-a-link). This
<Link secondary to="./card.md" align-text="right">Open this file in a new window</Link> <Link secondary to="./card.md" align-text="right">Open this file in a new window</Link>
</Card> </Card>
<!-- prettier-ignore-end -->
Instead, use the [action area](#add-an-action) to offer the primary link: Instead, use the [action area](#add-an-action) to offer the primary link:
```vue-html ```vue-html
@ -380,6 +384,8 @@ Instead, use the [action area](#add-an-action) to offer the primary link:
</Card> </Card>
``` ```
<!-- prettier-ignore-start -->
<Card full title="Card with interactive elements" <Card full title="Card with interactive elements"
:tags="['rock', 'folk', 'punk']" :tags="['rock', 'folk', 'punk']"
icon="bi-check-lg large" icon="bi-check-lg large"
@ -391,6 +397,8 @@ Instead, use the [action area](#add-an-action) to offer the primary link:
</template> </template>
</Card> </Card>
<!-- prettier-ignore-end -->
## Add color ## Add color
- Choose a color: `default`, `primary`, `secondary`, `destructive`, or a Pastel (red, yellow, purple, green or blue) - Choose a color: `default`, `primary`, `secondary`, `destructive`, or a Pastel (red, yellow, purple, green or blue)

View File

@ -3,7 +3,7 @@
</script> </script>
```ts ```ts
import Heading from "~/components/ui/Heading.vue"; import Heading from "~/components/ui/Heading.vue"
``` ```
# Heading # Heading

View File

@ -16,7 +16,7 @@ const reset = () => { console.log("Hello"); value.value = 'Original value' }
</script> </script>
```ts ```ts
import Input from "~/components/ui/Input.vue"; import Input from "~/components/ui/Input.vue"
``` ```
# Input # Input

View File

@ -17,6 +17,7 @@ const noGap = ref(true)
```ts ```ts
import Layout from "~/components/ui/Layout.vue" import Layout from "~/components/ui/Layout.vue"
``` ```
# Layout # Layout
CSS provides [four methods to arrange items in a container](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Relationship_of_grid_layout_with_other_layout_methods): Flow, Columns, Flex and Grid. To make typical alignment tasks in the Funkwhale Ui easier, we have created a few useful presets. CSS provides [four methods to arrange items in a container](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Relationship_of_grid_layout_with_other_layout_methods): Flow, Columns, Flex and Grid. To make typical alignment tasks in the Funkwhale Ui easier, we have created a few useful presets.

View File

@ -31,7 +31,7 @@ const input = ref('Episcosaurus')
</script> </script>
```ts ```ts
import Modal from "~/components/ui/Modal.vue"; import Modal from "~/components/ui/Modal.vue"
``` ```
# Modal # Modal
@ -118,8 +118,10 @@ Note that the Cancel button has `autofocus`. If you want another button to auto-
Use the `icon` prop and/or the `#topleft` slot for indicators such as the user's photo or a search input. You can hide the title by setting it to `""`. Use the `icon` prop and/or the `#topleft` slot for indicators such as the user's photo or a search input. You can hide the title by setting it to `""`.
<!-- prettier-ignore-start -->
<Button primary @click="isOpen10 = true"> <Button primary @click="isOpen10 = true">
Open modal Open modal
</Button> </Button>
<Modal v-model="isOpen10" title="" icon="bi-info-circle"> <Modal v-model="isOpen10" title="" icon="bi-info-circle">
<template #topleft> <template #topleft>
@ -128,6 +130,7 @@ Use the `icon` prop and/or the `#topleft` slot for indicators such as the user's
No information pages found for <code>{{ input }}</code> No information pages found for <code>{{ input }}</code>
</Modal> </Modal>
<!-- prettier-ignore-end -->
## Add a main alert ## Add a main alert
@ -221,7 +224,7 @@ To visually distinguish the modal from standard modals
### Best Practices ### Best Practices
- Use the `destructive` prop sparingly - Use the `destructive` prop sparingly
- Clearly explain the consequences of the action unsing `<Alert red>` - Clearly explain the consequences of the action using `<Alert red>`
- Provide a clear way to cancel the action. If you use the `cancel` prop, the Cancel button will have autofocus, preventing accidental confirmation. - Provide a clear way to cancel the action. If you use the `cancel` prop, the Cancel button will have autofocus, preventing accidental confirmation.
- Use descriptive action button labels - Use descriptive action button labels
@ -258,6 +261,8 @@ Delete my account
</Modal> </Modal>
``` ```
<!-- prettier-ignore-start -->
<Button <Button
@click="isOpen4 = true" @click="isOpen4 = true"
destructive destructive
@ -285,6 +290,8 @@ Delete my account
</template> </template>
</Modal> </Modal>
<!-- prettier-ignore-end -->
</Layout> </Layout>
## Nested modals ## Nested modals

View File

@ -9,7 +9,7 @@ const isDeleted = computed(() => customTag.value==='' ? 'Pill was deleted' : '')
</script> </script>
```ts ```ts
import Pill from "~/components/ui/Pill.vue"; import Pill from "~/components/ui/Pill.vue"
``` ```
# Pill # Pill
@ -159,8 +159,8 @@ Image pills contain a small circular image on their left. These can be used for
Add `v-model="..."` to link the pill content to a `ref`. Add `v-model="..."` to link the pill content to a `ref`.
```ts ```ts
import { ref } from "vue"; import { ref } from "vue"
const customTag = ref("Custom Tag"); const customTag = ref("Custom Tag")
``` ```
```vue-html ```vue-html
@ -179,9 +179,13 @@ const customTag = ref("Custom Tag");
Edit the text, then hit Enter or click outside. The button will show the updated text. Edit the text, then hit Enter or click outside. The button will show the updated text.
<!-- prettier-ignore-start -->
<Button primary low-height <Button primary low-height
:disabled="customTag === ''" :disabled="customTag === ''"
:onClick="() => customTag = ''" :onClick="() => customTag = ''"
> >
Reset: {{ customTag }} Reset: {{ customTag }}
</Button> </Button>
<!-- prettier-ignore-end -->

View File

@ -29,7 +29,7 @@ const search = ref()
</script> </script>
```ts ```ts
import Pills from "~/components/ui/Pills.vue"; import Pills from "~/components/ui/Pills.vue"
``` ```
# Pills # Pills
@ -53,7 +53,7 @@ If you place custom pills into `others`, the user will be able to select, edit a
```ts ```ts
const nullModel = ref({ const nullModel = ref({
current: [], current: []
}); });
``` ```
@ -69,7 +69,7 @@ const nullModel = ref({
```ts ```ts
const staticModel = ref({ const staticModel = ref({
current: ["#Noise", "#FieldRecording", "#Experiment"], current: ["#Noise", "#FieldRecording", "#Experiment"]
}); });
``` ```
@ -88,7 +88,7 @@ Select a set of pills from presets, and add and remove custom ones
```ts ```ts
const interactiveModel = ref({ const interactiveModel = ref({
current: ["#Noise", "#FieldRecording", "#Experiment"], current: ["#Noise", "#FieldRecording", "#Experiment"],
others: ["#Melody", "#Rhythm"], others: ["#Melody", "#Rhythm"]
}); });
``` ```
@ -108,7 +108,7 @@ Use [reactive](https://vuejs.org/guide/essentials/reactivity-fundamentals.html#r
const customModel = ref({ const customModel = ref({
current: ["custom", "#FieldRecording", "#Experiment"], current: ["custom", "#FieldRecording", "#Experiment"],
others: ["#Melody", "#Rhythm"], others: ["#Melody", "#Rhythm"],
custom: ["custom"], custom: ["custom"]
}); });
``` ```

View File

@ -14,7 +14,7 @@ const option = ref<keyof typeof options>('pod')
</script> </script>
```ts ```ts
import Slider from "~/components/ui/Slider.vue"; import Slider from "~/components/ui/Slider.vue"
``` ```
# Slider # Slider
@ -28,7 +28,7 @@ Select a key from the `options` by setting `v-model`
const options = { const options = {
me: "Only I can find and edit this", me: "Only I can find and edit this",
pod: "Me and other users on the instance can find and edit this", pod: "Me and other users on the instance can find and edit this",
everyone: "Everyone can find and edit this", everyone: "Everyone can find and edit this"
} as const; } as const;
const option = ref<keyof typeof options>("me"); const option = ref<keyof typeof options>("me");

View File

@ -9,7 +9,7 @@ const search = ref('')
</script> </script>
```ts ```ts
import Tabs from "~/components/ui/Tabs.vue"; import Tabs from "~/components/ui/Tabs.vue"
``` ```
# Tabs # Tabs

View File

@ -14,7 +14,7 @@ const reset = () => { text.value = '' }
</script> </script>
```ts ```ts
import Textarea from "~/components/ui/Textarea.vue"; import Textarea from "~/components/ui/Textarea.vue"
``` ```
# Textarea # Textarea

View File

@ -31,7 +31,7 @@ Don't pollute the global namespace. Funkwhale compiles a single stylesheet (used
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const theme = ref({ const theme = ref({
color: "red", color: "red"
}); });
</script> </script>
@ -159,7 +159,7 @@ export const colorFromProps = (props: Record<string, unknown>) =>
Object.keys(props) Object.keys(props)
.filter(isColorProp) .filter(isColorProp)
.join(" ") .join(" ")
.replace("-", " ") as ColorSelector, .replace("-", " ") as ColorSelector
); );
```` ````