Skip to content

Commit 59d3f87

Browse files
committed
feat: biome as linter and formatter
1 parent 3816b43 commit 59d3f87

33 files changed

Lines changed: 615 additions & 383 deletions

.github/workflows/push.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ jobs:
2222
- name: 📦 Install dependencies
2323
run: npm ci
2424

25+
- name: 🔍 Run lint
26+
run: npm run lint
27+
2528
- name: 📝 Run unit tests
2629
run: npm run test

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"editor.tabSize": 2,
3-
"editor.formatOnSave": true
4-
}
2+
"editor.tabSize": 2,
3+
"editor.formatOnSave": true
4+
}

app.vue

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<script lang="ts" setup>
22
useHead({
3-
title: "🚌 ATM Milano Info Dashboard",
4-
meta: [
5-
{
6-
name: "description",
7-
content: "ATM Milano info & status dashboard webapp.",
8-
},
9-
{ name: "author", content: "Salvatore Laisa" },
10-
],
11-
link: [
12-
{
13-
rel: "icon",
14-
href: "https://www.atm.it/_layouts/atm/images/favicon.ico",
15-
type: "image/x-icon",
16-
},
17-
],
18-
htmlAttrs: {
19-
lang: "it-IT",
20-
"data-theme": "corporate",
21-
},
3+
title: "🚌 ATM Milano Info Dashboard",
4+
meta: [
5+
{
6+
name: "description",
7+
content: "ATM Milano info & status dashboard webapp.",
8+
},
9+
{ name: "author", content: "Salvatore Laisa" },
10+
],
11+
link: [
12+
{
13+
rel: "icon",
14+
href: "https://www.atm.it/_layouts/atm/images/favicon.ico",
15+
type: "image/x-icon",
16+
},
17+
],
18+
htmlAttrs: {
19+
lang: "it-IT",
20+
"data-theme": "corporate",
21+
},
2222
});
2323
</script>
2424

assets/css/tailwind.css

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
@import "tailwindcss";
22
@plugin "daisyui" {
3-
themes: corporate --default;
3+
themes: corporate --default;
44
}
55

66
@plugin "daisyui/theme" {
7-
name: "corporate";
8-
default: true;
9-
--color-primary: #f48325;
7+
name: "corporate";
8+
default: true;
9+
--color-primary: #f48325;
1010
}
1111

1212
@theme {
13-
--color-line-M1: #E31D1A;
14-
--color-line-M2: #638B18;
15-
--color-line-M3: #F6A704;
16-
--color-line-M4: #1F3E6D;
17-
--color-line-M5: #9778D3;
13+
--color-line-M1: #e31d1a;
14+
--color-line-M2: #638b18;
15+
--color-line-M3: #f6a704;
16+
--color-line-M4: #1f3e6d;
17+
--color-line-M5: #9778d3;
1818
}
1919

2020
/* === SAFELIST (ex safelist) === */
2121
@source inline("bg-line-{M1,M2,M3,M4,M5}");
2222
@source inline("color-primary");
23-
@source inline("bg-primary");
23+
@source inline("bg-primary");

biome.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.3.4/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "tab"
14+
},
15+
"linter": {
16+
"enabled": true,
17+
"rules": {
18+
"recommended": true
19+
}
20+
},
21+
"javascript": {
22+
"formatter": {
23+
"quoteStyle": "double"
24+
}
25+
},
26+
"assist": {
27+
"enabled": true,
28+
"actions": {
29+
"source": {
30+
"organizeImports": "on"
31+
}
32+
}
33+
},
34+
"css": {
35+
"parser": {
36+
"tailwindDirectives": true
37+
}
38+
},
39+
"overrides": [
40+
{
41+
"includes": ["**/*.vue"],
42+
"linter": {
43+
"rules": {
44+
"correctness": {
45+
"noUnusedImports": "off",
46+
"noUnusedVariables": "off"
47+
}
48+
}
49+
}
50+
},
51+
{
52+
"includes": ["assets/css/tailwind.css"],
53+
"css": {
54+
"linter": {
55+
"enabled": false
56+
}
57+
}
58+
}
59+
]
60+
}

