Skip to content
Snippets Groups Projects
Commit 6a741c86 authored by Mathieu Dartigues's avatar Mathieu Dartigues
Browse files

fix: Correction des erreurs de lint

parent 89fca773
Branches
No related tags found
1 merge request!6Ajout de la CI/CD
...@@ -3,14 +3,39 @@ require('@rushstack/eslint-patch/modern-module-resolution') ...@@ -3,14 +3,39 @@ require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = { module.exports = {
root: true, root: true,
'extends': ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-typescript', '@vue/eslint-config-prettier/skip-formatting', 'plugin:storybook/recommended'], extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting',
'plugin:storybook/recommended'
],
rules: {
/**
* Allow unused vars starting with `_` character
* useful for destructuring eg.
*/
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
parserOptions: { parserOptions: {
ecmaVersion: 'latest' ecmaVersion: 'latest'
}, },
overrides: [ overrides: [
{ {
files: ['pages/**/*.vue'], files: [
extends: ['vue/multi-word-component-names'], 'src/pages/**/*.vue'
],
rules: {
'vue/multi-word-component-names': 'off'
}
} }
], ],
} }
...@@ -2,7 +2,6 @@ import type { Meta, StoryObj } from '@storybook/vue3' ...@@ -2,7 +2,6 @@ import type { Meta, StoryObj } from '@storybook/vue3'
import { fn } from '@storybook/test'; import { fn } from '@storybook/test';
import OcTree from './OcTree.vue' import OcTree from './OcTree.vue'
import type { OcTreeNode } from '@/declarations'
const meta: Meta<typeof OcTree> = { const meta: Meta<typeof OcTree> = {
component: OcTree component: OcTree
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
</nav> </nav>
<div class="w-11/12 md:w-10/12 lg:w-9/12 xl:w-7/12 mx-auto mb-10 flex flex-col items-start"> <div class="w-11/12 md:w-10/12 lg:w-9/12 xl:w-7/12 mx-auto mb-10 flex flex-col items-start">
<p class="text-4xl text-white font-bold mb-8"> <p class="text-4xl text-white font-bold mb-8">
{{ $t('home.catchphrase.1') }} {{ t('home.catchphrase.1') }}
<br /> <br />
{{ $t('home.catchphrase.2') }} {{ t('home.catchphrase.2') }}
</p> </p>
<IconField class="w-full"> <IconField class="w-full">
<InputText class="rounded-full border-none w-full" /> <InputText class="rounded-full border-none w-full" />
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
<div class="w-11/12 md:w-10/12 lg:w-9/12 xl:w-7/12 mx-auto mb-10"> <div class="w-11/12 md:w-10/12 lg:w-9/12 xl:w-7/12 mx-auto mb-10">
<p class="font-bold mb-4 text-center text-xl">{{ $t('communities') }}</p> <p class="font-bold mb-4 text-center text-xl">{{ $t('communities') }}</p>
<div class="flex justify-center flex-wrap gap-4"> <div class="flex justify-center flex-wrap gap-4">
<OcCardCommunity v-for="community in communityStore.state.data" :community='community' /> <OcCardCommunity
v-for="(community, index) in communityStore.state.data"
:key="'community-' + index"
:community='community'
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -32,6 +36,7 @@ ...@@ -32,6 +36,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n'
import InputText from 'primevue/inputtext'; import InputText from 'primevue/inputtext';
import IconField from 'primevue/iconfield'; import IconField from 'primevue/iconfield';
...@@ -43,6 +48,7 @@ import { useCommunityStore } from '@/stores/community'; ...@@ -43,6 +48,7 @@ import { useCommunityStore } from '@/stores/community';
const accountStore = useAccountStore() const accountStore = useAccountStore()
const communityStore = useCommunityStore() const communityStore = useCommunityStore()
const { t } = useI18n()
onMounted(() => { onMounted(() => {
communityStore.fetchIfEmpty() communityStore.fetchIfEmpty()
......
import i18n from '@/i18n' import i18n from '@/i18n'
import { createRouter, createWebHistory, isNavigationFailure, NavigationFailureType } from 'vue-router' import {
createRouter,
createWebHistory,
} from 'vue-router'
import { routes } from 'vue-router/auto-routes' import { routes } from 'vue-router/auto-routes'
import { useAccountStore } from './stores/account' import { useAccountStore } from './stores/account'
import { isAuthenticated, getProfileInfos } from './sparql/connection' import { checkIsAuthenticated, getProfileInfos } from './sparql/connection'
const router = createRouter({ const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes: [ routes: [
{ {
path: '/', path: '/',
redirect: to => { redirect() {
const language = navigator.language.split('-')[0] as typeof i18n.global.locale.value const language = navigator.language.split('-')[0] as typeof i18n.global.locale.value
if (i18n.global.availableLocales.includes(language)) { if (i18n.global.availableLocales.includes(language)) {
return { path: `/${language}` } return { path: `/${language}` }
...@@ -48,23 +51,22 @@ router.beforeResolve((to) => { ...@@ -48,23 +51,22 @@ router.beforeResolve((to) => {
/** /**
* Handle authentification. * Handle authentification.
*/ */
router.beforeEach(async (to) => { async function retrieveProfileIfAuthenticated() {
const accountStore = useAccountStore() const accountStore = useAccountStore()
new Promise(async (resolve) => { if (accountStore.isAuthenticated === undefined) {
if (accountStore.isAuthenticated === undefined) { accountStore.isAuthenticated = await checkIsAuthenticated()
accountStore.isAuthenticated = await isAuthenticated() }
}
if (accountStore.isAuthenticated && (accountStore.profile === null)) {
const { infos, profile } = await getProfileInfos()
accountStore.profile = profile
accountStore.infos = infos
}
resolve(accountStore.isAuthenticated) }
}).then(async (isAuthenticated) => {
if (isAuthenticated && (accountStore.profile === null)) {
const { infos, profile } = await getProfileInfos()
accountStore.profile = profile router.beforeEach(retrieveProfileIfAuthenticated)
accountStore.infos = infos
}
})
})
export default router export default router
...@@ -2,7 +2,7 @@ import { getMemberInfos, getMemberProfile } from "./members" ...@@ -2,7 +2,7 @@ import { getMemberInfos, getMemberProfile } from "./members"
import { executeSparqlInsert } from "./sparql" import { executeSparqlInsert } from "./sparql"
// import DigestClient from "digest-fetch" // import DigestClient from "digest-fetch"
export async function connect(username: string, password: string) { export async function connect(/* username: string, password: string */) {
// await fetch( // await fetch(
// `${import.meta.env.VITE_OC_BASE_URL}/sparql-auth`, // `${import.meta.env.VITE_OC_BASE_URL}/sparql-auth`,
// { // {
...@@ -36,7 +36,7 @@ export async function connect(username: string, password: string) { ...@@ -36,7 +36,7 @@ export async function connect(username: string, password: string) {
return response.status === 200 return response.status === 200
} }
export async function isAuthenticated() { export async function checkIsAuthenticated() {
const response = await fetch( const response = await fetch(
`${import.meta.env.VITE_OC_BASE_URL}/sparql-auth`, `${import.meta.env.VITE_OC_BASE_URL}/sparql-auth`,
{ {
......
...@@ -37,7 +37,7 @@ export async function executeSparqlConstruct<T>( ...@@ -37,7 +37,7 @@ export async function executeSparqlConstruct<T>(
// The lines below are here to normalize this. // The lines below are here to normalize this.
const graph: T[] = [] const graph: T[] = []
if (compacted['@graph'] === undefined) { if (compacted['@graph'] === undefined) {
let { ['@context']: _, ...data } = compacted; const { ['@context']: _, ...data } = compacted;
graph.push(data as T) graph.push(data as T)
} else { } else {
graph.push(...(compacted['@graph'] as Iterable<T>)) graph.push(...(compacted['@graph'] as Iterable<T>))
......
/* eslint-disable */
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
const colors = require('tailwindcss/colors') const colors = require('tailwindcss/colors')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment