Retrait des points-virgules finaux

This commit is contained in:
Emmy D'Anello 2024-12-07 10:24:41 +01:00
parent ab180a12ce
commit 2ad2063339
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
20 changed files with 101 additions and 103 deletions

View File

@ -1,7 +1,7 @@
import { ScrollView } from 'react-native'; import { ScrollView } from 'react-native'
import { ThemedText } from '@/components/ThemedText'; import { ThemedText } from '@/components/ThemedText'
import { ThemedView } from '@/components/ThemedView'; import { ThemedView } from '@/components/ThemedView'
export default function ChallengesScreen() { export default function ChallengesScreen() {
return ( return (
@ -10,5 +10,5 @@ export default function ChallengesScreen() {
<ThemedText>Ici on aura la gestion des challenges</ThemedText> <ThemedText>Ici on aura la gestion des challenges</ThemedText>
</ThemedView> </ThemedView>
</ScrollView> </ScrollView>
); )
} }

View File

@ -1,7 +1,6 @@
import { ScrollView } from 'react-native'; import { ScrollView } from 'react-native'
import { ThemedText } from '@/components/ThemedText'
import { ThemedText } from '@/components/ThemedText'; import { ThemedView } from '@/components/ThemedView'
import { ThemedView } from '@/components/ThemedView';
export default function HistoryScreen() { export default function HistoryScreen() {
return ( return (
@ -10,5 +9,5 @@ export default function HistoryScreen() {
<ThemedText>Ici on aura la gestion de l'historique des trains empruntés et des challenges effectués</ThemedText> <ThemedText>Ici on aura la gestion de l'historique des trains empruntés et des challenges effectués</ThemedText>
</ThemedView> </ThemedView>
</ScrollView> </ScrollView>
); )
} }

View File

@ -27,4 +27,4 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
alignSelf: 'stretch', alignSelf: 'stretch',
}, },
}); })

View File

@ -1,7 +1,7 @@
import { ScrollView } from 'react-native'; import { ScrollView } from 'react-native'
import { ThemedText } from '@/components/ThemedText'; import { ThemedText } from '@/components/ThemedText'
import { ThemedView } from '@/components/ThemedView'; import { ThemedView } from '@/components/ThemedView'
export default function TrainScreen() { export default function TrainScreen() {
return ( return (
@ -10,5 +10,5 @@ export default function TrainScreen() {
<ThemedText>Ici on aura la page pour ajouter un trajet en train depuis Rail Planner</ThemedText> <ThemedText>Ici on aura la page pour ajouter un trajet en train depuis Rail Planner</ThemedText>
</ThemedView> </ThemedView>
</ScrollView> </ScrollView>
); )
} }

View File

@ -1,12 +1,11 @@
import { Text, type TextProps, StyleSheet } from 'react-native'; import { Text, type TextProps, StyleSheet } from 'react-native'
import { useThemeColor } from '@/hooks/useThemeColor'
import { useThemeColor } from '@/hooks/useThemeColor';
export type ThemedTextProps = TextProps & { export type ThemedTextProps = TextProps & {
lightColor?: string; lightColor?: string
darkColor?: string; darkColor?: string
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link'; type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link'
}; }
export function ThemedText({ export function ThemedText({
style, style,
@ -15,7 +14,7 @@ export function ThemedText({
type = 'default', type = 'default',
...rest ...rest
}: ThemedTextProps) { }: ThemedTextProps) {
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text'); const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text')
return ( return (
<Text <Text
@ -30,7 +29,7 @@ export function ThemedText({
]} ]}
{...rest} {...rest}
/> />
); )
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
@ -57,4 +56,4 @@ const styles = StyleSheet.create({
fontSize: 16, fontSize: 16,
color: '#0a7ea4', color: '#0a7ea4',
}, },
}); })

View File

@ -1,14 +1,13 @@
import { View, type ViewProps } from 'react-native'; import { View, type ViewProps } from 'react-native'
import { useThemeColor } from '@/hooks/useThemeColor'
import { useThemeColor } from '@/hooks/useThemeColor';
export type ThemedViewProps = ViewProps & { export type ThemedViewProps = ViewProps & {
lightColor?: string; lightColor?: string
darkColor?: string; darkColor?: string
}; }
export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) { 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 <View style={[{ backgroundColor }, style]} {...otherProps} />; return <View style={[{ backgroundColor }, style]} {...otherProps} />
} }

View File

@ -1,10 +1,10 @@
import * as React from 'react'; import * as React from 'react'
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer'
import { ThemedText } from '../ThemedText'; import { ThemedText } from '../ThemedText'
it(`renders correctly`, () => { it(`renders correctly`, () => {
const tree = renderer.create(<ThemedText>Snapshot test!</ThemedText>).toJSON(); const tree = renderer.create(<ThemedText>Snapshot test!</ThemedText>).toJSON()
expect(tree).toMatchSnapshot(); expect(tree).toMatchSnapshot()
}); })

View File

