Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppression des imports non utilisés et mise à jour des règles ESLint #530

Merged
merged 7 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as SplashScreen from "expo-splash-screen";
import { LogBox } from "react-native";
import React, { useEffect } from "react";
import { expoGoWrapper } from "@/utils/native/expoGoAlert";
import AsyncStorage from "@react-native-async-storage/async-storage";

SplashScreen.preventAutoHideAsync();

Expand Down
7 changes: 5 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const stylistic = require("@stylistic/eslint-plugin");
const unusedImports = require("eslint-plugin-unused-imports");
const typescript = require("@typescript-eslint/parser");

module.exports = [
Expand All @@ -19,14 +20,16 @@ module.exports = [
parser: typescript
},
plugins: {
"@stylistic": stylistic
"@stylistic": stylistic,
"unused-imports": unusedImports
},
rules: {
"@stylistic/indent": ["error", 2],
"@stylistic/no-trailing-spaces": "error",
"@stylistic/quotes": ["error", "double"],
"@stylistic/semi": ["error", "always"],
"@stylistic/space-before-function-paren": ["error", "always"]
"@stylistic/space-before-function-paren": ["error", "always"],
"unused-imports/no-unused-imports": "error"
}
}
];
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-unused-imports": "^4.1.4",
"expo": "~51.0.17",
"react-native-svg-transformer": "^1.5.0",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Addons/AddonsWebview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useTheme } from "@react-navigation/native";
import Reanimated, { Easing, useSharedValue, withTiming } from "react-native-reanimated";
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
import type { RouteParameters } from "@/router/helpers/types";
import { get_iso_date, Log } from "@/utils/logger/logger";
import { get_iso_date } from "@/utils/logger/logger";
import {AddonLogs} from "@/addons/types";

export type AddonHomePageInfo = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Global/FileIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FileText, FileType, FileType2, Music, Paperclip, Image, Clapperboard, TypeIcon } from "lucide-react-native";
import { FileText, Music, Paperclip, Image, Clapperboard, TypeIcon } from "lucide-react-native";

