style: fix linting issues met Prettier

This commit is contained in:
Lint Action 2025-03-04 20:46:27 +00:00
parent 3a68fb3913
commit 5edf23c767
7 changed files with 35 additions and 24 deletions

View file

@ -17,7 +17,6 @@ strengths:
name: Matthias and Bruno name: Matthias and Bruno
affiliation: Grade 10 affiliation: Grade 10
curricula_page: curricula_page:
title: Our teaching topics title: Our teaching topics
read_more: Read more read_more: Read more

View file

@ -10,7 +10,7 @@ strengths:
research_based_text: Alle lespakketten van Dwengo vzw zijn gebaseerd op gedegen wetenschappelijk onderzoek. research_based_text: Alle lespakketten van Dwengo vzw zijn gebaseerd op gedegen wetenschappelijk onderzoek.
inclusive_text: We richten ons op alle kinderen en jongeren met een specifieke aandacht voor het evenwicht tussen meisjes en jongens en leerlingen uit kansengroepen. inclusive_text: We richten ons op alle kinderen en jongeren met een specifieke aandacht voor het evenwicht tussen meisjes en jongens en leerlingen uit kansengroepen.
socially_relevant_text: We zoeken projecten uit die passen binnen de actualiteit en maatschappelijke thema's. socially_relevant_text: We zoeken projecten uit die passen binnen de actualiteit en maatschappelijke thema's.
summary: "" summary: ''
main: Al onze pakketten zijn gebruiksvriendelijk, maatschappelijk relevant, wetenschappelijk onderbouwd, én inclusief. Leerkrachten over de hele wereld gingen hiermee reeds aan de slag. Jij ook? Verken de lesthema's op onze website! main: Al onze pakketten zijn gebruiksvriendelijk, maatschappelijk relevant, wetenschappelijk onderbouwd, én inclusief. Leerkrachten over de hele wereld gingen hiermee reeds aan de slag. Jij ook? Verken de lesthema's op onze website!
quote: quote:
text: Je maakt iets praktisch, je leert werken met hardware en je kan zelf iets nieuws creëren. text: Je maakt iets praktisch, je leert werken met hardware en je kan zelf iets nieuws creëren.

View file

@ -1,6 +1,6 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { themes } from '../data/themes.js'; import { themes } from '../data/themes.js';
import { loadTranslations } from "../util/translationHelper.js"; import { loadTranslations } from '../util/translationHelper.js';
import { FALLBACK_LANG } from '../config.js'; import { FALLBACK_LANG } from '../config.js';
interface Translations { interface Translations {

View file

@ -24,11 +24,20 @@ import { Answer } from './entities/questions/answer.entity.js';
import { Question } from './entities/questions/question.entity.js'; import { Question } from './entities/questions/question.entity.js';
const entities = [ const entities = [
User, Student, Teacher, User,
Assignment, Group, Submission, Student,
Class, ClassJoinRequest, TeacherInvitation, Teacher,
Attachment, LearningObject, LearningPath, Assignment,
Answer, Question Group,
Submission,
Class,
ClassJoinRequest,
TeacherInvitation,
Attachment,
LearningObject,
LearningPath,
Answer,
Question,
]; ];
function config(testingMode: boolean = false): Options { function config(testingMode: boolean = false): Options {
@ -41,7 +50,9 @@ function config(testingMode: boolean = false): Options {
// Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION) // Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION)
// (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint) // (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint)
dynamicImportProvider: (id) => {return import(id)}, dynamicImportProvider: (id) => {
return import(id);
},
}; };
} }
return { return {

View file

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import yaml from 'js-yaml'; import yaml from 'js-yaml';
import {FALLBACK_LANG} from "../../config"; import { FALLBACK_LANG } from '../../config';
export function loadTranslations<T>(language: string): T { export function loadTranslations<T>(language: string): T {
try { try {
@ -13,7 +13,11 @@ export function loadTranslations<T>(language: string): T {
`Cannot load translation for ${language}, fallen back to dutch` `Cannot load translation for ${language}, fallen back to dutch`
); );
console.error(error); console.error(error);
const fallbackPath = path.join(process.cwd(), '_i18n', `${FALLBACK_LANG}.yml`); const fallbackPath = path.join(
process.cwd(),
'_i18n',
`${FALLBACK_LANG}.yml`
);
return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T; return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T;
} }
} }

View file

@ -14,7 +14,5 @@
* <img :src="convertBase64ToImageSrc(base64String)" alt="Learning Path Image" /> * <img :src="convertBase64ToImageSrc(base64String)" alt="Learning Path Image" />
*/ */
export function convertBase64ToImageSrc(base64String: string): string { export function convertBase64ToImageSrc(base64String: string): string {
return base64String.startsWith("data:image") return base64String.startsWith("data:image") ? base64String : `data:image/png;base64,${base64String}`;
? base64String
: `data:image/png;base64,${base64String}`;
} }

View file

@ -1,24 +1,23 @@
import { describe, it, expect, beforeAll } from 'vitest'; import { describe, it, expect, beforeAll } from "vitest";
import { convertBase64ToImageSrc } from '../../src/utils/base64ToImage.js'; import { convertBase64ToImageSrc } from "../../src/utils/base64ToImage.js";
import fs from 'fs'; import fs from "fs";
import path from 'path'; import path from "path";
let sampleBase64: string; let sampleBase64: string;
beforeAll(() => { beforeAll(() => {
// Load base64 sample from text file // Load base64 sample from text file
const filePath = path.resolve(__dirname, 'base64Sample.txt'); const filePath = path.resolve(__dirname, "base64Sample.txt");
sampleBase64 = fs.readFileSync(filePath, 'utf8').trim(); sampleBase64 = fs.readFileSync(filePath, "utf8").trim();
}); });
describe('convertBase64ToImageSrc', () => { describe("convertBase64ToImageSrc", () => {
it('should return the same string if it is already a valid data URL', () => { it("should return the same string if it is already a valid data URL", () => {
const base64Image = `data:image/png;base64,${sampleBase64}`; const base64Image = `data:image/png;base64,${sampleBase64}`;
expect(convertBase64ToImageSrc(base64Image)).toBe(base64Image); expect(convertBase64ToImageSrc(base64Image)).toBe(base64Image);
}); });
it('should correctly format a raw Base64 string as a PNG image URL', () => { it("should correctly format a raw Base64 string as a PNG image URL", () => {
expect(convertBase64ToImageSrc(sampleBase64)).toBe(`data:image/png;base64,${sampleBase64}`); expect(convertBase64ToImageSrc(sampleBase64)).toBe(`data:image/png;base64,${sampleBase64}`);
}); });
}); });