@ -21,4 +21,4 @@ exports[`renders correctly 1`] = `
> >
Snapshot test! Snapshot test!
</Text> </Text>
`; `

View File

@ -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. * 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 tintColorLight = '#0a7ea4'
const tintColorDark = '#fff'; const tintColorDark = '#fff'
export const Colors = { export const Colors = {
light: { light: {
@ -23,4 +23,4 @@ export const Colors = {
tabIconDefault: '#9BA1A6', tabIconDefault: '#9BA1A6',
tabIconSelected: tintColorDark, tabIconSelected: tintColorDark,
}, },
}; }

View File

@ -1 +1 @@
export { useColorScheme } from 'react-native'; export { useColorScheme } from 'react-native'

View File

@ -1,21 +1,21 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react'
import { useColorScheme as useRNColorScheme } from 'react-native'; import { useColorScheme as useRNColorScheme } from 'react-native'
/** /**
* To support static rendering, this value needs to be re-calculated on the client side for web * To support static rendering, this value needs to be re-calculated on the client side for web
*/ */
export function useColorScheme() { export function useColorScheme() {
const [hasHydrated, setHasHydrated] = useState(false); const [hasHydrated, setHasHydrated] = useState(false)
useEffect(() => { useEffect(() => {
setHasHydrated(true); setHasHydrated(true)
}, []); }, [])
const colorScheme = useRNColorScheme(); const colorScheme = useRNColorScheme()
if (hasHydrated) { if (hasHydrated) {
return colorScheme; return colorScheme
} }
return 'light'; return 'light'
} }

View File

@ -3,19 +3,19 @@
* https://docs.expo.dev/guides/color-schemes/ * https://docs.expo.dev/guides/color-schemes/
*/ */
import { Colors } from '@/constants/Colors'; import { Colors } from '@/constants/Colors'
import { useColorScheme } from '@/hooks/useColorScheme'; import { useColorScheme } from '@/hooks/useColorScheme'
export function useThemeColor( export function useThemeColor(
props: { light?: string; dark?: string }, props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark colorName: keyof typeof Colors.light & keyof typeof Colors.dark
) { ) {
const theme = useColorScheme() ?? 'light'; const theme = useColorScheme() ?? 'light'
const colorFromProps = props[theme]; const colorFromProps = props[theme]
if (colorFromProps) { if (colorFromProps) {
return colorFromProps; return colorFromProps
} else { } else {
return Colors[theme][colorName]; return Colors[theme][colorName]
} }
} }

View File

@ -21,5 +21,6 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/semi': 'never',
}, },
}; }

View File

@ -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() { async function main() {
const emmy = await prisma.user.upsert({ const emmy = await prisma.user.upsert({
where: { id: 1 }, where: { id: 1 },
update: { name: 'Emmy' }, update: { name: 'Emmy' },
create: { name: 'Emmy' }, create: { name: 'Emmy' },
}); })
const tamina = await prisma.user.upsert({ const tamina = await prisma.user.upsert({
where: { id: 2 }, where: { id: 2 },
update: { name: 'Tamina' }, update: { name: 'Tamina' },
create: { name: 'Tamina' }, create: { name: 'Tamina' },
}); })
console.log({ emmy, tamina }); console.log({ emmy, tamina })
} }
main() main()
.catch((e) => { .catch((e) => {
console.error(e); console.error(e)
process.exit(1); process.exit(1)
}) })
.finally(async () => { .finally(async () => {
await prisma.$disconnect(); await prisma.$disconnect()
}); })

View File

@ -1,22 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing'
import { AppController } from './app.controller'; import { AppController } from './app.controller'
import { AppService } from './app.service'; import { AppService } from './app.service'
describe('AppController', () => { describe('AppController', () => {
let appController: AppController; let appController: AppController
beforeEach(async () => { beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({ const app: TestingModule = await Test.createTestingModule({
controllers: [AppController], controllers: [AppController],
providers: [AppService], providers: [AppService],
}).compile(); }).compile()
appController = app.get<AppController>(AppController); appController = app.get<AppController>(AppController)
}); })
describe('root', () => { describe('root', () => {
it('should return "Hello World!"', () => { it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!'); expect(appController.getHello()).toBe('Hello World!')
}); })
}); })
}); })

View File

@ -1,5 +1,5 @@
import { Controller, Get } from '@nestjs/common'; import { Controller, Get } from '@nestjs/common'
import { AppService } from './app.service'; import { AppService } from './app.service'
@Controller() @Controller()
export class AppController { export class AppController {
@ -7,6 +7,6 @@ export class AppController {
@Get() @Get()
getHello(): string { getHello(): string {
return this.appService.getHello(); return this.appService.getHello()
} }
} }

View File

@ -1,6 +1,6 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common'
import { AppController } from './app.controller'; import { AppController } from './app.controller'
import { AppService } from './app.service'; import { AppService } from './app.service'
@Module({ @Module({
imports: [], imports: [],

View File

@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common'
@Injectable() @Injectable()
export class AppService { export class AppService {
getHello(): string { getHello(): string {
return 'Hello World!'; return 'Hello World!'
} }
} }

View File

@ -1,8 +1,8 @@
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'; import { AppModule } from './app.module'
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule)
await app.listen(process.env.PORT ?? 3000); await app.listen(process.env.PORT ?? 3000)
} }
bootstrap(); bootstrap()

View File

@ -1,24 +1,24 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication } from '@nestjs/common'; import { INestApplication } from '@nestjs/common'
import * as request from 'supertest'; import * as request from 'supertest'
import { AppModule } from './../src/app.module'; import { AppModule } from './../src/app.module'
describe('AppController (e2e)', () => { describe('AppController (e2e)', () => {
let app: INestApplication; let app: INestApplication
beforeEach(async () => { beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({ const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule], imports: [AppModule],
}).compile(); }).compile()
app = moduleFixture.createNestApplication(); app = moduleFixture.createNestApplication()
await app.init(); await app.init()
}); })
it('/ (GET)', () => { it('/ (GET)', () => {
return request(app.getHttpServer()) return request(app.getHttpServer())
.get('/') .get('/')
.expect(200) .expect(200)
.expect('Hello World!'); .expect('Hello World!')
}); })
}); })