export const AutoFileIcon = (props: any) => {
const { filename } = props;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Global/PapillonCheckbox.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { View, Animated, Easing, type ViewStyle, type StyleProp } from "react-native";
import { type ViewStyle, type StyleProp } from "react-native";
import React, { useEffect, useRef, useState } from "react";
import { useTheme } from "@react-navigation/native";

import Reanimated, { LinearTransition, ZoomIn, ZoomOut } from "react-native-reanimated";
import { PressableScale } from "react-native-pressable-scale";
import { Svg, Circle, G } from "react-native-svg";
import { Check } from "lucide-react-native";
import * as Haptics from "expo-haptics";
import PapillonSpinner from "./PapillonSpinner";
Expand Down
18 changes: 3 additions & 15 deletions src/components/Global/PapillonModernHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
import React, { Children, useEffect, useRef, useState } from "react";
import { Button, StyleSheet, View } from "react-native";
import React from "react";
import { StyleSheet, View } from "react-native";

import { Screen } from "@/router/helpers/types";
import { NativeText } from "@/components/Global/NativeComponents";
import InfiniteDatePager from "@/components/Global/InfiniteDatePager";
import { useCurrentAccount } from "@/stores/account";
import { useTimetableStore } from "@/stores/timetable";
import { AccountService } from "@/stores/account/types";
import { updateTimetableForWeekInCache } from "@/services/timetable";
import { set } from "lodash";
import { dateToEpochWeekNumber } from "@/utils/epochWeekNumber";

import Reanimated, { FadeIn, FadeInDown, FadeInLeft, FadeOut, FadeOutLeft, FadeOutRight, FadeOutUp, LinearTransition, ZoomIn, ZoomOut } from "react-native-reanimated";
import Reanimated, { FadeIn, FadeOut, LinearTransition, ZoomIn, ZoomOut } from "react-native-reanimated";
import { animPapillon } from "@/utils/ui/animations";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import PapillonSpinner from "@/components/Global/PapillonSpinner";
import { PressableScale } from "react-native-pressable-scale";
import { useTheme } from "@react-navigation/native";
import { BlurView } from "expo-blur";
import AnimatedNumber from "@/components/Global/AnimatedNumber";
import { LinearGradient } from "expo-linear-gradient";
import { TouchableOpacity } from "react-native-gesture-handler";
import { ArrowLeftToLine, ArrowUp, CalendarCheck, CalendarClock, CalendarPlus, CalendarSearch, History, ListRestart, Loader, Plus, Rewind } from "lucide-react-native";

interface ModernHeaderProps {
children: React.ReactNode,
Expand Down
3 changes: 1 addition & 2 deletions src/components/Global/PapillonPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import React, { useState } from "react";
import { View, Platform, StyleSheet, type StyleProp, type ViewStyle } from "react-native";

import { animPapillon, PapillonContextEnter, PapillonContextExit } from "@/utils/ui/animations";
Expand All @@ -8,7 +8,6 @@ import Reanimated, { LinearTransition, type AnimatedStyle } from "react-native-r
import { NativeText } from "./NativeComponents";

import { BlurView } from "expo-blur";
import * as Haptics from "expo-haptics";
import { Check } from "lucide-react-native";

type PickerData = string[] | { label: string, icon?: JSX.Element, onPress: () => unknown }[];
Expand Down
3 changes: 1 addition & 2 deletions src/components/Global/PapillonSpinner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useRef } from "react";
import { View, Animated, Easing, ViewStyle, StyleProp } from "react-native";
import { useTheme } from "@react-navigation/native";
import { Animated, Easing, ViewStyle, StyleProp } from "react-native";
import Reanimated, {
LinearTransition,
EntryExitAnimationFunction,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/AccountSwitcherContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { animPapillon, PapillonContextEnter, PapillonContextExit } from "@/utils
import { defaultProfilePicture } from "@/utils/ui/default-profile-picture";
import { useTheme } from "@react-navigation/native";
import { BlurView } from "expo-blur";
import { Check, CirclePlus, Cog, Plus } from "lucide-react-native";
import { Check, Cog, Plus } from "lucide-react-native";

const ContextMenu: React.FC<{
style?: any;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modals/PapillonBottomSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTheme } from "@react-navigation/native";
import React, {useCallback} from "react";
import { KeyboardAvoidingView, Modal, Pressable, View } from "react-native";
import { KeyboardAvoidingView, Modal, Pressable } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";

import Reanimated, {
Expand Down
3 changes: 1 addition & 2 deletions src/components/News/Beta.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { View, Text } from "react-native";
import { NativeText } from "../Global/NativeComponents";
import { Text } from "react-native";
import { LinearGradient } from "expo-linear-gradient";


Expand Down
10 changes: 2 additions & 8 deletions src/components/Restaurant/AccountButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Coffee, Utensils } from "lucide-react-native";
import React from "react";
import { View, TouchableOpacity, Text } from "react-native";
import Reanimated, {
useSharedValue,
withSpring,
useAnimatedStyle,
withTiming,
Easing,
} from "react-native-reanimated";
import { View, TouchableOpacity } from "react-native";
import Reanimated from "react-native-reanimated";
import {Balance} from "@/services/shared/Balance";
import {Theme} from "@react-navigation/native";

Expand Down
2 changes: 1 addition & 1 deletion src/components/Restaurant/RestaurantCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from "react";
import { Text, View } from "react-native";
import { View } from "react-native";
import { NativeText } from "../Global/NativeComponents";
import { useTheme } from "@react-navigation/native";
import AnimatedNumber from "../Global/AnimatedNumber";
Expand Down
6 changes: 2 additions & 4 deletions src/components/Settings/AboutContainerCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useState, useEffect } from "react";
import type { Screen } from "@/router/helpers/types";
import React from "react";

import { ScrollView, Image, Text, View } from "react-native";
import LottieView from "lottie-react-native";
import { Image, View } from "react-native";
import { NativeItem, NativeList, NativeText } from "../Global/NativeComponents";

const AboutContainerCard = ({ theme }: { theme: any }) => {
Expand Down
5 changes: 2 additions & 3 deletions src/components/Settings/ExternalServicesContainerCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState, useEffect } from "react";
import type { Screen } from "@/router/helpers/types";
import React from "react";

import { ScrollView, Image, Text, View } from "react-native";
import { View } from "react-native";
import LottieView from "lottie-react-native";
import { NativeItem, NativeList, NativeText } from "../Global/NativeComponents";

Expand Down
5 changes: 2 additions & 3 deletions src/components/Settings/IconsContainerCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState, useEffect } from "react";
import type { Screen } from "@/router/helpers/types";
import React, { useEffect } from "react";

import { ScrollView, Image, Text, View } from "react-native";
import { Image, View } from "react-native";
import LottieView from "lottie-react-native";
import { NativeItem, NativeList, NativeText } from "../Global/NativeComponents";

