Skip to content

Commit f401d0c

Browse files
Benoit NgoNgob
authored andcommitted
Adding prettier config
1 parent 25f4730 commit f401d0c

File tree

28 files changed

+190
-1138
lines changed

28 files changed

+190
-1138
lines changed

apps/front/.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
root: true,
44
extends: [
55
"@nuxt/eslint-config",
6+
'plugin:prettier/recommended'
67
// "plugin:vue/vue3-recommended"
78
],
89
rules: {

apps/front/nuxt.config.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22
export default defineNuxtConfig({
3-
srcDir: 'src/',
4-
modules: [
5-
'@pinia/nuxt'
6-
],
3+
srcDir: "src/",
4+
modules: ["@pinia/nuxt"],
75
runtimeConfig: {
8-
API_URL: process.env.API_URL || ''
6+
API_URL: process.env.API_URL || "",
97
},
108
app: {
11-
129
head: {
1310
// @see https://getbootstrap.com/docs/5.0/getting-started/introduction/#starter-template
14-
charset: 'utf-8',
15-
viewport: 'width=device-width, initial-scale=1',
16-
title: 'KB Backbone',
11+
charset: "utf-8",
12+
viewport: "width=device-width, initial-scale=1",
13+
title: "KB Backbone",
1714
meta: [
1815
// <meta name="description" content="My amazing site">
1916
// { name: 'description', content: 'My amazing site.' }
20-
]
21-
}
17+
],
18+
},
2219
},
23-
css: [
24-
'@/assets/styles/main.scss'
25-
],
20+
css: ["@/assets/styles/main.scss"],
2621
vite: {
2722
css: {
2823
preprocessorOptions: {
2924
scss: {
30-
additionalData: '@import "@/assets/styles/_functions.scss";@import "@/assets/styles/_variables.scss";@import "@/assets/styles/_mixins.scss";'
31-
}
32-
}
33-
}
34-
}
25+
additionalData:
26+
'@import "@/assets/styles/_functions.scss";@import "@/assets/styles/_variables.scss";@import "@/assets/styles/_mixins.scss";',
27+
},
28+
},
29+
},
30+
},
3531
// ssr: false
36-
3732
});

