Skip to content

Commit

Permalink
refactor(lint): auto lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinTh committed Sep 12, 2024
1 parent 09df352 commit f3bffcc
Show file tree
Hide file tree
Showing 68 changed files with 170 additions and 169 deletions.
5 changes: 3 additions & 2 deletions packages/app-client/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* @refresh reload */

import '@unocss/reset/tailwind.css';
import 'virtual:uno.css';
import './app.css';

import { Suspense, render } from 'solid-js/web';
import { Router } from '@solidjs/router';
import { ColorModeProvider, ColorModeScript, createLocalStorageManager } from '@kobalte/core/color-mode';

Check failure on line 7 in packages/app-client/src/index.tsx

View workflow job for this annotation

GitHub Actions / ci-app-client

Expected "@kobalte/core/color-mode" to come before "./app.css"
import { Router } from '@solidjs/router';
import { Suspense, render } from 'solid-js/web';

Check failure on line 9 in packages/app-client/src/index.tsx

View workflow job for this annotation

GitHub Actions / ci-app-client

Expected "render" to come before "Suspense"
import { routes } from './routes';
import { NoteContextProvider } from './modules/notes/notes.context';

Check failure on line 11 in packages/app-client/src/index.tsx

View workflow job for this annotation

GitHub Actions / ci-app-client

Expected "./modules/notes/notes.context" to come before "./routes"

Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/src/modules/files/files.models.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { icons as tablerIconSet } from '@iconify-json/tabler';
import { values } from 'lodash-es';
import { describe, expect, test } from 'vitest';
import { icons as tablerIconSet } from '@iconify-json/tabler';
import { getFileIcon, iconByFileType } from './files.models';

describe('files models', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Component, type ComponentProps, type ParentComponent, createSignal, onCleanup, splitProps } from 'solid-js';
import { Button } from '@/modules/ui/components/button';
import { cn } from '@/modules/shared/style/cn';
import { Button } from '@/modules/ui/components/button';
import { type Component, type ComponentProps, createSignal, onCleanup, type ParentComponent, splitProps } from 'solid-js';

