Skip to content

Commit 4540a72

Browse files
authored
Merge pull request #3 from SM8UTI/new-v2
Configure ESLint rules to ignore inline styles and unused variables, …
2 parents 8ac9556 + d7f6f28 commit 4540a72

26 files changed

Lines changed: 67 additions & 70 deletions

.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native',
4+
rules: {
5+
'react-native/no-inline-styles': 'off',
6+
'react/no-unstable-nested-components': ['warn', { allowAsProps: true }],
7+
'@typescript-eslint/no-unused-vars': [
8+
'warn',
9+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
10+
],
11+
},
12+
overrides: [
13+
{
14+
files: ['__tests__/**/*', 'jest.setup.js'],
15+
env: {
16+
jest: true,
17+
},
18+
},
19+
],
420
};

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
module.exports = {
22
preset: 'react-native',
3+
transformIgnorePatterns: [
4+
'node_modules/(?!(jest-)?react-native|@react-native|@react-native-community|@react-navigation|lucide-react-native)/',
5+
],
6+
setupFiles: ['<rootDir>/jest.setup.js'],
37
};

jest.setup.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jest.mock('@react-native-async-storage/async-storage', () =>
2+
require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
3+
);
4+
5+
jest.mock('@notifee/react-native', () =>
6+
require('@notifee/react-native/jest-mock'),
7+
);
8+
9+
jest.mock('react-native-share-menu', () => ({
10+
getInitialShare: jest.fn(() => Promise.resolve(null)),
11+
addNewShareListener: jest.fn(),
12+
clearSharedText: jest.fn(),
13+
}));

src/components/AddTaskBottomSheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export default function AddTaskBottomSheet({ visible, onClose, onSave, initialTa
6363
} else if (isMounted) {
6464
closeSheet();
6565
}
66+
// eslint-disable-next-line react-hooks/exhaustive-deps
6667
}, [visible, initialTaskData]);
6768

6869
const closeSheet = () => {

src/components/BottomSheet.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ import {
1212
PanResponder,
1313
StyleSheet,
1414
TouchableWithoutFeedback,
15-
Dimensions,
1615
StyleProp,
1716
ViewStyle,
1817
KeyboardAvoidingView,
1918
Platform,
2019
Easing,
2120
} from 'react-native';
2221

23-
const { height: SCREEN_HEIGHT } = Dimensions.get('window');
22+
2423

2524
export interface BottomSheetProps {
2625
/** Height of the bottom sheet */

src/components/ChooseDestinationBottomSheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default function ChooseDestinationBottomSheet({ visible, onClose, onSelec
4040
} else if (isMounted) {
4141
closeSheet();
4242
}
43+
// eslint-disable-next-line react-hooks/exhaustive-deps
4344
}, [visible]);
4445

4546
const closeSheet = () => {

src/components/GlobalCelebration.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function GlobalCelebration() {
2727
} else {
2828
setShowConfetti(false);
2929
}
30-
}, [completedWhileAway, activeTaskId, tasks]);
30+
}, [completedWhileAway, activeTaskId, tasks, setTaskStatus]);
3131

3232
if (!completedWhileAway) return null;
3333

src/components/PrivacyStatus.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react';
22
import { View, Text, StyleSheet, Animated } from 'react-native';
3-
import { Shield, ShieldCheck, Lock } from 'lucide-react-native';
3+
import { ShieldCheck } from 'lucide-react-native';
44
import theme from '../data/color-theme';
55

66
export const PrivacyStatus = () => {
7-
const [isSecure, setIsSecure] = React.useState(true);
87
const fadeAnim = React.useRef(new Animated.Value(0)).current;
98

109
React.useEffect(() => {

src/components/TaskCard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Animated,
77
PanResponder,
88
Dimensions,
9-
Image,
109
Linking,
1110
} from "react-native";
1211
import theme from "../data/color-theme";

src/components/TaskDetailsInfo.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import { extractYouTubeId, hideYouTubeUrl } from "../utils/youtube";
1919
import YouTubePreview from "./YouTubePreview";
2020

2121
// ─── Status cycling helpers ────────────────────────────────────────────────────
22-
const STATUS_ORDER = ["to-do", "in-progress", "completed"] as const;
23-
type TaskStatus = (typeof STATUS_ORDER)[number];
24-
22+
// Not using STATUS_ORDER and TaskStatus here as it is only used locally as array iteration keys
2523
type AdvanceCfg = { label: string; color: string; Icon: React.ReactNode };
2624

2725
const getAdvanceCfg = (status: string): AdvanceCfg => {

0 commit comments

Comments
 (0)