Skip to content

Commit

Permalink
🏗️ Setup Biome
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbertrand committed Nov 18, 2024
1 parent 5972225 commit bcd736d
Show file tree
Hide file tree
Showing 39 changed files with 201 additions and 188 deletions.
9 changes: 3 additions & 6 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:js-app",
":automergeMinor"
]
}
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:js-app", ":automergeMinor"]
}
7 changes: 7 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignoreUnknown": false,
"ignore": [".nuxt"]
}
}
2 changes: 1 addition & 1 deletion components/ProgrammeDetails.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { Programme } from '~/server/types.js';
import type { Programme } from "~/server/types.js";
defineProps<{ programme: Programme; shouldPreload: boolean }>();
</script>
Expand Down
42 changes: 22 additions & 20 deletions components/ProgrammeSummary.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
<script setup lang="ts">
import type { Programme } from '~/server/types.js';
import type { Programme } from "~/server/types.js";
// biome-ignore lint/suspicious/noExplicitAny: generic function
function deepToRaw<T extends Record<string, any>>(sourceObj: T): T {
const objectIterator = (input: any): any => {
if (Array.isArray(input)) {
return input.map((item) => objectIterator(item));
}
if (isRef(input) || isReactive(input) || isProxy(input)) {
return objectIterator(toRaw(input));
}
if (input && typeof input === 'object') {
return Object.keys(input).reduce((acc, key) => {
acc[key as keyof typeof acc] = objectIterator(input[key]);
return acc;
}, {} as T);
}
return input;
};
// biome-ignore lint/suspicious/noExplicitAny: generic function
const objectIterator = (input: any): any => {
if (Array.isArray(input)) {
return input.map((item) => objectIterator(item));
}
if (isRef(input) || isReactive(input) || isProxy(input)) {
return objectIterator(toRaw(input));
}
if (input && typeof input === "object") {
return Object.keys(input).reduce((acc, key) => {
acc[key as keyof typeof acc] = objectIterator(input[key]);
return acc;
}, {} as T);
}
return input;
};
return objectIterator(sourceObj);
return objectIterator(sourceObj);
}
const { programme } = defineProps<{
programme: Programme;
shouldPreload: boolean;
shouldLazyLoad: boolean;
programme: Programme;
shouldPreload: boolean;
shouldLazyLoad: boolean;
}>();
const historyUnsafeProgramme = deepToRaw(programme);
Expand Down
4 changes: 2 additions & 2 deletions components/logo/Arte.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/BfmTv.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/C8.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/CNews.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/CStar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/CanalPlus.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/France2.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/France3.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/France4.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/France5.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/Lcp.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/M6.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/Nrj12.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/Tf1.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/Tfx.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/Tmc.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/logo/W9.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
withDefaults(defineProps<{ width?: number; height?: number }>(), {
width: 80,
height: 80,
width: 80,
height: 80,
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/programme/Categories.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
defineProps<{
categories: string[];
categories: string[];
}>();
function getCategoryClass(category: string) {
return `category--${category.replaceAll(/ /g, '-').toLowerCase()}`;
return `category--${category.replaceAll(/ /g, "-").toLowerCase()}`;
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion components/programme/Channel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
defineProps<{
channel: string;
channel: string;
}>();
</script>

Expand Down
6 changes: 3 additions & 3 deletions components/programme/Cover.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import type { Icon } from '~/server/types.js';
import type { Icon } from "~/server/types.js";
const props = defineProps<{
icon: Icon[];
preload: boolean;
icon: Icon[];
preload: boolean;
}>();
</script>

Expand Down
20 changes: 10 additions & 10 deletions components/programme/EpisodeNumber.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<script setup lang="ts">
import type { EpisodeNumber } from '~/server/types.js';
import type { EpisodeNumber } from "~/server/types.js";
const props = defineProps<{
episodeNum: EpisodeNumber[];
episodeNum: EpisodeNumber[];
}>();
function getEpisodeNumber(episodeNum: EpisodeNumber[]) {
if (episodeNum && episodeNum.length > 0) {
const onscreenEpisodeNum = episodeNum.find(
({ system }) => system === 'onscreen'
);
if (episodeNum && episodeNum.length > 0) {
const onscreenEpisodeNum = episodeNum.find(
({ system }) => system === "onscreen",
);
if (onscreenEpisodeNum !== undefined) {
return onscreenEpisodeNum._value;
}
}
if (onscreenEpisodeNum !== undefined) {
return onscreenEpisodeNum._value;
}
}
}
const episodeNumber = getEpisodeNumber(props.episodeNum);
Expand Down
8 changes: 4 additions & 4 deletions components/programme/LargeCover.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import type { Icon } from '~/server/types.js';
import type { Icon } from "~/server/types.js";
defineProps<{
icon: Icon[];
preload: boolean;
lazyLoad: boolean;
icon: Icon[];
preload: boolean;
lazyLoad: boolean;
}>();
</script>

Expand Down
4 changes: 2 additions & 2 deletions components/programme/Progress.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
const props = defineProps<{
start: string;
stop: string;
start: string;
stop: string;
}>();
const $start = new Date(props.start);
Expand Down
6 changes: 3 additions & 3 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
useHead({
htmlAttrs: {
lang: 'fr',
},
htmlAttrs: {
lang: "fr",
},
});
</script>

Expand Down
Loading

0 comments on commit bcd736d

Please sign in to comment.