Skip to content

Commit 4898372

Browse files
committed
chore: modernize and optimize tsconfig architecture for Vite
Refactored the TypeScript configuration to use a more modern setup, splitting the configuration to properly isolate browser and Node environments. Key changes: - Remove deprecated options for `moduleResolution` and `baseUrl` - `tsconfig.json`: Converted to a pure solution file that delegates to project-specific references (`app` and `node`). - Environment Isolation: - `tsconfig.app.json` now exclusively governs the browser code - `tsconfig.node.json` governs the build tooling - Upgraded Module Resolution: Changed `moduleResolution` from `node` to `bundler` - Modern Build Flags: Introduced `allowImportingTsExtensions` and `useDefineForClassFields` for strictly standard ES module generation. - Strict Type-Checking: Enabled `strict`, `noUnusedLocals`, `noUnusedParameters`, and `noFallthroughCasesInSwitch` to enforce higher code quality and prevent dead code. - audit fix Used commands: ``` npm audit fix ``` Signed-off-by: Omar <omar.brbutovic@secomind.com>
1 parent 8a4bb93 commit 4898372

25 files changed

Lines changed: 65 additions & 74 deletions

frontend/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"init": "npm run relay:compile && npm run i18n:compile",
7373
"start": "vite",
7474
"prestart": "npm run init",
75-
"build": "tsc -P tsconfig.build.json && vite build",
75+
"build": "tsc -p tsconfig.build.json && vite build",
7676
"prebuild": "npm run init",
7777
"preview": "vite preview",
7878
"relay:generate-schema": "cd ../backend && mix absinthe.schema.sdl --schema EdgehogWeb.Schema ../frontend/src/api/schema.graphql",
@@ -81,7 +81,7 @@
8181
"check-format": "prettier --check .",
8282
"lint": "eslint --fix src",
8383
"check-lint": "eslint src",
84-
"check-types": "tsc --noEmit",
84+
"check-types": "tsc --noEmit -p tsconfig.app.json",
8585
"precheck-types": "npm run init",
8686
"test": "TZ=UTC vitest",
8787
"pretest": "npm run init",

frontend/src/components/ConnectionStatus.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* SPDX-License-Identifier: Apache-2.0
1919
*/
2020

21-
import React from "react";
2221
import { useIntl } from "react-intl";
2322

2423
import Icon from "@/components/Icon";

