Skip to content

Commit f401d0c

Browse files
Benoit NgoNgob
Benoit Ngo
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
}

apps/front/src/composables/useAppFetch.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import type { UseFetchOptions } from 'nuxt/app';
2-
import { defu } from 'defu';
3-
import { $Fetch, NitroFetchRequest } from 'nitropack';
1+
import type { UseFetchOptions } from "nuxt/app";
2+
import { defu } from "defu";
3+
import { $Fetch, NitroFetchRequest } from "nitropack";
44

5-
export default function useAppFetch<T> (url: string | Request | Ref<string | Request> | (() => string | Request), options: UseFetchOptions<T> = {}) {
5+
export default function useAppFetch<T>(
6+
url: string | Request | Ref<string | Request> | (() => string | Request),
7+
options: UseFetchOptions<T> = {}
8+
) {
69
const { $appFetch } = useNuxtApp();
710
const defaults: UseFetchOptions<T> = {
8-
$fetch: $appFetch as $Fetch<unknown, NitroFetchRequest>
11+
$fetch: $appFetch as $Fetch<unknown, NitroFetchRequest>,
912
};
1013

1114
// for nice deep defaults, please use unjs/defu

apps/front/src/layouts/anonymous.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<div>
33
<slot />
44
</div>
5-
</template>;
5+
</template>
6+
;

apps/front/src/layouts/default.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
</div>
1515
</div>
1616
</div>
17-
</template>;
17+
</template>
18+
;

apps/front/src/middleware/auth.global.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useAuthUser } from '~/store/auth';
1+
import { useAuthUser } from "~/store/auth";
22

33
export default defineNuxtRouteMiddleware(async () => {
44
const authStore = useAuthUser();
@@ -13,7 +13,8 @@ export default defineNuxtRouteMiddleware(async () => {
1313
* If we want to speed up a bit the process, we could check the status of the syncMe request,
1414
* to know if it has been done once aka if (authStore.hasBeenLoadedOnce)
1515
* */
16-
const shouldWait = process.server || (!authStore.isAuthenticated && process.client);
16+
const shouldWait =
17+
process.server || (!authStore.isAuthenticated && process.client);
1718
if (!shouldWait) {
1819
return;
1920
}

apps/front/src/pages/auth/login.vue

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,18 @@
22
<div>
33
<div v-if="!authStore.isAuthenticated">
44
<h1>Welcome to the login page</h1>
5-
<label for="email">
6-
email
7-
</label>
8-
<input
9-
v-model="email"
10-
name="email"
11-
type="text"
12-
>
13-
<button
14-
type="submit"
15-
@click="submitAuthenticateUser"
16-
>
17-
Log-in
18-
</button>
5+
<label for="email"> email </label>
6+
<input v-model="email" name="email" type="text" />
7+
<button type="submit" @click="submitAuthenticateUser">Log-in</button>
198
</div>
209
</div>
2110
</template>
2211
<script setup lang="ts">
23-
import { ref } from 'vue';
24-
import { useAuthUser } from '~/store/auth';
12+
import { ref } from "vue";
13+
import { useAuthUser } from "~/store/auth";
2514
2615
definePageMeta({
27-
layout: 'anonymous'
16+
layout: "anonymous",
2817
});
2918
3019
const authStore = useAuthUser();
@@ -38,8 +27,8 @@ const authStore = useAuthUser();
3827
* It only becomes an issue when your ref relies on state from the server,
3928
* such as a header from the request, or data fetched during the server-rendering process.
4029
* * */
41-
const email = ref('user@kb.com');
30+
const email = ref("user@kb.com");
4231
const submitAuthenticateUser = async () => {
43-
await authStore.authenticateUser(email.value, '');
32+
await authStore.authenticateUser(email.value, "");
4433
};
4534
</script>

apps/front/src/pages/demo/page1.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
<template>
22
<div>
33
Page 1
4-
<img
5-
src="~/assets/images/panda.webp"
6-
alt="Discover Pandas"
7-
>
8-
<div class="panda-background">
9-
This is to discover background scss
10-
</div>
4+
<img src="~/assets/images/panda.webp" alt="Discover Pandas" />
5+
<div class="panda-background">This is to discover background scss</div>
116
</div>
127
</template>
138
<script lang="ts" setup>
14-
logger.info('page 1');
9+
logger.info("page 1");
1510
</script>
1611
<style lang="scss" scoped>
1712
.panda-background {
1813
color: $white;
1914
width: 200px;
2015
height: 200px;
21-
background-image: url('~/assets/images/true-panda.jpeg');
16+
background-image: url("~/assets/images/true-panda.jpeg");
2217
background-size: contain;
2318
background-repeat: no-repeat;
2419
}

apps/front/src/pages/demo/page2.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
</div>
88
</template>
99
<script lang="ts" setup>
10-
import { useHealthCheckFetch } from '~/composables/api/healthCheck/useHealthCheckFetch';
10+
import { useHealthCheckFetch } from "~/composables/api/healthCheck/useHealthCheckFetch";
1111
12-
const {
13-
data
14-
} = await useHealthCheckFetch();
12+
const { data } = await useHealthCheckFetch();
1513
</script>

apps/front/src/pages/demo/page3.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<template>
22
<div>Page 3</div>
3-
</template>;
3+
</template>
4+
;

apps/front/src/pages/demo/page4.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<template>
22
<div>Page 4</div>
3-
</template>;
3+
</template>
4+
;

apps/front/src/pages/demo/page5.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<template>
22
<div>Page 5</div>
3-
</template>;
3+
</template>
4+
;

apps/front/src/pages/demo/page6.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<template>
22
<div>Page 6</div>
3-
</template>;
3+
</template>
4+
;

0 commit comments

Comments
 (0)