Skip to content

Commit c465e6b

Browse files
fix(ESLint): Fixed Linting errors
1 parent 7e455cc commit c465e6b

13 files changed

+1064
-23
lines changed

public/sw.js

+1,043-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Scanner/scanner.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/* eslint-disable @typescript-eslint/no-unused-vars */
13
import React, { Component } from "react";
24
import Quagga from "@ericblade/quagga2";
35
interface ScannerProps {

src/components/check.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const ProductSearch: React.FC = () => {
103103
setBarcode(e.target.value);
104104
};
105105

106-
let productname = result.productname === "n/a" ? "?" : result.productname;
106+
const productname = result.productname === "n/a" ? "?" : result.productname;
107107
let vegan = "unknown icon-help";
108108
if (result.vegan === "true") {
109109
vegan = "vegan icon-ok";
@@ -134,8 +134,8 @@ const ProductSearch: React.FC = () => {
134134

135135
let nutriscore = result.nutriscore;
136136
let grade = result.grade;
137-
let api = sources.api;
138-
let uri = sources.baseuri;
137+
const api = sources.api;
138+
const uri = sources.baseuri;
139139

140140
if (nutriscore === "n/a") {
141141
nutriscore = "unknown icon-help";

src/components/elements/container.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ interface ContainerProps {
1111
}
1212

1313
export default function Container(props: ContainerProps) {
14-
let hasHeading = props.heading ? "true" : "false";
15-
let headingStyle = props.headingstyle ?? undefined;
14+
const hasHeading = props.heading ? "true" : "false";
15+
const headingStyle = props.headingstyle ?? undefined;
1616

1717

18-
let hasBackButton = props.backbutton !== false ? true : false;
19-
let hasLogo = props.logo !== false ? true : false;
18+
const hasBackButton = props.backbutton !== false ? true : false;
19+
const hasLogo = props.logo !== false ? true : false;
2020

2121
return (
2222
<div className="container top">

src/components/elements/modals.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
12
import React, { useState } from "react";
23

34
interface Props {

src/components/elements/modalwrapper.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const ModalWrapper: React.FC<ModalProps> = ({ children, id, buttonType, buttonCl
9191
{buttonText}
9292
</div>
9393
)}
94-
{isOpen &&
94+
{isOpen && modalRoot &&
9595
createPortal(
9696
<div className="modal_view animated fadeInUp open">
9797
<div className="modal_close">
@@ -105,7 +105,7 @@ const ModalWrapper: React.FC<ModalProps> = ({ children, id, buttonType, buttonCl
105105
</div>
106106
{children}
107107
</div>,
108-
modalRoot!
108+
modalRoot
109109
)}
110110
</>
111111
);

src/components/elements/pwainstall.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/* eslint-disable @next/next/no-img-element */
2+
/* eslint-disable @typescript-eslint/no-explicit-any */
23
import { useState, useEffect } from "react";
34
import ModalWrapper from "@/components/elements/modalwrapper";
45
import Image from "next/image";
56
import { useTranslations } from "next-intl";
67

7-
interface InstallPromptProps {}
8-
9-
const InstallPrompt: React.FC<InstallPromptProps> = () => {
8+
const InstallPrompt = () => {
109
const t = useTranslations("InstallPrompt");
1110
const [showInstallPrompt, setShowInstallPrompt] = useState(false);
1211

src/components/elements/share.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const ShareButton: React.FC<ShareButtonProps> = ({ productName, barcode }) => {
1818
}
1919
}, []);
2020

21-
let text = productName + " - Checked using VeganCheck";
22-
let url = `https://vegancheck.me/?ean=${barcode}`;
21+
const text = productName + " - Checked using VeganCheck";
22+
const url = `https://vegancheck.me/?ean=${barcode}`;
2323

2424
const handleCopyClick = () => {
2525
navigator.clipboard
@@ -90,7 +90,7 @@ const ShareButton: React.FC<ShareButtonProps> = ({ productName, barcode }) => {
9090
text,
9191
url,
9292
})
93-
.catch((err) => {});
93+
.catch((err) => {console.error(err)});
9494
}}
9595
>
9696
{t("share")}

src/components/elements/shortcutinstall.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import { useState, useEffect, FC } from "react";
23
import Image from "next/image";
34
import { useTranslations } from "next-intl";

src/components/footer.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import Head from "next/head";
2-
import Link from "next/link";
1+
/* eslint-disable @next/next/no-img-element */
32
import Image from "next/image";
43
import { useTranslations } from "next-intl";
54

src/components/ingredientscheck.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { useTranslations } from "next-intl";
44
import Image from "next/image";
55
import ModalWrapper from "@/components/elements/modalwrapper";
66

7-
interface FlaggedItem {
7+
export interface FlaggedItem {
88
item: string;
99
index: number;
1010
}
1111

12-
const IngredientsCheck: React.FC = () => {
12+
const IngredientsCheck = () => {
1313
const t = useTranslations("Ingredients");
1414
const [flagged, setFlagged] = useState<string[]>([]);
1515
const [vegan, setVegan] = useState<string | boolean>("");

src/components/nav.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Head from "next/head";
22
import Link from "next/link";
3-
import Image from "next/image";
43
import { useRouter } from "next/router";
54
import { useEffect } from "react";
65
import { GetStaticPropsContext } from "next";

src/pages/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Image from "next/image";
21
import Nav from "@/components/nav";
32
import Footer from "@/components/footer";
43
import ProductSearch from "@/components/check";

0 commit comments

Comments
 (0)