diff --git a/.prettierrc b/.prettierrc index 28cff452b..36ee950c2 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,10 @@ { + "plugins": ["@trivago/prettier-plugin-sort-imports"], "useTabs": true, "printWidth": 100, "singleQuote": true, "trailingComma": "none", - "jsxBracketSameLine": false, + "bracketSameLine": false, "semi": true, "quoteProps": "consistent", "importOrder": [ diff --git a/.vscode/settings.json b/.vscode/settings.json index 05a5dc79c..fba57d79b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,7 +22,5 @@ "editor.defaultFormatter": "matklad.rust-analyzer" }, "rust-analyzer.procMacro.enable": true, - "rust-analyzer.diagnostics.experimental.enable": false, - "rust-analyzer.inlayHints.parameterHints.enable": false, - "rust-analyzer.inlayHints.typeHints.enable": false + "rust-analyzer.diagnostics.experimental.enable": false } diff --git a/apps/desktop/src/index.tsx b/apps/desktop/src/index.tsx index 423e5c79e..8c60d8351 100644 --- a/apps/desktop/src/index.tsx +++ b/apps/desktop/src/index.tsx @@ -1,17 +1,18 @@ -import React, { useEffect, useState } from 'react'; -import { createRoot } from 'react-dom/client'; -// import Spacedrive interface -import SpacedriveInterface, { Platform } from '@sd/interface'; -import { listen, Event } from '@tauri-apps/api/event'; -// import types from Spacedrive core (TODO: re-export from client would be cleaner) -import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core'; // import Spacedrive JS client import { BaseTransport } from '@sd/client'; +// import types from Spacedrive core (TODO: re-export from client would be cleaner) +import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core'; +// import Spacedrive interface +import SpacedriveInterface, { Platform } from '@sd/interface'; // import tauri apis import { dialog, invoke, os, shell } from '@tauri-apps/api'; +import { Event, listen } from '@tauri-apps/api/event'; import { convertFileSrc } from '@tauri-apps/api/tauri'; -import '@sd/ui/style'; import { appWindow } from '@tauri-apps/api/window'; +import React, { useEffect, useState } from 'react'; +import { createRoot } from 'react-dom/client'; + +import '@sd/ui/style'; // bind state to core via Tauri class Transport extends BaseTransport { diff --git a/apps/desktop/vite.config.ts b/apps/desktop/vite.config.ts index a787cf66e..7c6347331 100644 --- a/apps/desktop/vite.config.ts +++ b/apps/desktop/vite.config.ts @@ -1,8 +1,9 @@ -import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; -import { name, version } from './package.json'; +import { defineConfig } from 'vite'; import svg from 'vite-plugin-svgr'; +import { name, version } from './package.json'; + // https://vitejs.dev/config/ export default defineConfig({ server: { diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 4a80ecfcd..20df5a4b5 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -1,8 +1,7 @@ -import React, { useEffect } from 'react'; - -import SpacedriveInterface from '@sd/interface'; -import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core'; import { BaseTransport } from '@sd/client'; +import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core'; +import SpacedriveInterface from '@sd/interface'; +import React, { useEffect } from 'react'; const websocket = new WebSocket(import.meta.env.VITE_SDSERVER_BASE_URL || 'ws://localhost:8080/ws'); diff --git a/apps/web/src/index.tsx b/apps/web/src/index.tsx index 1a2c714a6..612be37fb 100644 --- a/apps/web/src/index.tsx +++ b/apps/web/src/index.tsx @@ -1,8 +1,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; -import App from './App'; + import '@sd/ui/style'; +import App from './App'; + const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); root.render( diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index effd9e0e7..3f946dc2d 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; import svg from 'vite-plugin-svgr'; import tsconfigPaths from 'vite-plugin-tsconfig-paths'; diff --git a/core/src/node/mod.rs b/core/src/node/mod.rs index 6110f1225..6589d1ad1 100644 --- a/core/src/node/mod.rs +++ b/core/src/node/mod.rs @@ -67,10 +67,7 @@ impl LibraryNode { .create( node::pub_id::set(config.node_pub_id.clone()), node::name::set(hostname.clone()), - vec![ - node::platform::set(platform as i32), - node::online::set(Some(true)), - ], + vec![node::platform::set(platform as i32)], ) .exec() .await? diff --git a/docs/architecture/database.md b/docs/architecture/database.md index 0533d3a63..6f90bc537 100644 --- a/docs/architecture/database.md +++ b/docs/architecture/database.md @@ -1,13 +1,9 @@ ## Database backup - - ## Database migrations Currently migrations are applied on app launch with no visual feedback, backup or error handling. -It doesn't appear that migrations are applied succesfully +It doesn't appear that migrations are applied succesfully - - -## \ No newline at end of file +## diff --git a/docs/architecture/distributed-data-sync.md b/docs/architecture/distributed-data-sync.md index db35b07d2..de2c85705 100644 --- a/docs/architecture/distributed-data-sync.md +++ b/docs/architecture/distributed-data-sync.md @@ -81,7 +81,7 @@ This allows us to entirely avoid the need to synchronize time between clients, a Sync happens in the following order: -Owned data → Bulk shared data → Shared data +Owned data → Bulk shared data → Shared data ### Types of CRDT: diff --git a/package.json b/package.json index 715b63961..a484b87b5 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "db:migrate": "pnpm core prisma migrate dev", "db:gen": "pnpm core prisma generate", "lint": "turbo run lint", - "format": "prettier --write \"**/*.{ts,tsx,md}\"", + "format": "prettier --write \"**/*.{ts,tsx,html,scss,json,yml,md}\"", "desktop": "pnpm --filter @sd/desktop --", "mobile": "pnpm --filter @sd/mobile -- ", "web": "pnpm --filter @sd/web -- ", @@ -23,6 +23,7 @@ "typecheck": "pnpm -r exec tsc" }, "devDependencies": { + "@trivago/prettier-plugin-sort-imports": "^3.2.0", "prettier": "^2.6.2", "turbo": "^1.2.4" }, diff --git a/packages/client/src/bridge.ts b/packages/client/src/bridge.ts index a1042d3ca..e7f4e6176 100644 --- a/packages/client/src/bridge.ts +++ b/packages/client/src/bridge.ts @@ -1,11 +1,11 @@ import { ClientCommand, ClientQuery, CoreResponse } from '@sd/core'; import { EventEmitter } from 'eventemitter3'; import { - useMutation, - useQuery, + UseMutationOptions, UseQueryOptions, UseQueryResult, - UseMutationOptions + useMutation, + useQuery } from 'react-query'; // global var to store the transport TODO: not global :D diff --git a/packages/client/src/files/query.ts b/packages/client/src/files/query.ts index a4a89bd75..a8ce691f0 100644 --- a/packages/client/src/files/query.ts +++ b/packages/client/src/files/query.ts @@ -1,7 +1,8 @@ -import { useQuery } from 'react-query'; import { useState } from 'react'; -import { useFileExplorerState } from './state'; +import { useQuery } from 'react-query'; + import { useBridgeCommand, useBridgeQuery } from '../bridge'; +import { useFileExplorerState } from './state'; // this hook initializes the explorer state and queries the core export function useFileExplorer(initialPath = '/', initialLocation: number | null = null) { diff --git a/packages/interface/package.json b/packages/interface/package.json index d1bb3178a..e96a2d613 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -54,7 +54,6 @@ "zustand": "^3.7.2" }, "devDependencies": { - "@trivago/prettier-plugin-sort-imports": "^3.2.0", "@types/babel-core": "^6.25.7", "@types/byte-size": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/packages/ui/src/Button.tsx b/packages/ui/src/Button.tsx index 9cae111eb..59274bcc0 100644 --- a/packages/ui/src/Button.tsx +++ b/packages/ui/src/Button.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import clsx from 'clsx'; +import React from 'react'; const sizes = { default: 'py-1 px-3 text-md font-medium', diff --git a/packages/ui/src/Dropdown.tsx b/packages/ui/src/Dropdown.tsx index 2aa5d251b..03c9d053b 100644 --- a/packages/ui/src/Dropdown.tsx +++ b/packages/ui/src/Dropdown.tsx @@ -1,7 +1,8 @@ -import React from 'react'; import { Menu } from '@headlessui/react'; import { ChevronDownIcon } from '@heroicons/react/solid'; import clsx from 'clsx'; +import React from 'react'; + import { Button } from './Button'; type Section = { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 838962d33..5530241e2 100644 Binary files a/pnpm-lock.yaml and b/pnpm-lock.yaml differ