Expand Down
5 changes: 2 additions & 3 deletions src/components/Settings/MagicContainerCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState, useEffect } from "react";
import type { Screen } from "@/router/helpers/types";
import React, { useEffect } from "react";

import { ScrollView, Image, Text, View } from "react-native";
import { Image, View } from "react-native";
import LottieView from "lottie-react-native";
import { NativeItem, NativeList, NativeText } from "../Global/NativeComponents";
import { LinearGradient } from "expo-linear-gradient";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Settings/NotificationContainerCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect } from "react";
import { View, Text, StyleSheet, DimensionValue, Switch } from "react-native";
import { View, StyleSheet, DimensionValue, Switch } from "react-native";
import LottieView from "lottie-react-native";
import Reanimated, { useSharedValue, useAnimatedStyle, withTiming } from "react-native-reanimated";
import { NativeItem, NativeList, NativeText } from "../Global/NativeComponents";
Expand Down
6 changes: 2 additions & 4 deletions src/components/Settings/SubjectContainerCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useState, useEffect } from "react";
import type { Screen } from "@/router/helpers/types";
import React from "react";

import { ScrollView, Image, Text, View } from "react-native";
import LottieView from "lottie-react-native";
import { Image, View } from "react-native";
import { NativeItem, NativeList, NativeText } from "../Global/NativeComponents";

