From ea1cc4d8dcbc3caad8625b351a7051278ef7fce9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 11 Nov 2024 12:28:44 +1100 Subject: [PATCH 01/45] Fix for useReturnOrderLineItemFields (#8462) - Remove 'responsible' field from form-set - Not actually available on the endpoint --- src/frontend/src/forms/ReturnOrderForms.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/frontend/src/forms/ReturnOrderForms.tsx b/src/frontend/src/forms/ReturnOrderForms.tsx index a9427dfc67..743c43b7fc 100644 --- a/src/frontend/src/forms/ReturnOrderForms.tsx +++ b/src/frontend/src/forms/ReturnOrderForms.tsx @@ -115,13 +115,7 @@ export function useReturnOrderLineItemFields({ price_currency: {}, target_date: {}, notes: {}, - link: {}, - responsible: { - filters: { - is_active: true - }, - icon: - } + link: {} }; }, [create, orderId, customerId]); } From ff81cb61f2530c463581a6c9c31e50e12e8bd258 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:47:29 +1100 Subject: [PATCH 02/45] Bump the dependencies group with 3 updates (#8463) Bumps the dependencies group with 3 updates: [anchore/sbom-action](https://github.com/anchore/sbom-action), [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) and [github/codeql-action](https://github.com/github/codeql-action). Updates `anchore/sbom-action` from 0.17.6 to 0.17.7 - [Release notes](https://github.com/anchore/sbom-action/releases) - [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md) - [Commits](https://github.com/anchore/sbom-action/compare/251a468eed47e5082b105c3ba6ee500c0e65a764...fc46e51fd3cb168ffb36c6d1915723c47db58abb) Updates `actions/attest-build-provenance` from 1.4.3 to 1.4.4 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](https://github.com/actions/attest-build-provenance/compare/1c608d11d69870c2092266b3f9a6f3abbf17002c...ef244123eb79f2f7a7e75d99086184180e6d0018) Updates `github/codeql-action` from 3.27.0 to 3.27.1 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/662472033e021d55d94146f66f6058822b0b39fd...4f3212b61783c3c68e8309a0f18a699764811cda) --- updated-dependencies: - dependency-name: anchore/sbom-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: actions/attest-build-provenance dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yaml | 4 ++-- .github/workflows/scorecard.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 77ee9eea1c..52b3da2bb9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -49,7 +49,7 @@ jobs: - name: Build frontend run: cd src/frontend && npm run compile && npm run build - name: Create SBOM for frontend - uses: anchore/sbom-action@251a468eed47e5082b105c3ba6ee500c0e65a764 # pin@v0 + uses: anchore/sbom-action@fc46e51fd3cb168ffb36c6d1915723c47db58abb # pin@v0 with: artifact-name: frontend-build.spdx path: src/frontend @@ -63,7 +63,7 @@ jobs: zip -r ../frontend-build.zip * .vite - name: Attest Build Provenance id: attest - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # pin@v1 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # pin@v1 with: subject-path: "${{ github.workspace }}/src/backend/InvenTree/web/static/frontend-build.zip" diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index a1fdebafbb..f0eb5d866b 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1 with: sarif_file: results.sarif From e7cfb4c3c0dbd4036490348b0878d597921e54f8 Mon Sep 17 00:00:00 2001 From: Chris Thorn Date: Mon, 11 Nov 2024 22:48:16 +0000 Subject: [PATCH 03/45] Add level indicators and path to stock location and part category dropdowns (#8366) * Add level indicators and path to stock location dropdown * Add level indicators and path to part category dropdown * Updated stock location string to include location path * Fix PUI form test (set location) --------- Co-authored-by: Matthias Mair --- src/frontend/src/components/render/Part.tsx | 4 ++-- src/frontend/src/components/render/Stock.tsx | 4 ++-- src/frontend/tests/pages/pui_scan.spec.ts | 2 +- src/frontend/tests/pui_forms.spec.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/render/Part.tsx b/src/frontend/src/components/render/Part.tsx index de0635541c..a7f404e48a 100644 --- a/src/frontend/src/components/render/Part.tsx +++ b/src/frontend/src/components/render/Part.tsx @@ -63,11 +63,11 @@ export function RenderPartCategory( tooltip={instance.pathstring} prefix={ <> -
+ {instance.level > 0 && `${'- '.repeat(instance.level)}`} {instance.icon && } } - primary={instance.name} + primary={instance.pathstring} secondary={instance.description} url={ props.link diff --git a/src/frontend/src/components/render/Stock.tsx b/src/frontend/src/components/render/Stock.tsx index 6d0854f05c..8c0c75220f 100644 --- a/src/frontend/src/components/render/Stock.tsx +++ b/src/frontend/src/components/render/Stock.tsx @@ -21,11 +21,11 @@ export function RenderStockLocation( tooltip={instance.pathstring} prefix={ <> -
+ {instance.level > 0 && `${'- '.repeat(instance.level)}`} {instance.icon && } } - primary={instance.name} + primary={instance.pathstring} secondary={instance.description} url={ props.link diff --git a/src/frontend/tests/pages/pui_scan.spec.ts b/src/frontend/tests/pages/pui_scan.spec.ts index 35c2d94342..0d021b7132 100644 --- a/src/frontend/tests/pages/pui_scan.spec.ts +++ b/src/frontend/tests/pages/pui_scan.spec.ts @@ -73,7 +73,7 @@ test('Scanning (StockLocation)', async ({ page }) => { await defaultScanTest(page, '{"stocklocation": 3}'); // stocklocation: 3 - await page.getByText('Storage Room B', { exact: true }).waitFor(); + await page.getByText('Factory/Storage Room B', { exact: true }).waitFor(); await page.getByText('Storage Room B (green door)').waitFor(); await page.getByRole('cell', { name: 'stocklocation' }).waitFor(); }); diff --git a/src/frontend/tests/pui_forms.spec.ts b/src/frontend/tests/pui_forms.spec.ts index 9512f4d0b0..222b19ef4d 100644 --- a/src/frontend/tests/pui_forms.spec.ts +++ b/src/frontend/tests/pui_forms.spec.ts @@ -39,7 +39,7 @@ test('Forms - Stock Item Validation', async ({ page }) => { // Set location await page.getByLabel('related-field-location').click(); - await page.getByRole('option', { name: /Electronics Lab/ }).click(); + await page.getByText('Electronics production facility').click(); // Create the stock item await page.getByLabel('number-field-quantity').fill('123'); From 0872beaba95a0e350b734a273ed97a4bb29dd197 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Tue, 12 Nov 2024 01:03:08 +0100 Subject: [PATCH 04/45] [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 6c6a62f9f9..ade75a833a 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 302c7d4a69..1c5df1a003 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 0000000000..dcc97bee63 --- /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 0000000000..04b0a9dd9b --- /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 0000000000..1db36e4666 --- /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 32e336ba22..fc10ce92ed 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 3df4eac0cd..0000000000 --- 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 b15982d7c6..0000000000 --- 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 24818dccbe..f093dba680 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 126b9b76fb..a0d8181f97 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 4b8d6265b3..57583cfb9b 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 adece8195f..397fc2ed6e 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 60a7107ecd..0bd5093077 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 be9bef9904..d2b137a94b 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 6f2c733ec9..c42db4adbd 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 39c7211405..7a941d3bb3 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 65aa4defae..5bd94c9adc 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 ( -