From 1757f4cb04c401a5efcfc7fc69a684b7da7298af Mon Sep 17 00:00:00 2001
From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
Date: Tue, 14 May 2024 10:06:44 -0500
Subject: [PATCH] Use prettier-plugin-tailwindcss (#11373)
* use prettier-plugin-tailwindcss to keep class names organized
* use prettierrc file to ensure formatting on save works with vscode
* classname reorder with prettier-plugin-tailwindcss
---
web/.eslintrc.cjs | 6 ++
web/.prettierrc | 3 +
web/package-lock.json | 91 +++++++++++++++++--
web/package.json | 1 +
web/src/App.tsx | 2 +-
web/src/components/Statusbar.tsx | 16 ++--
web/src/components/Wrapper.tsx | 2 +-
web/src/components/bar/TimelineBar.tsx | 52 +++++------
web/src/components/camera/CameraImage.tsx | 6 +-
.../components/camera/DebugCameraImage.tsx | 4 +-
.../components/camera/ResizingCameraImage.tsx | 4 +-
web/src/components/card/AnimatedEventCard.tsx | 8 +-
web/src/components/card/ExportCard.tsx | 24 ++---
web/src/components/card/ReviewCard.tsx | 6 +-
.../dynamic/CameraFeatureToggle.tsx | 2 +-
web/src/components/dynamic/NewReviewData.tsx | 8 +-
.../components/filter/CameraGroupSelector.tsx | 40 ++++----
web/src/components/filter/FilterSwitch.tsx | 4 +-
web/src/components/filter/LogLevelFilter.tsx | 12 +--
.../components/filter/ReviewActionGroup.tsx | 12 +--
.../components/filter/ReviewFilterGroup.tsx | 22 ++---
web/src/components/filter/ZoneMaskFilter.tsx | 10 +-
web/src/components/graph/SystemGraph.tsx | 10 +-
web/src/components/icons/IconPicker.tsx | 14 +--
web/src/components/icons/LiveIcons.tsx | 8 +-
.../indicators/CameraActivityIndicator.tsx | 12 +--
web/src/components/indicators/Chip.tsx | 4 +-
.../indicators/ImageLoadingIndicator.tsx | 2 +-
web/src/components/menu/AccountSettings.tsx | 4 +-
web/src/components/menu/GeneralSettings.tsx | 38 ++++----
web/src/components/navigation/Bottombar.tsx | 10 +-
web/src/components/navigation/NavItem.tsx | 2 +-
web/src/components/navigation/Sidebar.tsx | 8 +-
web/src/components/overlay/ExportDialog.tsx | 18 ++--
web/src/components/overlay/LogInfoDialog.tsx | 6 +-
.../components/overlay/MobileCameraDrawer.tsx | 6 +-
.../overlay/MobileReviewSettingsDrawer.tsx | 24 ++---
.../overlay/MobileTimelineDrawer.tsx | 6 +-
.../overlay/ReviewActivityCalendar.tsx | 2 +-
.../components/overlay/SaveExportOverlay.tsx | 6 +-
.../overlay/TimelineDataOverlay.tsx | 4 +-
web/src/components/overlay/VainfoDialog.tsx | 2 +-
.../components/player/BirdseyeLivePlayer.tsx | 12 +--
web/src/components/player/HlsVideoPlayer.tsx | 4 +-
web/src/components/player/LivePlayer.tsx | 20 ++--
web/src/components/player/PreviewPlayer.tsx | 14 +--
.../player/PreviewThumbnailPlayer.tsx | 20 ++--
web/src/components/player/VideoControls.tsx | 10 +-
web/src/components/settings/General.tsx | 16 ++--
web/src/components/settings/MasksAndZones.tsx | 40 ++++----
.../settings/MotionMaskEditPane.tsx | 8 +-
web/src/components/settings/MotionTuner.tsx | 26 +++---
.../settings/ObjectMaskEditPane.tsx | 8 +-
.../components/settings/ObjectSettings.tsx | 38 ++++----
.../settings/PolygonEditControls.tsx | 4 +-
web/src/components/settings/PolygonItem.tsx | 8 +-
web/src/components/settings/ZoneEditPane.tsx | 26 +++---
web/src/components/timeline/EventSegment.tsx | 10 +-
web/src/components/timeline/MotionSegment.tsx | 8 +-
.../components/timeline/ReviewTimeline.tsx | 40 ++++----
.../components/timeline/SummarySegment.tsx | 2 +-
.../components/timeline/SummaryTimeline.tsx | 6 +-
.../components/timeline/segment-metadata.tsx | 10 +-
web/src/pages/ConfigEditor.tsx | 8 +-
web/src/pages/Exports.tsx | 8 +-
web/src/pages/Logs.tsx | 40 ++++----
web/src/pages/Settings.tsx | 18 ++--
web/src/pages/SubmitPlus.tsx | 46 +++++-----
web/src/pages/System.tsx | 16 ++--
web/src/pages/UIPlayground.tsx | 14 +--
web/src/utils/timelineUtil.tsx | 36 ++++----
web/src/views/events/EventView.tsx | 48 +++++-----
web/src/views/events/RecordingView.tsx | 36 ++++----
web/src/views/live/DraggableGridLayout.tsx | 24 ++---
web/src/views/live/LiveBirdseyeView.tsx | 12 +--
web/src/views/live/LiveCameraView.tsx | 14 +--
web/src/views/live/LiveDashboardView.tsx | 20 ++--
web/src/views/system/CameraMetrics.tsx | 24 ++---
web/src/views/system/GeneralMetrics.tsx | 46 +++++-----
web/src/views/system/StorageMetrics.tsx | 18 ++--
80 files changed, 682 insertions(+), 597 deletions(-)
create mode 100644 web/.prettierrc
diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs
index deba5f544..883537d0f 100644
--- a/web/.eslintrc.cjs
+++ b/web/.eslintrc.cjs
@@ -44,6 +44,12 @@ module.exports = {
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"no-console": "error",
+ "prettier/prettier": [
+ "warn",
+ {
+ plugins: ["prettier-plugin-tailwindcss"],
+ },
+ ],
},
overrides: [
{
diff --git a/web/.prettierrc b/web/.prettierrc
new file mode 100644
index 000000000..b4bfed357
--- /dev/null
+++ b/web/.prettierrc
@@ -0,0 +1,3 @@
+{
+ "plugins": ["prettier-plugin-tailwindcss"]
+}
diff --git a/web/package-lock.json b/web/package-lock.json
index 1a680777a..77db8051e 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -96,9 +96,10 @@
"fake-indexeddb": "^5.0.2",
"jest-websocket-mock": "^2.5.0",
"jsdom": "^24.0.0",
- "msw": "^2.2.14",
+ "msw": "^2.3.0",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
+ "prettier-plugin-tailwindcss": "^0.5.14",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"vite": "^5.2.11",
@@ -848,9 +849,9 @@
}
},
"node_modules/@mswjs/interceptors": {
- "version": "0.26.15",
- "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.26.15.tgz",
- "integrity": "sha512-HM47Lu1YFmnYHKMBynFfjCp0U/yRskHj/8QEJW0CBEPOlw8Gkmjfll+S9b8M7V5CNDw2/ciRxjjnWeaCiblSIQ==",
+ "version": "0.29.1",
+ "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.29.1.tgz",
+ "integrity": "sha512-3rDakgJZ77+RiQUuSK69t1F0m8BQKA8Vh5DCS5V0DWvNY67zob2JhhQrhCO0AKLGINTRSFd1tBaHcJTkhefoSw==",
"dev": true,
"dependencies": {
"@open-draft/deferred-promise": "^2.2.0",
@@ -5595,9 +5596,9 @@
"dev": true
},
"node_modules/msw": {
- "version": "2.2.14",
- "resolved": "https://registry.npmjs.org/msw/-/msw-2.2.14.tgz",
- "integrity": "sha512-64i8rNCa1xzDK8ZYsTrVMli05D687jty8+Th+PU5VTbJ2/4P7fkQFVyDQ6ZFT5FrNR8z2BHhbY47fKNvfHrumA==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/msw/-/msw-2.3.0.tgz",
+ "integrity": "sha512-cDr1q/QTMzaWhY8n9lpGhceY209k29UZtdTgJ3P8Bzne3TSMchX2EM/ldvn4ATLOktpCefCU2gcEgzHc31GTPw==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@@ -5605,7 +5606,7 @@
"@bundled-es-modules/statuses": "^1.0.1",
"@inquirer/confirm": "^3.0.0",
"@mswjs/cookies": "^1.1.0",
- "@mswjs/interceptors": "^0.26.14",
+ "@mswjs/interceptors": "^0.29.0",
"@open-draft/until": "^2.1.0",
"@types/cookie": "^0.6.0",
"@types/statuses": "^2.0.4",
@@ -6181,6 +6182,80 @@
"node": ">=6.0.0"
}
},
+ "node_modules/prettier-plugin-tailwindcss": {
+ "version": "0.5.14",
+ "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.14.tgz",
+ "integrity": "sha512-Puaz+wPUAhFp8Lo9HuciYKM2Y2XExESjeT+9NQoVFXZsPPnc9VYss2SpxdQ6vbatmt8/4+SN0oe0I1cPDABg9Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=14.21.3"
+ },
+ "peerDependencies": {
+ "@ianvs/prettier-plugin-sort-imports": "*",
+ "@prettier/plugin-pug": "*",
+ "@shopify/prettier-plugin-liquid": "*",
+ "@trivago/prettier-plugin-sort-imports": "*",
+ "@zackad/prettier-plugin-twig-melody": "*",
+ "prettier": "^3.0",
+ "prettier-plugin-astro": "*",
+ "prettier-plugin-css-order": "*",
+ "prettier-plugin-import-sort": "*",
+ "prettier-plugin-jsdoc": "*",
+ "prettier-plugin-marko": "*",
+ "prettier-plugin-organize-attributes": "*",
+ "prettier-plugin-organize-imports": "*",
+ "prettier-plugin-sort-imports": "*",
+ "prettier-plugin-style-order": "*",
+ "prettier-plugin-svelte": "*"
+ },
+ "peerDependenciesMeta": {
+ "@ianvs/prettier-plugin-sort-imports": {
+ "optional": true
+ },
+ "@prettier/plugin-pug": {
+ "optional": true
+ },
+ "@shopify/prettier-plugin-liquid": {
+ "optional": true
+ },
+ "@trivago/prettier-plugin-sort-imports": {
+ "optional": true
+ },
+ "@zackad/prettier-plugin-twig-melody": {
+ "optional": true
+ },
+ "prettier-plugin-astro": {
+ "optional": true
+ },
+ "prettier-plugin-css-order": {
+ "optional": true
+ },
+ "prettier-plugin-import-sort": {
+ "optional": true
+ },
+ "prettier-plugin-jsdoc": {
+ "optional": true
+ },
+ "prettier-plugin-marko": {
+ "optional": true
+ },
+ "prettier-plugin-organize-attributes": {
+ "optional": true
+ },
+ "prettier-plugin-organize-imports": {
+ "optional": true
+ },
+ "prettier-plugin-sort-imports": {
+ "optional": true
+ },
+ "prettier-plugin-style-order": {
+ "optional": true
+ },
+ "prettier-plugin-svelte": {
+ "optional": true
+ }
+ }
+ },
"node_modules/pretty-format": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
diff --git a/web/package.json b/web/package.json
index 4638572a6..d41c9ea75 100644
--- a/web/package.json
+++ b/web/package.json
@@ -104,6 +104,7 @@
"msw": "^2.3.0",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
+ "prettier-plugin-tailwindcss": "^0.5.14",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"vite": "^5.2.11",
diff --git a/web/src/App.tsx b/web/src/App.tsx
index a86e79491..eb81bc812 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -31,7 +31,7 @@ function App() {
{isMobile &&