From 84ac28713dceb1775bbd91138f99b407d6e6ad51 Mon Sep 17 00:00:00 2001 From: Tomas Psota Date: Thu, 31 Oct 2024 13:16:07 +0100 Subject: [PATCH] chore: linter fixes --- package.json | 2 +- src/App.tsx | 2 +- src/components/ConfigModal.tsx | 4 ++-- src/components/MalwareItem.tsx | 3 +++ src/pages/{FreeRaspDemo.css => MalwareDetectionDemo.css} | 0 src/pages/{FreeRaspDemo.tsx => MalwareDetectionDemo.tsx} | 4 +++- 6 files changed, 10 insertions(+), 5 deletions(-) rename src/pages/{FreeRaspDemo.css => MalwareDetectionDemo.css} (100%) rename src/pages/{FreeRaspDemo.tsx => MalwareDetectionDemo.tsx} (91%) diff --git a/package.json b/package.json index 369f6aa..7dbf768 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "build": "react-scripts build", "verify": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint", "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format", - "eslint": "eslint . --ext ts", + "eslint": "eslint . --ext ts,.tsx.js.jsx", "prettier": "prettier \"**/*.{css,html,ts,js,java}\"", "typecheck": "tsc --noEmit", "test": "react-scripts test --transformIgnorePatterns 'node_modules/(?!(@ionic/react|@ionic/react-router|@ionic/core|@stencil/core|ionicons)/)'", diff --git a/src/App.tsx b/src/App.tsx index a2503c5..4a75fcb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { IonApp, setupIonicReact } from '@ionic/react'; -import MalwareDetectionDemo from './pages/FreeRaspDemo'; +import MalwareDetectionDemo from './pages/MalwareDetectionDemo'; import { startFreeRASP, SuspiciousAppInfo } from 'capacitor-freerasp'; diff --git a/src/components/ConfigModal.tsx b/src/components/ConfigModal.tsx index dadd308..e8eb498 100644 --- a/src/components/ConfigModal.tsx +++ b/src/components/ConfigModal.tsx @@ -16,7 +16,7 @@ import './ConfigModal.css'; const ConfigModal: React.FC<{ visible: boolean; - onClose: () => any; + onClose: () => void; }> = ({ visible, onClose }) => { return ( @@ -59,7 +59,7 @@ const ConfigModal: React.FC<{
{config.androidConfig.malwareConfig.blocklistedPermissions.map( - (permissionGroup: string[], index: number) => ( + (permissionGroup: string[]) => ( <>

{'['}

{permissionGroup.map((permission, permIndex) => ( diff --git a/src/components/MalwareItem.tsx b/src/components/MalwareItem.tsx index 002da0b..caffe53 100644 --- a/src/components/MalwareItem.tsx +++ b/src/components/MalwareItem.tsx @@ -24,11 +24,14 @@ export const MalwareItem: React.FC<{ app: SuspiciousAppInfo }> = ({ app }) => { const whitelistApp = async (packageName: string) => { try { const whitelistResponse = await addToWhitelist(packageName); + // eslint-disable-next-line no-console console.info( `Malware Whitelist response for ${app}: ${whitelistResponse}`, ); alert('Restart app for whitelist to take effect'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (error: any) { + // eslint-disable-next-line no-console console.info('Error while adding app to malware whitelist: ', error); } }; diff --git a/src/pages/FreeRaspDemo.css b/src/pages/MalwareDetectionDemo.css similarity index 100% rename from src/pages/FreeRaspDemo.css rename to src/pages/MalwareDetectionDemo.css diff --git a/src/pages/FreeRaspDemo.tsx b/src/pages/MalwareDetectionDemo.tsx similarity index 91% rename from src/pages/FreeRaspDemo.tsx rename to src/pages/MalwareDetectionDemo.tsx index f18c146..70cbfe4 100644 --- a/src/pages/FreeRaspDemo.tsx +++ b/src/pages/MalwareDetectionDemo.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import TalsecLogo from '../assets/talsec-logo.png'; -import './FreeRaspDemo.css'; +import './MalwareDetectionDemo.css'; import '../theme/variables.css'; import { IonHeader, IonImg, IonTitle, IonToolbar } from '@ionic/react'; @@ -25,10 +25,12 @@ const MalwareDetectionDemo: React.FC<{ appsToWhitelist.map(async app => { try { const whitelistResponse = await addToWhitelist(app); + // eslint-disable-next-line no-console console.info( `${app} stored to Malware Whitelist: ${whitelistResponse}`, ); } catch (error) { + // eslint-disable-next-line no-console console.info('Malware whitelist failed: ', error); } }),