frontend/src/components/DeleteApplicationModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const DeleteApplicationModal = <A extends Application>({
5959
const handleDeleteApplication = useCallback(() => {
6060
deleteApplication({
6161
variables: { id: applicationToDelete.id },
62-
onCompleted(data, errors) {
62+
onCompleted(_data, errors) {
6363
if (errors) {
6464
const errorFeedback = errors
6565
.map((error) => error.message)

frontend/src/components/DeleteReleaseModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const DeleteReleaseModal = <R extends Release>({
5959
const handleDeleteRelease = useCallback(() => {
6060
deleteRelease({
6161
variables: { id: releaseToDelete.id },
62-
onCompleted(data, errors) {
62+
onCompleted(_data, errors) {
6363
if (errors) {
6464
const errorFeedback = errors
6565
.map((error) => error.message)

frontend/src/components/DeployedApplicationsTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ const DeployedApplicationsTable = ({
400400
if (isOnline) {
401401
sendDeployment({
402402
variables: { id: deploymentId },
403-
onCompleted: (data, errors) => {
403+
onCompleted: (_data, errors) => {
404404
if (errors) {
405405
const errorFeedback = errors
406406
.map(({ fields, message }) =>
@@ -438,7 +438,7 @@ const DeployedApplicationsTable = ({
438438
if (isOnline) {
439439
startDeployment({
440440
variables: { id: deploymentId },
441-
onCompleted: (data, errors) => {
441+
onCompleted: (_data, errors) => {
442442
if (errors) {
443443
const errorFeedback = errors
444444
.map(({ fields, message }) =>
@@ -476,7 +476,7 @@ const DeployedApplicationsTable = ({
476476
if (isOnline) {
477477
stopDeployment({
478478
variables: { id: deploymentId },
479-
onCompleted: (data, errors) => {
479+
onCompleted: (_data, errors) => {
480480
if (errors) {
481481
const errorFeedback = errors
482482
.map(({ fields, message }) =>
@@ -513,7 +513,7 @@ const DeployedApplicationsTable = ({
513513
(deploymentId: string) => {
514514
deleteDeployment({
515515
variables: { id: deploymentId },
516-
onCompleted(data, errors) {
516+
onCompleted(_data, errors) {
517517
if (
518518
!errors ||
519519
errors.length === 0 ||
@@ -562,7 +562,7 @@ const DeployedApplicationsTable = ({
562562
id: deploymentId,
563563
input: { target: upgradeTargetReleaseId },
564564
},
565-
onCompleted(data, errors) {
565+
onCompleted(_data, errors) {
566566
if (
567567
!errors ||
568568
errors.length === 0 ||

frontend/src/components/LedBehaviorDropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of Edgehog.
33
*
4-
* Copyright 2022-2025 SECO Mind Srl
4+
* Copyright 2022-2026 SECO Mind Srl
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -121,7 +121,7 @@ const LedBehaviorDropdown = ({ deviceId, disabled, onError }: Props) => {
121121
behavior: ledBehavior,
122122
},
123123
},
124-
onCompleted(data, errors) {
124+
onCompleted(_data, errors) {
125125
if (errors) {
126126
const errorFeedback = errors
127127
.map(({ fields, message }) =>

frontend/src/pages/BaseImageCollection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const BaseImageCollectionContent = ({
207207
const handleDeleteBaseImageCollection = useCallback(() => {
208208
deleteBaseImageCollection({
209209
variables: { baseImageCollectionId },
210-
onCompleted(data, errors) {
210+
onCompleted(_data, errors) {
211211
if (!errors || errors.length === 0 || errors[0].code === "not_found") {
212212
return navigate({ route: Route.baseImageCollections });
213213
}
@@ -265,7 +265,7 @@ const BaseImageCollectionContent = ({
265265
input: changes,
266266
first: 10_000,
267267
},
268-
onCompleted(data, errors) {
268+
onCompleted(_data, errors) {
269269
if (errors) {
270270
const errorFeedback = errors
271271
.map(({ fields, message }) =>

frontend/src/pages/Channel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of Edgehog.
33
*
4-
* Copyright 2023-2025 SECO Mind Srl
4+
* Copyright 2023-2026 SECO Mind Srl
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -138,7 +138,7 @@ const ChannelContent = ({ queryRef, channel }: ChannelContentProps) => {
138138
const handleDeleteChannel = useCallback(() => {
139139
deleteChannel({
140140
variables: { channelId },
141-
onCompleted(data, errors) {
141+
onCompleted(_data, errors) {
142142
if (!errors || errors.length === 0 || errors[0].code === "not_found") {
143143
return navigate({ route: Route.channels });
144144
}

frontend/src/pages/DeploymentCampaign.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const CampaignActions = ({
175175
const handlePauseCampaign = useCallback(() => {
176176
pauseCampaign({
177177
variables: { id: deploymentCampaignId },
178-
onCompleted(data, errors) {
178+
onCompleted(_data, errors) {
179179
if (!errors || errors.length === 0 || errors[0].code === "not_found") {
180180
setErrorFeedback(null);
181181
return;
@@ -202,7 +202,7 @@ const CampaignActions = ({
202202
const handleResumeCampaign = useCallback(() => {
203203
resumeCampaign({
204204
variables: { id: deploymentCampaignId },
205-
onCompleted(data, errors) {
205+
onCompleted(_data, errors) {
206206
if (!errors || errors.length === 0 || errors[0].code === "not_found") {
207207
setErrorFeedback(null);
208208
return;

0 commit comments

Comments
 (0)