components/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
type Props = {
3-
title: string;
3+
title: string;
44
};
55
66
const { title } = defineProps<Props>();

components/Status.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import type { LineStatus } from "../types/line";
44
const resource: string = "/api/status";
55
66
const lineClass = (line: string): string =>
7-
`badge badge-lg bg-line-${line} rounded-none border-0 w-10`;
7+
`badge badge-lg bg-line-${line} rounded-none border-0 w-10`;
88
99
const { data } = await useFetch<Array<LineStatus>>(resource);
1010
1111
const inactive: Array<string> = ["tratta sospesa", "rallentata"];
1212
1313
const notActive = (status: string): string =>
14-
inactive.includes(status.toLocaleLowerCase()) ? "font-bold" : "font-normal";
14+
inactive.includes(status.toLocaleLowerCase()) ? "font-bold" : "font-normal";
1515
1616
const isOK = (status: string): string =>
17-
status.toLocaleLowerCase() === "regolare" ? "🟩" : "🟥";
17+
status.toLocaleLowerCase() === "regolare" ? "🟩" : "🟥";
1818
</script>
1919

2020
<template>

components/StatusV1.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import type { LineStatus } from "../types/line";
55
const resource: string = "/api/v1/status";
66
77
const lineClass = (line: string): string =>
8-
`badge badge-lg bg-line-${line} rounded-none border-0 w-10`;
8+
`badge badge-lg bg-line-${line} rounded-none border-0 w-10`;
99
1010
const { status, data, error } = await useFetch<Array<LineStatus>>(resource);
1111
1212
const inactive: Array<string> = ["tratta sospesa", "rallentata"];
1313
const isPending = status.value === "pending";
1414
1515
const notActive = (status: string): string =>
16-
inactive.includes(status.toLocaleLowerCase()) ? "font-bold" : "font-normal";
16+
inactive.includes(status.toLocaleLowerCase()) ? "font-bold" : "font-normal";
1717
1818
if (error.value) console.error("ERROR from useFetch: ", error.value);
1919
</script>

components/__tests__/Card.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import { expect, test } from "vitest";
44
import Card from "../Card.vue";
55

66
test("<Card />", () => {
7-
const title = "Test title";
8-
const content = "Test content";
7+
const title = "Test title";
8+
const content = "Test content";
99

10-
const wrapper = mount(Card, {
11-
props: {
12-
title,
13-
},
14-
slots: {
15-
default: `<p>${content}</p>`,
16-
},
17-
});
10+
const wrapper = mount(Card, {
11+
props: {
12+
title,
13+
},
14+
slots: {
15+
default: `<p>${content}</p>`,
16+
},
17+
});
1818

19-
expect(wrapper.find("article").exists()).toBe(true);
20-
expect(wrapper.text()).toContain(title);
21-
expect(wrapper.text()).toContain(content);
19+
expect(wrapper.find("article").exists()).toBe(true);
20+
expect(wrapper.text()).toContain(title);
21+
expect(wrapper.text()).toContain(content);
2222
});

components/__tests__/Footer.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { expect, test } from "vitest";
44
import Footer from "../Footer.vue";
55

66
test("<Footer />", () => {
7-
const wrapper = mount(Footer);
8-
const year = new Date().getFullYear();
7+
const wrapper = mount(Footer);
8+
const year = new Date().getFullYear();
99

10-
expect(wrapper.html()).toMatchSnapshot();
10+
expect(wrapper.html()).toMatchSnapshot();
1111

12-
expect(wrapper.find("footer").exists()).toBe(true);
13-
expect(wrapper.text()).toContain(year);
12+
expect(wrapper.find("footer").exists()).toBe(true);
13+
expect(wrapper.text()).toContain(year);
1414
});

0 commit comments

Comments
 (0)