Skip to content

Commit a4021d2

Browse files
committed
Resolve Eslint problems
1 parent dc1008e commit a4021d2

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

src/components/navigators/TabBarNavigation/TabNavigator.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ import {
66
TAB_BAR_NAVIGATOR_ROUTES,
77
TabBarNavigatorParamList,
88
} from './TabNavigator.interfaces.ts';
9-
import { Imager } from '../../../screens/imager/Imager';
10-
import { Search } from '../../../screens/search/Search.tsx';
9+
import {Imager} from '../../../screens/imager/Imager';
10+
import {Search} from '../../../screens/search/Search.tsx';
1111
import CarrotNavigator from '../CarrotNavigator/CarrotNavigator.tsx';
1212
import {Image, Text, View} from 'react-native';
1313
import PlateScreen from '../../../screens/plate/PlateScreen.tsx';
14-
import * as Icons from "react-native-heroicons/solid";
14+
import * as Icons from 'react-native-heroicons/solid';
1515

1616
const Tab = createBottomTabNavigator<TabBarNavigatorParamList>();
1717

18-
const SearchScreen = () => null;
19-
2018
const TabNavigator = () => {
2119
const {navigate} = useNavigation();
2220

src/screens/carrot/components/MockApiComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
} from 'react-native';
99
import {useNavigation} from '@react-navigation/native';
1010
import NutritionInfo from './NutritionInfo';
11-
import { CARROT_NAVIGATOR_ROUTES } from '../../../components/navigators/CarrotNavigator/CarrotNavigator.interfaces.ts';
12-
import { useSelector } from 'react-redux';
11+
import {CARROT_NAVIGATOR_ROUTES} from '../../../components/navigators/CarrotNavigator/CarrotNavigator.interfaces.ts';
12+
import {useSelector} from 'react-redux';
1313

1414
const fakeApiData = {
1515
image_url: 'https://fakeimg.pl/300/',

src/screens/carrot/components/productItem/ProductItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ const ProductItem = ({
1414
nutriscore_grade,
1515
nutriscore_score,
1616
}: ProductItemProps) => {
17-
18-
1917
return (
2018
<View style={styles.card}>
2119
<View style={styles.header}>

src/screens/login/LoginScreen.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {useDispatch} from 'react-redux';
1414

1515
import {styles} from './LoginScreen.styles.ts';
1616
import {ACCOUNT_NAVIGATOR_ROUTES} from '../../components/navigators/AccountNavigator/AccountNavigator.interfaces.ts';
17-
import {TAB_BAR_NAVIGATOR_ROUTES} from '../../components/navigators/TabBarNavigation/TabNavigator.interfaces.ts';
1817
import {validateEmail, validatePassword} from '../../utils/validationUtils.ts';
1918
import {login} from '../../service/redux/slices/userSlice.ts';
2019

src/screens/search/Search.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const Search = () => {
6363
style={styles.input}
6464
onChangeText={text => {
6565
setQuery(text);
66-
if (text == '') setProducts([]);
66+
if (text === '') setProducts([]);
6767
}}
6868
/>
6969
<TouchableOpacity

src/service/apiCall.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,32 @@ export async function getProductByBarcode(barcode: string) {
99
.then(response => response.json())
1010
.then(json => (rawJson = json));
1111

12-
if (rawJson.status != 0)
13-
{
12+
if (rawJson.status !== 0) {
1413
data.code = rawJson.code;
1514
data.name = rawJson.product.product_name;
1615
data.categories = rawJson.product.categories;
1716
data.nutriments = rawJson.product.nutriments;
1817
data.energy = rawJson.product.nutriments.energy;
1918
data.energy100g = rawJson.product.nutriments['energy-kcal_100g'];
20-
data.positive_nutrients = rawJson.product.nutriscore['2023'].data.positive_nutrients;
21-
data.negative_nutrients = rawJson.product.nutriscore['2023'].data.negative_nutrients ? rawJson.product.nutriscore['2023'].data.negative_nutrients : [];
19+
data.positive_nutrients =
20+
rawJson.product.nutriscore['2023'].data.positive_nutrients;
21+
data.negative_nutrients = rawJson.product.nutriscore['2023'].data
22+
.negative_nutrients
23+
? rawJson.product.nutriscore['2023'].data.negative_nutrients
24+
: [];
2225
data.nutriscore_score = rawJson.product.nutriscore_score;
2326
data.nutriscore_grade = rawJson.product.nutriscore_grade;
2427
data.image = rawJson.product.image_front_thumb_url;
2528
data.ingredients_text = rawJson.product.ingredients_text;
26-
}
27-
else data = null;
29+
} else data = null;
2830

2931
console.log(data);
30-
32+
3133
return data;
3234
}
3335

3436
export async function getProductByName(productName: string) {
35-
if (productName.length == 0) return [];
37+
if (productName.length === 0) return [];
3638
let data = [],
3739
rawJson = {};
3840
await fetch(`${apiUrlSearch}${encodeURIComponent(productName)}`)
@@ -44,7 +46,7 @@ export async function getProductByName(productName: string) {
4446
let object = {};
4547
if (
4648
!rawJson.products[i].product_name ||
47-
rawJson.products[i].product_name == ''
49+
rawJson.products[i].product_name === ''
4850
)
4951
continue;
5052

@@ -53,7 +55,7 @@ export async function getProductByName(productName: string) {
5355
for (let j = 0; j < data.length; j++) {
5456
if (
5557
j < data.length &&
56-
data[j].name.toLocaleLowerCase() ==
58+
data[j].name.toLocaleLowerCase() ===
5759
rawJson.products[i].product_name.toLocaleLowerCase()
5860
) {
5961
alreadyPresent = true;

0 commit comments

Comments
 (0)