const SubjectContainerCard = ({ theme }: { theme: any }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/router/screens/account/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const screenOptions: NativeStackNavigationOptions = {
import { useCurrentAccount } from "@/stores/account";
import createScreen from "@/router/helpers/create-screen";
import Home from "@/views/account/Home/Home";
import type { RouteParameters, Screen } from "@/router/helpers/types";
import type { RouteParameters } from "@/router/helpers/types";

const HomeStackScreen = ({ accountScreens }: {
accountScreens: Array<ReturnType<typeof createScreen>>
Expand Down
2 changes: 1 addition & 1 deletion src/services/homework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Homework } from "./shared/Homework";
import { error } from "@/utils/logger/logger";
import { translateToWeekNumber } from "pawnote";
import { pronoteFirstDate } from "./pronote/timetable";
import { dateToEpochWeekNumber, epochWNToPronoteWN } from "@/utils/epochWeekNumber";
import { dateToEpochWeekNumber } from "@/utils/epochWeekNumber";
import { checkIfSkoSupported } from "./skolengo/default-personalization";
import { useClassSubjectStore } from "@/stores/classSubject";

Expand Down
1 change: 0 additions & 1 deletion src/services/iutlan/attendance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LocalAccount } from "@/stores/account/types";
import uuid from "@/utils/uuid-v4";
import { Attendance } from "../shared/Attendance";
import { Absence } from "../shared/Absence";

Expand Down
2 changes: 0 additions & 2 deletions src/services/local/default-personalization.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { Personalization } from "@/stores/account/types";
import downloadAsBase64 from "@/utils/external/download-as-base64";
import { defaultTabs } from "@/consts/DefaultTabs";
import type { Account } from "pawdirecte";

import colors from "@/utils/data/colors.json";

Expand Down
1 change: 0 additions & 1 deletion src/services/multi/default-personalization.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { MultiAccount, Personalization } from "@/stores/account/types";
import { defaultTabs } from "@/consts/DefaultTabs";
import type pronote from "pawnote";

import colors from "@/utils/data/colors.json";

Expand Down
1 change: 0 additions & 1 deletion src/services/news.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { Information } from "./shared/Information";
import { checkIfSkoSupported } from "./skolengo/default-personalization";
import { error } from "@/utils/logger/logger";
import { newsRead } from "pawnote";
import { ca } from "date-fns/locale";

/**
* Updates the state and cache for the news.
Expand Down
2 changes: 1 addition & 1 deletion src/services/pronote/chats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const createDiscussionRecipients = async (account: PronoteAccount): Promi
const recipientsALL = await Promise.all([
pronote.EntityKind.Teacher,
pronote.EntityKind.Personal
].map(kind => pronote.newDiscussionRecipients(account.instance!, user, kind)));
].map(kind => pronote.newDiscussionRecipients(account.instance!, kind)));

const recipients = recipientsALL.flat();
info("PRONOTE->createDiscussionRecipients(): OK", "pronote");
Expand Down
1 change: 0 additions & 1 deletion src/services/skolengo/data/attendance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { SkolengoAccount } from "@/stores/account/types";
import { info } from "@/utils/logger/logger";
import { ErrorServiceUnauthenticated } from "@/services/shared/errors";
import type { AbsenceState } from "scolengo-api/types/models/SchoolLife";
import type { Attendance } from "@/services/shared/Attendance";
import { SupportedAbsenceType } from "scolengo-api/types/models/SchoolLife/AbsenceReason";

Expand Down
4 changes: 2 additions & 2 deletions src/services/skolengo/data/grades.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AverageOverview, Grade, GradeInformation, GradeValue } from "@/services/shared/Grade";
import { AverageOverview, Grade, GradeValue } from "@/services/shared/Grade";
import type { SkolengoAccount } from "@/stores/account/types";
import { getPeriod } from "./period";
import { ErrorServiceUnauthenticated } from "@/services/shared/errors";
import { Evaluation, EvaluationDetail } from "scolengo-api/types/models/Results";
import { Evaluation } from "scolengo-api/types/models/Results";

const SKOLENGO_DEFAULT_SCALE = 20;

Expand Down
2 changes: 1 addition & 1 deletion src/services/skolengo/data/homework.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PronoteAccount, SkolengoAccount } from "@/stores/account/types";
import type { SkolengoAccount } from "@/stores/account/types";
import { type Homework, HomeworkReturnType } from "@/services/shared/Homework";
import {info, log} from "@/utils/logger/logger";
import { weekNumberToDateRange } from "@/utils/epochWeekNumber";
Expand Down
1 change: 0 additions & 1 deletion src/services/skolengo/data/period.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ErrorServiceUnauthenticated } from "@/services/shared/errors";
import { Period } from "@/services/shared/Period";
import { SkolengoAccount } from "@/stores/account/types";

export const getPeriod = async (account: SkolengoAccount) => {
Expand Down
1 change: 0 additions & 1 deletion src/services/skolengo/data/timetable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ErrorServiceUnauthenticated } from "@/services/shared/errors";
import type { SkolengoAccount } from "@/stores/account/types";
import { weekNumberToDateRange } from "@/utils/epochWeekNumber";
import { info } from "@/utils/logger/logger";
import { toSkolengoDate } from "../skolengo-types";
import { TimetableClassStatus, type Timetable, type TimetableClass } from "@/services/shared/Timetable";
import type { Lesson } from "scolengo-api/types/models/Calendar";
Expand Down
2 changes: 1 addition & 1 deletion src/stores/account/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type pronote from "pawnote";
import type { Account as PawdirecteAccount, Session as PawdirecteSession } from "pawdirecte";
import type { Client as ARDClient, Client as PawrdClient } from "pawrd";
import type { Client as ARDClient } from "pawrd";
import { Client as TurboselfClient } from "turboself-api";
import { Client as AliseClient, BookingDay } from "alise-api";
import type ScolengoAPI from "scolengo-api";
Expand Down
1 change: 0 additions & 1 deletion src/utils/grades/getAverages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// On importe le type `Grade` depuis le chemin spécifié
import type { Grade } from "@/services/shared/Grade";
import { is } from "date-fns/locale";

// Définition de l'interface `GradeHistory` pour représenter l'historique des notes avec une valeur numérique et une date
export interface GradeHistory {
Expand Down
2 changes: 1 addition & 1 deletion src/views/account/Attendance/Atoms/AttendanceItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ReactNode, type Dispatch, type SetStateAction, useState } from "react";
import { type ReactNode, useState } from "react";
import type { Attendance } from "@/services/shared/Attendance";
import type { Absence } from "@/services/shared/Absence";

Expand Down
2 changes: 1 addition & 1 deletion src/views/account/Chat/Modals/ChatCreate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useLayoutEffect, useState } from "react";
import React, { useEffect, useState } from "react";
import {
TouchableOpacity,
ScrollView,
Expand Down
7 changes: 3 additions & 4 deletions src/views/account/Grades/Atoms/GradeTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { NativeItem, NativeList, NativeText } from "@/components/Global/NativeComponents";
import { getSubjectData } from "@/services/shared/Subject";
import { NativeList, NativeText } from "@/components/Global/NativeComponents";
import { getCourseSpeciality } from "@/utils/format/format_cours_name";
import { useTheme } from "@react-navigation/native";
import React, { useEffect, useState } from "react";
import { ScrollView, View } from "react-native";
import React from "react";
import { View } from "react-native";
import {Grade} from "@/services/shared/Grade";

interface GradeTitleProps {
Expand Down
Loading
Loading