const DropArea: Component<{ onFilesDrop?: (args: { files: File[] }) => void }> = (props) => {
const [isDragging, setIsDragging] = createSignal(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@/modules/ui/components/button';
import { TextField } from '@/modules/ui/components/textfield';
import { type Component, createSignal } from 'solid-js';
import { createRandomPassword } from '../notes.models';
import { TextField } from '@/modules/ui/components/textfield';
import { Button } from '@/modules/ui/components/button';

export const NotePasswordField: Component<{ getPassword: () => string; setPassword: (value: string) => void }> = (props) => {
const [getShowPassword, setShowPassword] = createSignal(false);
Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/src/modules/notes/notes.services.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClient } from '../shared/http/http-client';

export { storeNote, fetchNoteById };
export { fetchNoteById, storeNote };

async function storeNote({
payload,
Expand Down
26 changes: 13 additions & 13 deletions packages/app-client/src/modules/notes/pages/create-note.page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { type Component, Match, Show, Switch, createSignal, onCleanup, onMount } from 'solid-js';
import { encryptAndCreateNote } from '../notes.usecases';
import { useNoteContext } from '../notes.context';
import { NotePasswordField } from '../components/note-password-field';
import { FileUploaderButton } from '../components/file-uploader';
import { TextArea } from '@/modules/ui/components/textarea';
import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';
import { Button } from '@/modules/ui/components/button';
import { Tabs, TabsIndicator, TabsList, TabsTrigger } from '@/modules/ui/components/tabs';
import { SwitchControl, SwitchLabel, SwitchThumb, Switch as SwitchUiComponent } from '@/modules/ui/components/switch';
import { Alert, AlertDescription } from '@/modules/ui/components/alert';
import { CopyButton } from '@/modules/shared/utils/copy';
import { getFileIcon } from '@/modules/files/files.models';
import { isHttpErrorWithCode, isRateLimitError } from '@/modules/shared/http/http-errors';
import { cn } from '@/modules/shared/style/cn';
import { getFileIcon } from '@/modules/files/files.models';
import { CopyButton } from '@/modules/shared/utils/copy';
import { Alert, AlertDescription } from '@/modules/ui/components/alert';
import { Button } from '@/modules/ui/components/button';
import { SwitchControl, SwitchLabel, SwitchThumb, Switch as SwitchUiComponent } from '@/modules/ui/components/switch';
import { Tabs, TabsIndicator, TabsList, TabsTrigger } from '@/modules/ui/components/tabs';
import { TextArea } from '@/modules/ui/components/textarea';
import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';
import { type Component, createSignal, Match, onCleanup, onMount, Show, Switch } from 'solid-js';
import { FileUploaderButton } from '../components/file-uploader';
import { NotePasswordField } from '../components/note-password-field';
import { useNoteContext } from '../notes.context';
import { encryptAndCreateNote } from '../notes.usecases';

export const CreateNotePage: Component = () => {
const [getContent, setContent] = createSignal('');
Expand Down
22 changes: 11 additions & 11 deletions packages/app-client/src/modules/notes/pages/view-note.page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useLocation, useParams } from '@solidjs/router';
import { type Component, Match, Show, Switch, createSignal, onMount } from 'solid-js';
import { getFileIcon } from '@/modules/files/files.models';
import { isHttpErrorWithCode, isRateLimitError } from '@/modules/shared/http/http-errors';
import { cn } from '@/modules/shared/style/cn';
import { CopyButton } from '@/modules/shared/utils/copy';
import { Alert, AlertDescription } from '@/modules/ui/components/alert';
import { Button } from '@/modules/ui/components/button';
import { Card, CardContent, CardDescription, CardHeader } from '@/modules/ui/components/card';
import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';
import { formatBytes, safely } from '@corentinth/chisels';
import { decryptNote, noteAssetsToFiles, parseNoteUrlHashFragment } from '@enclosed/lib';
import { useLocation, useParams } from '@solidjs/router';
import JSZip from 'jszip';
import { formatBytes, safely } from '@corentinth/chisels';
import { type Component, createSignal, Match, onMount, Show, Switch } from 'solid-js';
import { fetchNoteById } from '../notes.services';
import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';
import { Card, CardContent, CardDescription, CardHeader } from '@/modules/ui/components/card';
import { Button } from '@/modules/ui/components/button';
import { isHttpErrorWithCode, isRateLimitError } from '@/modules/shared/http/http-errors';
import { Alert, AlertDescription } from '@/modules/ui/components/alert';
import { CopyButton } from '@/modules/shared/utils/copy';
import { getFileIcon } from '@/modules/files/files.models';
import { cn } from '@/modules/shared/style/cn';

const RequestPasswordForm: Component<{ onPasswordEntered: (args: { password: string }) => void; getIsPasswordInvalid: () => boolean; setIsPasswordInvalid: (value: boolean) => void }> = (props) => {
const [getPassword, setPassword] = createSignal('');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { isFetchResponseJson, getBody };
export { getBody, isFetchResponseJson };

function isFetchResponseJson({ response }: { response: Response }): boolean {
return Boolean(response.headers.get('content-type')?.includes('application/json'));
Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/src/modules/shared/http/http-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getBody } from './http-client.models';
import { config } from '@/modules/config/config';
import { getBody } from './http-client.models';

export { apiClient };

Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/src/modules/shared/utils/copy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ComponentProps, ParentComponent } from 'solid-js';
import { createSignal } from 'solid-js';
import { Button } from '@/modules/ui/components/button';
import { createSignal } from 'solid-js';

export function useCopy() {
const [getIsJustCopied, setIsJustCopied] = createSignal(false);
Expand Down
6 changes: 3 additions & 3 deletions packages/app-client/src/modules/ui/components/alert.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { AlertRootProps } from '@kobalte/core/alert';
import { Alert as AlertPrimitive } from '@kobalte/core/alert';
import type { PolymorphicProps } from '@kobalte/core/polymorphic';
import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import type { ComponentProps, ValidComponent } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { Alert as AlertPrimitive } from '@kobalte/core/alert';
import { cva } from 'class-variance-authority';
import { splitProps } from 'solid-js';

export const alertVariants = cva(
'relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:(absolute left-4 top-4 text-foreground)',
Expand Down
6 changes: 3 additions & 3 deletions packages/app-client/src/modules/ui/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { ButtonRootProps } from '@kobalte/core/button';
import { Button as ButtonPrimitive } from '@kobalte/core/button';
import type { PolymorphicProps } from '@kobalte/core/polymorphic';
import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import type { ValidComponent } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { Button as ButtonPrimitive } from '@kobalte/core/button';
import { cva } from 'class-variance-authority';
import { splitProps } from 'solid-js';

export const buttonVariants = cva(
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-shadow focus-visible:(outline-none ring-1.5 ring-ring) disabled:(pointer-events-none opacity-50) bg-inherit',
Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/src/modules/ui/components/card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ComponentProps, ParentComponent } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { splitProps } from 'solid-js';

export function Card(props: ComponentProps<'div'>) {
const [local, rest] = splitProps(props, ['class']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import type {
DropdownMenuSeparatorProps,
DropdownMenuSubTriggerProps,
} from '@kobalte/core/dropdown-menu';
import { DropdownMenu as DropdownMenuPrimitive } from '@kobalte/core/dropdown-menu';
import type { PolymorphicProps } from '@kobalte/core/polymorphic';
import type { ComponentProps, ParentProps, ValidComponent } from 'solid-js';
import { mergeProps, splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { DropdownMenu as DropdownMenuPrimitive } from '@kobalte/core/dropdown-menu';
import { mergeProps, splitProps } from 'solid-js';

export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
Expand Down
4 changes: 2 additions & 2 deletions packages/app-client/src/modules/ui/components/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type {
SwitchControlProps,
SwitchThumbProps,
} from '@kobalte/core/switch';
import { Switch as SwitchPrimitive } from '@kobalte/core/switch';
import type { ParentProps, ValidComponent, VoidProps } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { Switch as SwitchPrimitive } from '@kobalte/core/switch';
import { splitProps } from 'solid-js';

export const SwitchLabel = SwitchPrimitive.Label;
export const Switch = SwitchPrimitive;
Expand Down
6 changes: 3 additions & 3 deletions packages/app-client/src/modules/ui/components/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import type {
TabsRootProps,
TabsTriggerProps,
} from '@kobalte/core/tabs';
import { Tabs as TabsPrimitive } from '@kobalte/core/tabs';
import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import type { ValidComponent, VoidProps } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { Tabs as TabsPrimitive } from '@kobalte/core/tabs';
import { cva } from 'class-variance-authority';
import { splitProps } from 'solid-js';

type tabsProps<T extends ValidComponent = 'div'> = TabsRootProps<T> & {
class?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/app-client/src/modules/ui/components/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { PolymorphicProps } from '@kobalte/core/polymorphic';
import type { TextFieldTextAreaProps } from '@kobalte/core/text-field';
import { TextArea as TextFieldPrimitive } from '@kobalte/core/text-field';
import type { ValidComponent, VoidProps } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { TextArea as TextFieldPrimitive } from '@kobalte/core/text-field';
import { splitProps } from 'solid-js';

type textAreaProps<T extends ValidComponent = 'textarea'> = VoidProps<
TextFieldTextAreaProps<T> & {
Expand Down
4 changes: 2 additions & 2 deletions packages/app-client/src/modules/ui/components/textfield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import type {
TextFieldLabelProps,
TextFieldRootProps,
} from '@kobalte/core/text-field';
import type { ValidComponent, VoidProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';
import { TextField as TextFieldPrimitive } from '@kobalte/core/text-field';
import { cva } from 'class-variance-authority';
import type { ValidComponent, VoidProps } from 'solid-js';
import { splitProps } from 'solid-js';
import { cn } from '@/modules/shared/style/cn';

type textFieldProps<T extends ValidComponent = 'div'> =
TextFieldRootProps<T> & {
Expand Down
12 changes: 6 additions & 6 deletions packages/app-client/src/modules/ui/layouts/app.layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { A, useNavigate } from '@solidjs/router';
import type { Component, ParentComponent } from 'solid-js';
import { config } from '@/modules/config/config';
import { buildDocUrl } from '@/modules/docs/docs.models';
import { useNoteContext } from '@/modules/notes/notes.context';
import { useThemeStore } from '@/modules/theme/theme.store';
import { Button } from '@/modules/ui/components/button';
import { DropdownMenu } from '@kobalte/core/dropdown-menu';
import { A, useNavigate } from '@solidjs/router';
import { DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '../components/dropdown-menu';
import { Button } from '@/modules/ui/components/button';
import { useThemeStore } from '@/modules/theme/theme.store';
import { useNoteContext } from '@/modules/notes/notes.context';
import { buildDocUrl } from '@/modules/docs/docs.models';
import { config } from '@/modules/config/config';

export const Navbar: Component = () => {
const themeStore = useThemeStore();
Expand Down
4 changes: 2 additions & 2 deletions packages/app-client/src/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { A, type RouteDefinition } from '@solidjs/router';
import { AppLayout } from './modules/ui/layouts/app.layout';
import { NOTE_ID_REGEX } from './modules/notes/notes.constants';
import { CreateNotePage } from './modules/notes/pages/create-note.page';
import { ViewNotePage } from './modules/notes/pages/view-note.page';
import { Button } from './modules/ui/components/button';
import { NOTE_ID_REGEX } from './modules/notes/notes.constants';
import { AppLayout } from './modules/ui/layouts/app.layout';

export const routes: RouteDefinition[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/uno.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { chain } from 'lodash-es';
import {
defineConfig,
presetIcons,
Expand All @@ -7,7 +8,6 @@ import {
transformerVariantGroup,
} from 'unocss';
import presetAnimations from 'unocss-preset-animations';
import { chain } from 'lodash-es';
import { iconByFileType } from './src/modules/files/files.models';

export default defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/app-client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import process from 'node:process';
import unoCssPlugin from 'unocss/vite';
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import unoCssPlugin from 'unocss/vite';

export default defineConfig({
plugins: [
Expand Down
4 changes: 2 additions & 2 deletions packages/app-server/src/index.node.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import process, { env } from 'node:process';
import { serve } from '@hono/node-server';
import { serveStatic } from '@hono/node-server/serve-static';
import { createServer } from './modules/app/server';
import { getConfig } from './modules/app/config/config';
import { createServer } from './modules/app/server';

import { deleteExpiredNotesTask } from './modules/notes/tasks/delete-expired-notes.tasks';
import { createTaskScheduler } from './modules/tasks/task-scheduler';
import { createFsLiteStorage } from './modules/storage/factories/fs-lite.storage';
import { createTaskScheduler } from './modules/tasks/task-scheduler';

const config = getConfig({ env });
const { storage } = createFsLiteStorage({ config });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { merge } from 'lodash-es';
import type { DeepPartial } from '@corentinth/chisels';
import { getConfig } from './config';
import type { Config } from './config.types';
import { merge } from 'lodash-es';
import { getConfig } from './config';

export { overrideConfig };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Config } from '../config/config.types';
import { env as getEnv } from 'hono/adapter';
import { createMiddleware } from 'hono/factory';
import { getConfig } from '../config/config';
import type { Config } from '../config/config.types';

export function createConfigMiddleware({ config: initialConfig }: { config?: Config } = {}) {
return createMiddleware(async (c, next) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Context } from '../server.types';
import { cors } from 'hono/cors';
import { createMiddleware } from 'hono/factory';
import type { Context } from '../server.types';

export const corsMiddleware = createMiddleware(async (context: Context, next) => {
const { server: { corsOrigins } } = context.get('config');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ServerInstance } from '../server.types';
import { isCustomError } from '../../shared/errors/errors';
import { createLogger } from '../../shared/logger/logger';
import type { ServerInstance } from '../server.types';

const logger = createLogger({ namespace: 'middlewares:error' });

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createMiddleware } from 'hono/factory';
import type { BindableStorageFactory } from '../../storage/storage.types';
import { createMiddleware } from 'hono/factory';

export function createStorageMiddleware({ storageFactory }: { storageFactory: BindableStorageFactory }) {
return createMiddleware(async (context, next) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from 'vitest';
import { Hono } from 'hono';
import { timeoutMiddleware } from './timeout.middleware';
import { describe, expect, test } from 'vitest';
import { registerErrorMiddleware } from './errors.middleware';
import { timeoutMiddleware } from './timeout.middleware';

describe('middlewares', () => {
describe('timeoutMiddleware', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createMiddleware } from 'hono/factory';
import type { Context } from '../server.types';
import { createMiddleware } from 'hono/factory';
import { createError } from '../../shared/errors/errors';

export const timeoutMiddleware = createMiddleware(async (context: Context, next) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/app-server/src/modules/app/server.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { BindableStorageFactory } from '../storage/storage.types';
import type { Config } from './config/config.types';
import type { ServerInstanceGenerics } from './server.types';
import { Hono } from 'hono';
import { secureHeaders } from 'hono/secure-headers';
import { registerNotesRoutes } from '../notes/notes.routes';
import type { BindableStorageFactory } from '../storage/storage.types';
import type { ServerInstanceGenerics } from './server.types';
import { corsMiddleware } from './middlewares/cors.middleware';
import { createConfigMiddleware } from './middlewares/config.middleware';
import { loggerMiddleware } from './middlewares/logger.middleware';
import { corsMiddleware } from './middlewares/cors.middleware';
import { registerErrorMiddleware } from './middlewares/errors.middleware';
import { loggerMiddleware } from './middlewares/logger.middleware';
import { createStorageMiddleware } from './middlewares/storage.middleware';
import type { Config } from './config/config.types';
import { timeoutMiddleware } from './middlewares/timeout.middleware';

export { createServer };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest';
import { omit } from 'lodash-es';
import { describe, expect, test } from 'vitest';
import { createServer } from '../../app/server';
import { createMemoryStorage } from '../../storage/factories/memory.storage';

Expand Down
Loading

0 comments on commit f3bffcc

Please sign in to comment.