From 2ad206333951d1eeb8e0b31dde9b27d845da8a31 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 7 Dec 2024 10:24:41 +0100 Subject: [PATCH] Retrait des points-virgules finaux --- client/app/(tabs)/challenges.tsx | 8 +++---- client/app/(tabs)/history.tsx | 9 ++++--- client/app/(tabs)/index.tsx | 2 +- client/app/(tabs)/train.tsx | 8 +++---- client/components/ThemedText.tsx | 19 +++++++-------- client/components/ThemedView.tsx | 15 ++++++------ .../components/__tests__/ThemedText-test.tsx | 12 +++++----- .../__snapshots__/ThemedText-test.tsx.snap | 2 +- client/constants/Colors.ts | 6 ++--- client/hooks/useColorScheme.ts | 2 +- client/hooks/useColorScheme.web.ts | 16 ++++++------- client/hooks/useThemeColor.ts | 12 +++++----- server/.eslintrc.js | 3 ++- server/prisma/seed.ts | 18 +++++++------- server/src/app.controller.spec.ts | 22 ++++++++--------- server/src/app.controller.ts | 6 ++--- server/src/app.module.ts | 6 ++--- server/src/app.service.ts | 4 ++-- server/src/main.ts | 10 ++++---- server/test/app.e2e-spec.ts | 24 +++++++++---------- 20 files changed, 101 insertions(+), 103 deletions(-) diff --git a/client/app/(tabs)/challenges.tsx b/client/app/(tabs)/challenges.tsx index 35b7948..7bc4d47 100644 --- a/client/app/(tabs)/challenges.tsx +++ b/client/app/(tabs)/challenges.tsx @@ -1,7 +1,7 @@ -import { ScrollView } from 'react-native'; +import { ScrollView } from 'react-native' -import { ThemedText } from '@/components/ThemedText'; -import { ThemedView } from '@/components/ThemedView'; +import { ThemedText } from '@/components/ThemedText' +import { ThemedView } from '@/components/ThemedView' export default function ChallengesScreen() { return ( @@ -10,5 +10,5 @@ export default function ChallengesScreen() { Ici on aura la gestion des challenges - ); + ) } diff --git a/client/app/(tabs)/history.tsx b/client/app/(tabs)/history.tsx index 2b88add..222599a 100644 --- a/client/app/(tabs)/history.tsx +++ b/client/app/(tabs)/history.tsx @@ -1,7 +1,6 @@ -import { ScrollView } from 'react-native'; - -import { ThemedText } from '@/components/ThemedText'; -import { ThemedView } from '@/components/ThemedView'; +import { ScrollView } from 'react-native' +import { ThemedText } from '@/components/ThemedText' +import { ThemedView } from '@/components/ThemedView' export default function HistoryScreen() { return ( @@ -10,5 +9,5 @@ export default function HistoryScreen() { Ici on aura la gestion de l'historique des trains empruntés et des challenges effectués - ); + ) } diff --git a/client/app/(tabs)/index.tsx b/client/app/(tabs)/index.tsx index b82dd56..1900240 100644 --- a/client/app/(tabs)/index.tsx +++ b/client/app/(tabs)/index.tsx @@ -27,4 +27,4 @@ const styles = StyleSheet.create({ flex: 1, alignSelf: 'stretch', }, -}); +}) diff --git a/client/app/(tabs)/train.tsx b/client/app/(tabs)/train.tsx index 2a0b531..449f286 100644 --- a/client/app/(tabs)/train.tsx +++ b/client/app/(tabs)/train.tsx @@ -1,7 +1,7 @@ -import { ScrollView } from 'react-native'; +import { ScrollView } from 'react-native' -import { ThemedText } from '@/components/ThemedText'; -import { ThemedView } from '@/components/ThemedView'; +import { ThemedText } from '@/components/ThemedText' +import { ThemedView } from '@/components/ThemedView' export default function TrainScreen() { return ( @@ -10,5 +10,5 @@ export default function TrainScreen() { Ici on aura la page pour ajouter un trajet en train depuis Rail Planner - ); + ) } diff --git a/client/components/ThemedText.tsx b/client/components/ThemedText.tsx index c0e1a78..a33aaab 100644 --- a/client/components/ThemedText.tsx +++ b/client/components/ThemedText.tsx @@ -1,12 +1,11 @@ -import { Text, type TextProps, StyleSheet } from 'react-native'; - -import { useThemeColor } from '@/hooks/useThemeColor'; +import { Text, type TextProps, StyleSheet } from 'react-native' +import { useThemeColor } from '@/hooks/useThemeColor' export type ThemedTextProps = TextProps & { - lightColor?: string; - darkColor?: string; - type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link'; -}; + lightColor?: string + darkColor?: string + type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link' +} export function ThemedText({ style, @@ -15,7 +14,7 @@ export function ThemedText({ type = 'default', ...rest }: ThemedTextProps) { - const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text'); + const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text') return ( - ); + ) } const styles = StyleSheet.create({ @@ -57,4 +56,4 @@ const styles = StyleSheet.create({ fontSize: 16, color: '#0a7ea4', }, -}); +}) diff --git a/client/components/ThemedView.tsx b/client/components/ThemedView.tsx index 4d2cb09..561efa6 100644 --- a/client/components/ThemedView.tsx +++ b/client/components/ThemedView.tsx @@ -1,14 +1,13 @@ -import { View, type ViewProps } from 'react-native'; - -import { useThemeColor } from '@/hooks/useThemeColor'; +import { View, type ViewProps } from 'react-native' +import { useThemeColor } from '@/hooks/useThemeColor' export type ThemedViewProps = ViewProps & { - lightColor?: string; - darkColor?: string; -}; + lightColor?: string + darkColor?: string +} export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) { - const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background'); + const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background') - return ; + return } diff --git a/client/components/__tests__/ThemedText-test.tsx b/client/components/__tests__/ThemedText-test.tsx index 1ac3225..a49390f 100644 --- a/client/components/__tests__/ThemedText-test.tsx +++ b/client/components/__tests__/ThemedText-test.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; -import renderer from 'react-test-renderer'; +import * as React from 'react' +import renderer from 'react-test-renderer' -import { ThemedText } from '../ThemedText'; +import { ThemedText } from '../ThemedText' it(`renders correctly`, () => { - const tree = renderer.create(Snapshot test!).toJSON(); + const tree = renderer.create(Snapshot test!).toJSON() - expect(tree).toMatchSnapshot(); -}); + expect(tree).toMatchSnapshot() +}) diff --git a/client/components/__tests__/__snapshots__/ThemedText-test.tsx.snap b/client/components/__tests__/__snapshots__/ThemedText-test.tsx.snap index b68e53e..4b33a4a 100644 --- a/client/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +++ b/client/components/__tests__/__snapshots__/ThemedText-test.tsx.snap @@ -21,4 +21,4 @@ exports[`renders correctly 1`] = ` > Snapshot test! -`; +` diff --git a/client/constants/Colors.ts b/client/constants/Colors.ts index 14e6784..5889ed1 100644 --- a/client/constants/Colors.ts +++ b/client/constants/Colors.ts @@ -3,8 +3,8 @@ * There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc. */ -const tintColorLight = '#0a7ea4'; -const tintColorDark = '#fff'; +const tintColorLight = '#0a7ea4' +const tintColorDark = '#fff' export const Colors = { light: { @@ -23,4 +23,4 @@ export const Colors = { tabIconDefault: '#9BA1A6', tabIconSelected: tintColorDark, }, -}; +} diff --git a/client/hooks/useColorScheme.ts b/client/hooks/useColorScheme.ts index 17e3c63..b370337 100644 --- a/client/hooks/useColorScheme.ts +++ b/client/hooks/useColorScheme.ts @@ -1 +1 @@ -export { useColorScheme } from 'react-native'; +export { useColorScheme } from 'react-native' diff --git a/client/hooks/useColorScheme.web.ts b/client/hooks/useColorScheme.web.ts index 7eb1c1b..2a690de 100644 --- a/client/hooks/useColorScheme.web.ts +++ b/client/hooks/useColorScheme.web.ts @@ -1,21 +1,21 @@ -import { useEffect, useState } from 'react'; -import { useColorScheme as useRNColorScheme } from 'react-native'; +import { useEffect, useState } from 'react' +import { useColorScheme as useRNColorScheme } from 'react-native' /** * To support static rendering, this value needs to be re-calculated on the client side for web */ export function useColorScheme() { - const [hasHydrated, setHasHydrated] = useState(false); + const [hasHydrated, setHasHydrated] = useState(false) useEffect(() => { - setHasHydrated(true); - }, []); + setHasHydrated(true) + }, []) - const colorScheme = useRNColorScheme(); + const colorScheme = useRNColorScheme() if (hasHydrated) { - return colorScheme; + return colorScheme } - return 'light'; + return 'light' } diff --git a/client/hooks/useThemeColor.ts b/client/hooks/useThemeColor.ts index 0608e73..c954286 100644 --- a/client/hooks/useThemeColor.ts +++ b/client/hooks/useThemeColor.ts @@ -3,19 +3,19 @@ * https://docs.expo.dev/guides/color-schemes/ */ -import { Colors } from '@/constants/Colors'; -import { useColorScheme } from '@/hooks/useColorScheme'; +import { Colors } from '@/constants/Colors' +import { useColorScheme } from '@/hooks/useColorScheme' export function useThemeColor( props: { light?: string; dark?: string }, colorName: keyof typeof Colors.light & keyof typeof Colors.dark ) { - const theme = useColorScheme() ?? 'light'; - const colorFromProps = props[theme]; + const theme = useColorScheme() ?? 'light' + const colorFromProps = props[theme] if (colorFromProps) { - return colorFromProps; + return colorFromProps } else { - return Colors[theme][colorName]; + return Colors[theme][colorName] } } diff --git a/server/.eslintrc.js b/server/.eslintrc.js index 259de13..d905db9 100644 --- a/server/.eslintrc.js +++ b/server/.eslintrc.js @@ -21,5 +21,6 @@ module.exports = { '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/semi': 'never', }, -}; +} diff --git a/server/prisma/seed.ts b/server/prisma/seed.ts index a624731..85a20a7 100644 --- a/server/prisma/seed.ts +++ b/server/prisma/seed.ts @@ -1,26 +1,26 @@ -import { PrismaClient } from '@prisma/client'; +import { PrismaClient } from '@prisma/client' -const prisma = new PrismaClient(); +const prisma = new PrismaClient() async function main() { const emmy = await prisma.user.upsert({ where: { id: 1 }, update: { name: 'Emmy' }, create: { name: 'Emmy' }, - }); + }) const tamina = await prisma.user.upsert({ where: { id: 2 }, update: { name: 'Tamina' }, create: { name: 'Tamina' }, - }); - console.log({ emmy, tamina }); + }) + console.log({ emmy, tamina }) } main() .catch((e) => { - console.error(e); - process.exit(1); + console.error(e) + process.exit(1) }) .finally(async () => { - await prisma.$disconnect(); - }); + await prisma.$disconnect() + }) diff --git a/server/src/app.controller.spec.ts b/server/src/app.controller.spec.ts index d22f389..3e6017d 100644 --- a/server/src/app.controller.spec.ts +++ b/server/src/app.controller.spec.ts @@ -1,22 +1,22 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { AppController } from './app.controller'; -import { AppService } from './app.service'; +import { Test, TestingModule } from '@nestjs/testing' +import { AppController } from './app.controller' +import { AppService } from './app.service' describe('AppController', () => { - let appController: AppController; + let appController: AppController beforeEach(async () => { const app: TestingModule = await Test.createTestingModule({ controllers: [AppController], providers: [AppService], - }).compile(); + }).compile() - appController = app.get(AppController); - }); + appController = app.get(AppController) + }) describe('root', () => { it('should return "Hello World!"', () => { - expect(appController.getHello()).toBe('Hello World!'); - }); - }); -}); + expect(appController.getHello()).toBe('Hello World!') + }) + }) +}) diff --git a/server/src/app.controller.ts b/server/src/app.controller.ts index cce879e..4e88eca 100644 --- a/server/src/app.controller.ts +++ b/server/src/app.controller.ts @@ -1,5 +1,5 @@ -import { Controller, Get } from '@nestjs/common'; -import { AppService } from './app.service'; +import { Controller, Get } from '@nestjs/common' +import { AppService } from './app.service' @Controller() export class AppController { @@ -7,6 +7,6 @@ export class AppController { @Get() getHello(): string { - return this.appService.getHello(); + return this.appService.getHello() } } diff --git a/server/src/app.module.ts b/server/src/app.module.ts index 8662803..d71dd70 100644 --- a/server/src/app.module.ts +++ b/server/src/app.module.ts @@ -1,6 +1,6 @@ -import { Module } from '@nestjs/common'; -import { AppController } from './app.controller'; -import { AppService } from './app.service'; +import { Module } from '@nestjs/common' +import { AppController } from './app.controller' +import { AppService } from './app.service' @Module({ imports: [], diff --git a/server/src/app.service.ts b/server/src/app.service.ts index 927d7cc..bc13055 100644 --- a/server/src/app.service.ts +++ b/server/src/app.service.ts @@ -1,8 +1,8 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common' @Injectable() export class AppService { getHello(): string { - return 'Hello World!'; + return 'Hello World!' } } diff --git a/server/src/main.ts b/server/src/main.ts index f76bc8d..b121b98 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -1,8 +1,8 @@ -import { NestFactory } from '@nestjs/core'; -import { AppModule } from './app.module'; +import { NestFactory } from '@nestjs/core' +import { AppModule } from './app.module' async function bootstrap() { - const app = await NestFactory.create(AppModule); - await app.listen(process.env.PORT ?? 3000); + const app = await NestFactory.create(AppModule) + await app.listen(process.env.PORT ?? 3000) } -bootstrap(); +bootstrap() diff --git a/server/test/app.e2e-spec.ts b/server/test/app.e2e-spec.ts index 50cda62..bbdc028 100644 --- a/server/test/app.e2e-spec.ts +++ b/server/test/app.e2e-spec.ts @@ -1,24 +1,24 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { INestApplication } from '@nestjs/common'; -import * as request from 'supertest'; -import { AppModule } from './../src/app.module'; +import { Test, TestingModule } from '@nestjs/testing' +import { INestApplication } from '@nestjs/common' +import * as request from 'supertest' +import { AppModule } from './../src/app.module' describe('AppController (e2e)', () => { - let app: INestApplication; + let app: INestApplication beforeEach(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule], - }).compile(); + }).compile() - app = moduleFixture.createNestApplication(); - await app.init(); - }); + app = moduleFixture.createNestApplication() + await app.init() + }) it('/ (GET)', () => { return request(app.getHttpServer()) .get('/') .expect(200) - .expect('Hello World!'); - }); -}); + .expect('Hello World!') + }) +})