From 0872beaba95a0e350b734a273ed97a4bb29dd197 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Tue, 12 Nov 2024 01:03:08 +0100 Subject: [PATCH] [PUI] Switch linting to biome (#8317) * bump pre-commit * add biome * autofixes * use number functions * fix string usage * use specific variable definition * fix missing translations * reduce alerts * add missing keys * fix index creation * fix more strings * fix types * fix function * add missing keys * fiy array access * fix string functions * do not redefine var * extend exlcusions * reduce unnecessary operators * simplify request * use number functions * fix missing translation * add missing type * fix filter * use newer func * remove unused fragment * fix confusing assigment * pass children as elements * add missing translation * fix imports * fix import * auto-fix problems * add autfix for unused imports * fix SAST error * fix useSelfClosingElements * fix useTemplate * add codespell exception * Update pui_printing.spec.ts * Update pui_printing.spec.ts * add vscode defaults --- .devcontainer/devcontainer.json | 3 +- .pre-commit-config.yaml | 26 +--- .vscode/extensions.json | 5 + .vscode/settings.json | 8 ++ biome.json | 40 ++++++ pyproject.toml | 2 +- src/frontend/.prettierrc | 9 -- src/frontend/eslint.config.cjs | 7 -- src/frontend/src/App.tsx | 2 +- src/frontend/src/components/Boundary.tsx | 8 +- .../src/components/buttons/ActionButton.tsx | 11 +- .../src/components/buttons/AddItemButton.tsx | 4 +- .../src/components/buttons/AdminButton.tsx | 12 +- .../src/components/buttons/ButtonMenu.tsx | 6 +- .../src/components/buttons/CopyButton.tsx | 8 +- .../src/components/buttons/EditButton.tsx | 2 +- .../buttons/PrimaryActionButton.tsx | 8 +- .../components/buttons/PrintingActions.tsx | 14 +-- .../components/buttons/RemoveRowButton.tsx | 6 +- .../src/components/buttons/SSOButton.tsx | 6 +- .../src/components/buttons/ScanButton.tsx | 2 +- .../src/components/buttons/SplitButton.tsx | 10 +- .../components/buttons/SpotlightButton.tsx | 4 +- .../src/components/buttons/YesNoButton.tsx | 6 +- .../components/dashboard/DashboardLayout.tsx | 26 ++-- .../components/dashboard/DashboardMenu.tsx | 30 ++--- .../components/dashboard/DashboardWidget.tsx | 12 +- .../dashboard/DashboardWidgetDrawer.tsx | 30 ++--- .../dashboard/DashboardWidgetLibrary.tsx | 2 +- .../dashboard/widgets/ColorToggleWidget.tsx | 6 +- .../dashboard/widgets/GetStartedWidget.tsx | 4 +- .../widgets/LanguageSelectWidget.tsx | 6 +- .../dashboard/widgets/NewsWidget.tsx | 19 ++- .../widgets/QueryCountDashboardWidget.tsx | 38 +++--- .../src/components/details/Details.tsx | 79 ++++++------ .../src/components/details/DetailsBadge.tsx | 2 +- .../src/components/details/DetailsImage.tsx | 80 ++++++------ .../src/components/details/ItemDetails.tsx | 6 +- .../src/components/editors/NotesEditor.tsx | 13 +- .../TemplateEditor/CodeEditor/CodeEditor.tsx | 8 +- .../TemplateEditor/CodeEditor/index.tsx | 2 +- .../TemplateEditor/PdfPreview/PdfPreview.tsx | 10 +- .../TemplateEditor/PdfPreview/index.tsx | 2 +- .../editors/TemplateEditor/TemplateEditor.tsx | 37 +++--- .../components/errors/GenericErrorPage.tsx | 24 ++-- src/frontend/src/components/forms/ApiForm.tsx | 72 +++++------ .../components/forms/AuthenticationForm.tsx | 60 ++++----- .../src/components/forms/HostOptionsForm.tsx | 22 ++-- .../src/components/forms/InstanceOptions.tsx | 2 +- .../src/components/forms/StandaloneField.tsx | 2 +- .../components/forms/fields/ApiFormField.tsx | 31 ++--- .../components/forms/fields/ChoiceField.tsx | 8 +- .../src/components/forms/fields/DateField.tsx | 8 +- .../forms/fields/DependentField.tsx | 10 +- .../src/components/forms/fields/IconField.tsx | 20 +-- .../forms/fields/NestedObjectField.tsx | 10 +- .../forms/fields/RelatedModelField.tsx | 26 ++-- .../components/forms/fields/TableField.tsx | 28 ++--- .../src/components/forms/fields/TextField.tsx | 6 +- .../src/components/images/ApiImage.tsx | 4 +- .../src/components/images/Thumbnail.tsx | 10 +- .../importer/ImportDataSelector.tsx | 60 ++++----- .../importer/ImporterColumnSelector.tsx | 24 ++-- .../components/importer/ImporterDrawer.tsx | 34 ++--- .../importer/ImporterImportProgress.tsx | 8 +- .../src/components/items/ActionDropdown.tsx | 28 ++--- src/frontend/src/components/items/ApiIcon.tsx | 4 +- .../src/components/items/AttachmentLink.tsx | 10 +- .../src/components/items/BarcodeInput.tsx | 7 +- .../src/components/items/ColorToggle.tsx | 6 +- .../src/components/items/DashboardItem.tsx | 8 +- src/frontend/src/components/items/DocInfo.tsx | 2 +- .../src/components/items/DocTooltip.tsx | 8 +- .../src/components/items/ErrorItem.tsx | 2 +- .../items/GettingStartedCarousel.tsx | 12 +- .../src/components/items/InfoItem.tsx | 6 +- .../src/components/items/InvenTreeLogo.tsx | 2 +- .../src/components/items/LanguageSelect.tsx | 2 +- .../src/components/items/LanguageToggle.tsx | 8 +- .../src/components/items/MenuLinks.tsx | 11 +- .../src/components/items/Placeholder.tsx | 6 +- .../src/components/items/ProgressBar.tsx | 8 +- src/frontend/src/components/items/QRCode.tsx | 12 +- .../src/components/items/StylishText.tsx | 2 +- .../src/components/items/TitleWithDoc.tsx | 2 +- .../components/items/UnavailableIndicator.tsx | 2 +- .../components/modals/AboutInvenTreeModal.tsx | 31 ++--- .../src/components/modals/LicenseModal.tsx | 10 +- .../src/components/modals/QrCodeModal.tsx | 10 +- .../src/components/modals/ServerInfoModal.tsx | 20 +-- .../src/components/nav/BreadcrumbList.tsx | 16 +-- .../src/components/nav/DetailDrawer.tsx | 8 +- src/frontend/src/components/nav/Header.tsx | 26 ++-- src/frontend/src/components/nav/Layout.tsx | 10 +- src/frontend/src/components/nav/MainMenu.tsx | 10 +- .../src/components/nav/NavHoverMenu.tsx | 4 +- .../src/components/nav/NavigationDrawer.tsx | 20 +-- .../src/components/nav/NavigationTree.tsx | 34 ++--- .../src/components/nav/NotificationDrawer.tsx | 50 ++++---- .../src/components/nav/PageDetail.tsx | 28 ++--- .../src/components/nav/SearchDrawer.tsx | 84 ++++++------- .../src/components/nav/SettingsHeader.tsx | 24 ++-- .../src/components/panels/AttachmentPanel.tsx | 4 +- .../src/components/panels/NotesPanel.tsx | 5 +- src/frontend/src/components/panels/Panel.tsx | 2 +- .../src/components/panels/PanelGroup.tsx | 34 ++--- .../src/components/plugins/PluginContext.tsx | 12 +- .../src/components/plugins/PluginDrawer.tsx | 46 +++---- .../src/components/plugins/PluginPanel.tsx | 10 +- .../plugins/PluginSettingsPanel.tsx | 2 +- .../src/components/plugins/PluginSource.tsx | 2 +- .../components/plugins/PluginUIFeature.tsx | 18 +-- .../plugins/PluginUIFeatureTypes.ts | 16 +-- .../components/plugins/RemoteComponent.tsx | 10 +- src/frontend/src/components/render/Build.tsx | 4 +- .../src/components/render/Company.tsx | 10 +- .../src/components/render/Generic.tsx | 4 +- .../src/components/render/Instance.tsx | 18 ++- .../src/components/render/InstanceFromUrl.tsx | 2 +- .../src/components/render/ModelType.tsx | 4 +- src/frontend/src/components/render/Order.tsx | 8 +- src/frontend/src/components/render/Part.tsx | 10 +- src/frontend/src/components/render/Plugin.tsx | 4 +- src/frontend/src/components/render/Report.tsx | 2 +- .../src/components/render/StatusRenderer.tsx | 14 +-- src/frontend/src/components/render/Stock.tsx | 12 +- src/frontend/src/components/render/User.tsx | 4 +- .../components/settings/FactCollection.tsx | 2 +- .../src/components/settings/FactItem.tsx | 6 +- .../src/components/settings/SettingItem.tsx | 18 +-- .../src/components/settings/SettingList.tsx | 10 +- src/frontend/src/contexts/LanguageContext.tsx | 4 +- src/frontend/src/contexts/colorSchema.tsx | 4 +- src/frontend/src/defaults/actions.tsx | 22 ++-- src/frontend/src/defaults/defaultHostList.tsx | 2 +- src/frontend/src/defaults/defaults.tsx | 2 +- src/frontend/src/defaults/formatters.tsx | 16 +-- src/frontend/src/defaults/links.tsx | 8 +- src/frontend/src/forms/BomForms.tsx | 2 +- src/frontend/src/forms/BuildForms.tsx | 27 ++-- src/frontend/src/forms/CommonForms.tsx | 2 +- src/frontend/src/forms/CompanyForms.tsx | 2 +- src/frontend/src/forms/ImporterForms.tsx | 2 +- src/frontend/src/forms/PartForms.tsx | 8 +- src/frontend/src/forms/PurchaseOrderForms.tsx | 80 ++++++------ src/frontend/src/forms/ReturnOrderForms.tsx | 10 +- src/frontend/src/forms/SalesOrderForms.tsx | 14 +-- src/frontend/src/forms/StockForms.tsx | 55 ++++---- src/frontend/src/functions/auth.tsx | 8 +- src/frontend/src/functions/conversion.tsx | 4 +- src/frontend/src/functions/forms.tsx | 12 +- src/frontend/src/functions/icons.tsx | 6 +- src/frontend/src/functions/loading.tsx | 4 +- src/frontend/src/functions/tables.tsx | 4 +- src/frontend/src/functions/uid.tsx | 4 +- src/frontend/src/functions/urls.tsx | 6 +- src/frontend/src/hooks/UseDashboardItems.tsx | 6 +- src/frontend/src/hooks/UseFilter.tsx | 6 +- src/frontend/src/hooks/UseForm.tsx | 4 +- src/frontend/src/hooks/UseInstance.tsx | 10 +- src/frontend/src/hooks/UseModal.tsx | 7 +- src/frontend/src/hooks/UsePlaceholder.tsx | 4 +- src/frontend/src/hooks/UsePluginPanels.tsx | 12 +- src/frontend/src/hooks/UsePluginUIFeature.tsx | 2 +- src/frontend/src/hooks/UseStatusCodes.tsx | 6 +- src/frontend/src/hooks/UseTable.tsx | 6 +- src/frontend/src/main.css.ts | 2 +- src/frontend/src/main.tsx | 8 +- src/frontend/src/pages/Auth/Logged-In.tsx | 8 +- src/frontend/src/pages/Auth/Login.tsx | 8 +- src/frontend/src/pages/Auth/Logout.tsx | 8 +- src/frontend/src/pages/Auth/Reset.tsx | 8 +- src/frontend/src/pages/Auth/Set-Password.tsx | 6 +- src/frontend/src/pages/ErrorPage.tsx | 2 +- src/frontend/src/pages/Index/Scan.tsx | 72 +++++------ .../AccountSettings/AccountDetailPanel.tsx | 6 +- .../AccountSettings/SecurityContent.tsx | 40 +++--- .../Settings/AccountSettings/UserPanel.tsx | 6 +- .../AccountSettings/UserThemePanel.tsx | 22 ++-- .../AdminCenter/CurrencyManagmentPanel.tsx | 6 +- .../Index/Settings/AdminCenter/Index.tsx | 18 +-- .../AdminCenter/MachineManagementPanel.tsx | 24 ++-- .../AdminCenter/PluginManagementPanel.tsx | 16 +-- .../Settings/AdminCenter/StocktakePanel.tsx | 4 +- .../AdminCenter/TaskManagementPanel.tsx | 18 +-- .../AdminCenter/UnitManagmentPanel.tsx | 14 +-- .../AdminCenter/UserManagementPanel.tsx | 4 +- .../pages/Index/Settings/SystemSettings.tsx | 12 +- .../src/pages/Index/Settings/UserSettings.tsx | 12 +- src/frontend/src/pages/Notifications.tsx | 22 ++-- src/frontend/src/pages/build/BuildDetail.tsx | 31 ++--- src/frontend/src/pages/build/BuildIndex.tsx | 4 +- .../src/pages/company/CompanyDetail.tsx | 27 ++-- .../pages/company/ManufacturerPartDetail.tsx | 19 +-- .../src/pages/company/SupplierPartDetail.tsx | 27 ++-- .../src/pages/part/CategoryDetail.tsx | 28 +++-- .../src/pages/part/PartAllocationPanel.tsx | 8 +- src/frontend/src/pages/part/PartDetail.tsx | 103 ++++++++------- .../src/pages/part/PartPricingPanel.tsx | 4 +- .../src/pages/part/PartSchedulingDetail.tsx | 36 +++--- .../src/pages/part/PartStocktakeDetail.tsx | 17 +-- .../src/pages/part/PartSupplierDetail.tsx | 10 +- .../pages/part/pricing/BomPricingPanel.tsx | 42 +++---- .../pages/part/pricing/PriceBreakPanel.tsx | 12 +- .../part/pricing/PricingOverviewPanel.tsx | 29 +++-- .../src/pages/part/pricing/PricingPanel.tsx | 16 +-- .../part/pricing/PurchaseHistoryPanel.tsx | 31 ++--- .../pages/part/pricing/SaleHistoryPanel.tsx | 6 +- .../part/pricing/SupplierPricingPanel.tsx | 4 +- .../part/pricing/VariantPricingPanel.tsx | 8 +- .../pages/purchasing/PurchaseOrderDetail.tsx | 41 +++--- .../src/pages/purchasing/PurchasingIndex.tsx | 6 +- .../src/pages/sales/ReturnOrderDetail.tsx | 39 +++--- src/frontend/src/pages/sales/SalesIndex.tsx | 4 +- .../src/pages/sales/SalesOrderDetail.tsx | 45 +++---- .../pages/sales/SalesOrderShipmentDetail.tsx | 48 ++++--- .../src/pages/stock/LocationDetail.tsx | 39 +++--- src/frontend/src/pages/stock/StockDetail.tsx | 95 +++++++------- src/frontend/src/router.tsx | 88 ++++++------- src/frontend/src/states/ApiState.tsx | 2 +- src/frontend/src/states/IconState.tsx | 2 +- src/frontend/src/states/LocalState.tsx | 6 +- src/frontend/src/states/SettingsState.tsx | 16 +-- src/frontend/src/states/StatusState.tsx | 4 +- src/frontend/src/states/UserState.tsx | 6 +- src/frontend/src/tables/Column.tsx | 2 +- src/frontend/src/tables/ColumnRenderers.tsx | 24 ++-- src/frontend/src/tables/ColumnSelect.tsx | 6 +- src/frontend/src/tables/DownloadAction.tsx | 2 +- src/frontend/src/tables/Filter.tsx | 2 +- .../src/tables/FilterSelectDrawer.tsx | 63 +++++----- src/frontend/src/tables/InvenTreeTable.tsx | 69 +++++----- .../src/tables/InvenTreeTableHeader.tsx | 42 +++---- src/frontend/src/tables/RowActions.tsx | 14 +-- src/frontend/src/tables/RowExpansionIcon.tsx | 2 +- src/frontend/src/tables/Search.tsx | 2 +- src/frontend/src/tables/TableHoverCard.tsx | 20 +-- src/frontend/src/tables/bom/BomTable.tsx | 79 ++++++------ src/frontend/src/tables/bom/UsedInTable.tsx | 12 +- .../tables/build/BuildAllocatedStockTable.tsx | 8 +- .../src/tables/build/BuildLineTable.tsx | 68 +++++----- .../src/tables/build/BuildOrderTable.tsx | 6 +- .../src/tables/build/BuildOrderTestTable.tsx | 46 ++++--- .../src/tables/build/BuildOutputTable.tsx | 68 +++++----- .../src/tables/company/AddressTable.tsx | 16 +-- .../src/tables/company/CompanyTable.tsx | 10 +- .../src/tables/company/ContactTable.tsx | 14 +-- .../src/tables/general/AttachmentTable.tsx | 36 +++--- .../src/tables/general/ExtraLineItemTable.tsx | 10 +- .../src/tables/machine/MachineListTable.tsx | 92 +++++++------- .../src/tables/machine/MachineTypeTable.tsx | 68 +++++----- .../notifications/NotificationsTable.tsx | 8 +- .../src/tables/part/ParametricPartTable.tsx | 22 ++-- .../tables/part/PartBuildAllocationsTable.tsx | 6 +- .../src/tables/part/PartCategoryTable.tsx | 20 +-- .../tables/part/PartCategoryTemplateTable.tsx | 13 +- .../src/tables/part/PartParameterTable.tsx | 20 +-- .../part/PartParameterTemplateTable.tsx | 9 +- .../tables/part/PartPurchaseOrdersTable.tsx | 16 +-- .../tables/part/PartSalesAllocationsTable.tsx | 6 +- src/frontend/src/tables/part/PartTable.tsx | 46 ++++--- .../src/tables/part/PartTestTemplateTable.tsx | 28 ++--- .../src/tables/part/PartThumbTable.tsx | 19 +-- .../src/tables/part/PartVariantTable.tsx | 2 +- .../src/tables/part/RelatedPartTable.tsx | 16 +-- .../src/tables/plugin/PluginErrorTable.tsx | 2 +- .../src/tables/plugin/PluginListTable.tsx | 38 +++--- .../ManufacturerPartParameterTable.tsx | 6 +- .../purchasing/ManufacturerPartTable.tsx | 12 +- .../purchasing/PurchaseOrderLineItemTable.tsx | 28 ++--- .../tables/purchasing/PurchaseOrderTable.tsx | 8 +- .../tables/purchasing/SupplierPartTable.tsx | 22 ++-- .../purchasing/SupplierPriceBreakTable.tsx | 22 ++-- .../tables/sales/ReturnOrderLineItemTable.tsx | 10 +- .../src/tables/sales/ReturnOrderTable.tsx | 10 +- .../sales/SalesOrderAllocationTable.tsx | 10 +- .../tables/sales/SalesOrderLineItemTable.tsx | 36 +++--- .../tables/sales/SalesOrderShipmentTable.tsx | 8 +- .../src/tables/sales/SalesOrderTable.tsx | 10 +- .../settings/BarcodeScanHistoryTable.tsx | 40 +++--- .../src/tables/settings/CustomStateTable.tsx | 5 +- .../src/tables/settings/CustomUnitsTable.tsx | 6 +- .../src/tables/settings/ErrorTable.tsx | 18 +-- .../src/tables/settings/FailedTasksTable.tsx | 8 +- .../src/tables/settings/GroupTable.tsx | 8 +- .../tables/settings/ImportSessionTable.tsx | 8 +- .../src/tables/settings/PendingTasksTable.tsx | 2 +- .../src/tables/settings/ProjectCodeTable.tsx | 5 +- .../tables/settings/ScheduledTasksTable.tsx | 8 +- .../tables/settings/StocktakeReportTable.tsx | 6 +- .../src/tables/settings/TemplateTable.tsx | 26 ++-- .../src/tables/settings/UserTable.tsx | 18 +-- .../src/tables/stock/InstalledItemsTable.tsx | 3 +- .../src/tables/stock/LocationTypesTable.tsx | 8 +- .../src/tables/stock/StockItemTable.tsx | 118 +++++++++--------- .../tables/stock/StockItemTestResultTable.tsx | 28 ++--- .../src/tables/stock/StockLocationTable.tsx | 14 +-- .../src/tables/stock/StockTrackingTable.tsx | 10 +- .../src/tables/stock/TestStatisticsTable.tsx | 26 ++-- src/frontend/src/views/MobileAppView.tsx | 4 +- src/frontend/tests/baseFixtures.ts | 12 +- src/frontend/tests/cui.spec.ts | 2 +- src/frontend/tests/login.ts | 2 +- src/frontend/tests/pages/pui_build.spec.ts | 14 +-- src/frontend/tests/pages/pui_part.spec.ts | 6 +- src/frontend/tests/pui_basic.spec.ts | 6 +- src/frontend/tests/pui_printing.spec.ts | 2 +- src/frontend/vite.config.ts | 2 +- 308 files changed, 2635 insertions(+), 2550 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 biome.json delete mode 100644 src/frontend/.prettierrc delete mode 100644 src/frontend/eslint.config.cjs diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6c6a62f9f901..ade75a833aac 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -31,7 +31,8 @@ "ms-python.python", "ms-python.vscode-pylance", "batisteo.vscode-django", - "eamodio.gitlens" + "eamodio.gitlens", + "biomejs.biome" ] } }, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 302c7d4a6913..1c5df1a003d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -69,26 +69,12 @@ repos: pyproject.toml | src/frontend/vite.config.ts | )$ -- repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" - hooks: - - id: prettier - files: ^src/frontend/.*\.(js|jsx|ts|tsx)$ - additional_dependencies: - - "prettier@^2.4.1" - - "@trivago/prettier-plugin-sort-imports" -- repo: https://github.com/pre-commit/mirrors-eslint - rev: "v9.12.0" - hooks: - - id: eslint - additional_dependencies: - - eslint@^8.41.0 - - eslint-config-google@^0.14.0 - - eslint-plugin-react@6.10.3 - - babel-eslint@6.1.2 - - "@typescript-eslint/eslint-plugin@latest" - - "@typescript-eslint/parser" - files: ^src/frontend/.*\.(js|jsx|ts|tsx)$ +- repo: https://github.com/biomejs/pre-commit + rev: "v0.5.0" + hooks: + - id: biome-check + additional_dependencies: ["@biomejs/biome@1.9.4"] + files: ^src/frontend/.*\.(js|ts|tsx)$ - repo: https://github.com/gitleaks/gitleaks rev: v8.21.0 hooks: diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000000..dcc97bee6388 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "biomejs.biome" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000000..04b0a9dd9b30 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "[typescript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "editor.codeActionsOnSave": { + "quickfix.biome": "explicit" + } +} diff --git a/biome.json b/biome.json new file mode 100644 index 000000000000..1db36e466675 --- /dev/null +++ b/biome.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "javascript": { + "formatter": { + "quoteStyle": "single", + "jsxQuoteStyle": "single", + "trailingCommas": "none", + "indentStyle": "space" + } + }, + "linter": { + "rules": { + "suspicious" : { + "noExplicitAny": "off", + "noDoubleEquals": "off", + "noArrayIndexKey": "off", + "useDefaultSwitchClauseLast": "off" + }, + "style": { + "noUselessElse": "off", + "noNonNullAssertion": "off", + "noParameterAssign": "off" + }, "correctness":{ + "useExhaustiveDependencies": "off", + "useJsxKeyInIterable": "off", + "noUnsafeOptionalChaining": "off", + "noSwitchDeclarations": "off", + "noUnusedImports":"error" + }, "complexity": { + "noBannedTypes": "off", + "noExtraBooleanCast": "off", + "noForEach": "off", + "noUselessSwitchCase": "off", + "useLiteralKeys":"off" + }, "performance": { + "noDelete":"off" + } + } +} +} diff --git a/pyproject.toml b/pyproject.toml index 32e336ba227a..fc10ce92edc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,4 +106,4 @@ known_django="django" sections=["FUTURE","STDLIB","DJANGO","THIRDPARTY","FIRSTPARTY","LOCALFOLDER"] [tool.codespell] -ignore-words-list = ["assertIn","SME","intoto"] +ignore-words-list = ["assertIn","SME","intoto","fitH"] diff --git a/src/frontend/.prettierrc b/src/frontend/.prettierrc deleted file mode 100644 index 3df4eac0cd8c..000000000000 --- a/src/frontend/.prettierrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "semi": true, - "trailingComma": "none", - "singleQuote": true, - "printWidth": 80, - "importOrder": ["", "^[./]"], - "importOrderSeparation": true, - "importOrderSortSpecifiers": true -} diff --git a/src/frontend/eslint.config.cjs b/src/frontend/eslint.config.cjs deleted file mode 100644 index b15982d7c656..000000000000 --- a/src/frontend/eslint.config.cjs +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-env node */ -module.exports = { - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - root: true, - }; diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 24818dccbe3e..f093dba68036 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -23,7 +23,7 @@ export function setApiDefaults() { api.defaults.xsrfHeaderName = 'X-CSRFToken'; if (token) { - api.defaults.headers['Authorization'] = `Token ${token}`; + api.defaults.headers.Authorization = `Token ${token}`; } else { delete api.defaults.headers['Authorization']; } diff --git a/src/frontend/src/components/Boundary.tsx b/src/frontend/src/components/Boundary.tsx index 126b9b76fbf9..a0d8181f9767 100644 --- a/src/frontend/src/components/Boundary.tsx +++ b/src/frontend/src/components/Boundary.tsx @@ -1,15 +1,15 @@ import { t } from '@lingui/macro'; import { Alert } from '@mantine/core'; -import { ErrorBoundary, FallbackRender } from '@sentry/react'; +import { ErrorBoundary, type FallbackRender } from '@sentry/react'; import { IconExclamationCircle } from '@tabler/icons-react'; -import { ReactNode, useCallback } from 'react'; +import { type ReactNode, useCallback } from 'react'; function DefaultFallback({ title }: Readonly<{ title: string }>): ReactNode { return ( } - title={t`Error rendering component` + `: ${title}`} + title={`${t`Error rendering component`}: ${title}`} > {t`An error occurred while rendering this component. Refer to the console for more information.`} diff --git a/src/frontend/src/components/buttons/ActionButton.tsx b/src/frontend/src/components/buttons/ActionButton.tsx index 4b8d6265b34d..57583cfb9baf 100644 --- a/src/frontend/src/components/buttons/ActionButton.tsx +++ b/src/frontend/src/components/buttons/ActionButton.tsx @@ -1,5 +1,10 @@ -import { ActionIcon, FloatingPosition, Group, Tooltip } from '@mantine/core'; -import { ReactNode } from 'react'; +import { + ActionIcon, + type FloatingPosition, + Group, + Tooltip +} from '@mantine/core'; +import type { ReactNode } from 'react'; import { identifierString } from '../../functions/conversion'; @@ -46,7 +51,7 @@ export function ActionButton(props: ActionButtonProps) { }} variant={props.variant ?? 'transparent'} > - + {props.icon} diff --git a/src/frontend/src/components/buttons/AddItemButton.tsx b/src/frontend/src/components/buttons/AddItemButton.tsx index adece8195f28..397fc2ed6e9e 100644 --- a/src/frontend/src/components/buttons/AddItemButton.tsx +++ b/src/frontend/src/components/buttons/AddItemButton.tsx @@ -1,10 +1,10 @@ import { IconPlus } from '@tabler/icons-react'; -import { ActionButton, ActionButtonProps } from './ActionButton'; +import { ActionButton, type ActionButtonProps } from './ActionButton'; /** * A generic icon button which is used to add or create a new item */ export function AddItemButton(props: Readonly) { - return } />; + return } />; } diff --git a/src/frontend/src/components/buttons/AdminButton.tsx b/src/frontend/src/components/buttons/AdminButton.tsx index 60a7107ecdb1..0bd5093077cf 100644 --- a/src/frontend/src/components/buttons/AdminButton.tsx +++ b/src/frontend/src/components/buttons/AdminButton.tsx @@ -2,7 +2,7 @@ import { t } from '@lingui/macro'; import { IconUserStar } from '@tabler/icons-react'; import { useCallback, useMemo } from 'react'; -import { ModelType } from '../../enums/ModelType'; +import type { ModelType } from '../../enums/ModelType'; import { useServerApiState } from '../../states/ApiState'; import { useLocalState } from '../../states/LocalState'; import { useUserState } from '../../states/UserState'; @@ -78,14 +78,14 @@ export default function AdminButton(props: Readonly) { return ( } - color="blue" - size="lg" - radius="sm" - variant="filled" + color='blue' + size='lg' + radius='sm' + variant='filled' tooltip={t`Open in admin interface`} hidden={!enabled} onClick={openAdmin} - tooltipAlignment="bottom" + tooltipAlignment='bottom' /> ); } diff --git a/src/frontend/src/components/buttons/ButtonMenu.tsx b/src/frontend/src/components/buttons/ButtonMenu.tsx index be9bef990430..d2b137a94b21 100644 --- a/src/frontend/src/components/buttons/ButtonMenu.tsx +++ b/src/frontend/src/components/buttons/ButtonMenu.tsx @@ -16,16 +16,16 @@ export function ButtonMenu({ tooltip?: string; }>) { return ( - + - + {icon} {label && {label}} {actions.map((action, i) => ( - {action} + {action} ))} diff --git a/src/frontend/src/components/buttons/CopyButton.tsx b/src/frontend/src/components/buttons/CopyButton.tsx index 6f2c733ec961..c42db4adbd6c 100644 --- a/src/frontend/src/components/buttons/CopyButton.tsx +++ b/src/frontend/src/components/buttons/CopyButton.tsx @@ -3,7 +3,7 @@ import { ActionIcon, Button, CopyButton as MantineCopyButton, - MantineSize, + type MantineSize, Text, Tooltip } from '@mantine/core'; @@ -30,13 +30,13 @@ export function CopyButton({ {copied ? ( - + ) : ( - + )} {content} {label && ( diff --git a/src/frontend/src/components/buttons/EditButton.tsx b/src/frontend/src/components/buttons/EditButton.tsx index 39c72114054e..7a941d3bb38f 100644 --- a/src/frontend/src/components/buttons/EditButton.tsx +++ b/src/frontend/src/components/buttons/EditButton.tsx @@ -17,7 +17,7 @@ export function EditButton({ setEditing()} disabled={disabled} - variant="default" + variant='default' > {editing ? saveIcon : } diff --git a/src/frontend/src/components/buttons/PrimaryActionButton.tsx b/src/frontend/src/components/buttons/PrimaryActionButton.tsx index 65aa4defaecf..5bd94c9adcf7 100644 --- a/src/frontend/src/components/buttons/PrimaryActionButton.tsx +++ b/src/frontend/src/components/buttons/PrimaryActionButton.tsx @@ -1,6 +1,6 @@ import { Button, Tooltip } from '@mantine/core'; -import { InvenTreeIcon, InvenTreeIconType } from '../../functions/icons'; +import { InvenTreeIcon, type InvenTreeIconType } from '../../functions/icons'; /** * A "primary action" button for display on a page detail, (for example) @@ -25,12 +25,12 @@ export default function PrimaryActionButton({ } return ( -