apps/front/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
"@rushstack/eslint-patch": "^1.3.0",
1515
"@types/http-proxy": "^1.17.11",
1616
"@types/lodash": "^4.14.195",
17-
"@typescript-eslint/eslint-plugin": "^5.59.7",
1817
"eslint": "^8.41.0",
18+
"eslint-config-prettier": "^8.8.0",
19+
"eslint-plugin-prettier": "^4.2.1",
1920
"pino-pretty": "^10.0.0",
2021
"typescript": "^5.0.4",
2122
"vue-tsc": "^1.6.5"
2223
},
2324
"dependencies": {
24-
"@nuxtjs/eslint-config-typescript": "^12.0.0",
2525
"bootstrap": "^5.2.3",
2626
"defu": "^6.1.2",
2727
"h3": "^1.6.6",

apps/front/src/app.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,33 @@
88
</div>
99
</template>
1010
<script setup lang="ts">
11-
import { watchEffect } from 'vue';
12-
import { useAuthUser } from '~/store/auth';
11+
import { watchEffect } from "vue";
12+
import { useAuthUser } from "~/store/auth";
1313
1414
const authStore = useAuthUser();
1515
1616
const route = useRoute();
1717
1818
const mHandleError = (e: unknown) => {
19-
logger.error('Primary error boundary', e);
19+
logger.error("Primary error boundary", e);
2020
};
2121
const isPendingValue = computed(() => authStore.isPending);
2222
// Doing this here instead than in the middleware allow reactivity on the auth user
2323
watchEffect(async () => {
2424
if (isPendingValue.value) {
2525
return;
2626
}
27-
const shouldRedirectToLogin = !authStore.isAuthenticated && authStore.authUrl && route.name !== 'auth-login';
27+
const shouldRedirectToLogin =
28+
!authStore.isAuthenticated &&
29+
authStore.authUrl &&
30+
route.name !== "auth-login";
2831
if (shouldRedirectToLogin) {
2932
await navigateTo(authStore.authUrl, { external: true });
3033
}
31-
const shouldRedirectToHomepage = authStore.isAuthenticated && route.name === 'auth-login';
34+
const shouldRedirectToHomepage =
35+
authStore.isAuthenticated && route.name === "auth-login";
3236
if (shouldRedirectToHomepage) {
33-
await navigateTo('/');
37+
await navigateTo("/");
3438
}
3539
});
3640
</script>
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<template>
22
<div class="row justify-content-end py-2 mb-2">
33
<div class="col-2">
4-
<p v-if="username">
5-
Welcome {{ username }}
6-
</p>
4+
<p v-if="username">Welcome {{ username }}</p>
75
</div>
86
</div>
97
</template>
108
<script setup lang="ts">
119
// import {} from "s"
12-
import { useAuthUser } from '~/store/auth';
10+
import { useAuthUser } from "~/store/auth";
1311
1412
const authStore = useAuthUser();
1513
16-
const username = authStore.authUser?.username || '';
14+
const username = authStore.authUser?.username || "";
1715
</script>

apps/front/src/components/layout/menu/AppMenu.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
<div
33
class="d-flex flex-sm-column flex-row flex-nowrap bg-light align-items-center sticky-top"
44
>
5-
<NuxtLink
6-
to="/"
7-
class="d-block p-3 link-dark text-decoration-none"
8-
>
5+
<NuxtLink to="/" class="d-block p-3 link-dark text-decoration-none">
96
<icons1-square-fill />
107
</NuxtLink>
118
<ul
@@ -37,5 +34,5 @@
3734
<script setup lang="ts">
3835
// Credit to https://dev.to/codeply/bootstrap-5-sidebar-examples-38pb
3936
// Another interesting ressource https://www.codeply.com/p/yE87h7irNi/icons-text
40-
import MenuItem from './MenuItem.vue';
37+
import MenuItem from "./MenuItem.vue";
4138
</script>

apps/front/src/components/layout/menu/MenuItem.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<template>
22
<li class="nav-item">
3-
<NuxtLink
4-
v-bind="$attrs"
5-
class="nav-link py-3 px-2"
6-
>
3+
<NuxtLink v-bind="$attrs" class="nav-link py-3 px-2">
74
<slot />
85
</NuxtLink>
96
</li>

apps/front/src/composables/api/auth/useLogin.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
import { Me } from './useMe';
1+
import { Me } from "./useMe";
22

3-
export default function useLogin (): (email: string, password: string | undefined) => Promise<Me> {
3+
export default function useLogin(): (
4+
email: string,
5+
password: string | undefined
6+
) => Promise<Me> {
47
const { $appFetch } = useNuxtApp();
58
return async (email: string, password: string | undefined) => {
6-
const response = await $appFetch<Me>('/api/1.0/auth/sso/saml2/login', {
7-
method: 'post',
9+
const response = await $appFetch<Me>("/api/1.0/auth/sso/saml2/login", {
10+
method: "post",
811
body: {
912
username: email,
10-
password
11-
}
13+
password,
14+
},
1215
});
1316
if (!response) {
14-
throw createError('/api/1.0/auth/sso/saml2/login has an empty body, the profile (me) should be returned');
17+
throw createError(
18+
"/api/1.0/auth/sso/saml2/login has an empty body, the profile (me) should be returned"
19+
);
1520
}
1621
return response;
1722
};

apps/front/src/composables/api/auth/useMe.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ export interface Me {
22
username: string;
33
}
44

5-
export default function useMe (): () => Promise<Me> {
5+
export default function useMe(): () => Promise<Me> {
66
const { $appFetch } = useNuxtApp();
77
return async () => {
8-
const res = await $appFetch<Me>('/api/1.0/auth/me');
8+
const res = await $appFetch<Me>("/api/1.0/auth/me");
99
if (!res) {
10-
throw createError('/api/1.0/auth/me has an empty body');
10+
throw createError("/api/1.0/auth/me has an empty body");
1111
}
1212
return res;
1313
};
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { FetchError } from 'ofetch';
2-
import { AsyncData } from '#app';
3-
import useAppFetch from '~/composables/useAppFetch';
1+
import { FetchError } from "ofetch";
2+
import { AsyncData } from "#app";
3+
import useAppFetch from "~/composables/useAppFetch";
44

55
interface LoggedHealthCheckResponse {
6-
success: string
6+
success: string;
77
}
8-
export function useHealthCheckFetch (): AsyncData<LoggedHealthCheckResponse | null, FetchError | null> {
8+
export function useHealthCheckFetch(): AsyncData<
9+
LoggedHealthCheckResponse | null,
10+
FetchError | null
11+
> {
912
return useAppFetch<LoggedHealthCheckResponse>(
10-
() => '/api/1.0/healthcheck/logged'
13+
() => "/api/1.0/healthcheck/logged"
1114
);
1215
}

0 commit comments

Comments
 (0)