Skip to content

Commit

Permalink
migrate from prettier to biome
Browse files Browse the repository at this point in the history
  • Loading branch information
irsyadadl committed Feb 14, 2025
1 parent 2377a9b commit 86c025f
Show file tree
Hide file tree
Showing 66 changed files with 2,248 additions and 1,902 deletions.
6 changes: 0 additions & 6 deletions .prettierignore

This file was deleted.

12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

80 changes: 80 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": ["vendor", "node_modules", "resources/js/ziggy.js"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "warn",
"useImportType": "error"
},
"complexity": {
"useArrowFunction": "error"
},
"a11y": {
"noSvgWithoutTitle": "off",
"useValidAnchor": "off",
"useSemanticElements": "off"
},
"correctness": {
"useHookAtTopLevel": "error",
"noUnusedImports": "error",
"useExhaustiveDependencies": "off",
"noChildrenProp": "off"
},
"suspicious": {
"noExplicitAny": "off",
"noArrayIndexKey": "off",
"noConsoleLog": "warn"
},
"nursery": {
"useSortedClasses": {
"level": "error",
"fix": "safe",
"options": {
"attributes": ["classList"],
"functions": ["cn", "twJoin", "tv", "composeRenderProps", "composeTailwindRenderProps"]
}
}
}
},
"ignore": []
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100,
"ignore": []
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"arrowParentheses": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"semicolons": "asNeeded",
"trailingCommas": "all"
}
},
"json": {
"formatter": {
"trailingCommas": "none"
}
}
}
Binary file modified bun.lockb
Binary file not shown.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build && vite build --ssr",
"format": "prettier --write .",
"format": "biome format --write resources/js && biome lint --fix resources/js",
"release": "export GITHUB_TOKEN=$(cat .github_token) && release-it",
"preview": "tsc && npm run build && php artisan inertia:start-ssr"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@commitlint/cli": "^19.7.1",
"@commitlint/config-conventional": "^19.7.1",
"@inertiajs/react": "^2.0.3",
Expand All @@ -21,9 +22,6 @@
"axios": "^1.7.9",
"husky": "^9.1.7",
"laravel-vite-plugin": "^1.2.0",
"prettier": "^3.5.1",
"prettier-plugin-organize-imports": "^4.1.0",
"prettier-plugin-tailwindcss": "^0.6.11",
"release-it": "^17.11.0",
"tailwindcss": "^4.0.6",
"typescript": "^5.7.3",
Expand Down
37 changes: 19 additions & 18 deletions resources/js/app.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
import '../css/app.css';
import './bootstrap';
import "../css/app.css"
import "./bootstrap"

import { Providers } from '@/components/providers';
import { Ziggy } from '@/ziggy';
import { createInertiaApp } from '@inertiajs/react';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { createRoot, hydrateRoot } from 'react-dom/client';
import { useRoute } from 'ziggy-js';
import { Providers } from "@/components/providers"
import { Ziggy } from "@/ziggy"
import { createInertiaApp } from "@inertiajs/react"
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers"
import { createRoot, hydrateRoot } from "react-dom/client"
import { useRoute } from "ziggy-js"

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
const appName = import.meta.env.VITE_APP_NAME || "Laravel"

createInertiaApp({
title: (title) => (title ? title + ' / ' + appName : appName),
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
title: (title) => (title ? `${title} / ${appName}` : appName),
resolve: (name) =>
resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob("./pages/**/*.tsx")),
setup({ el, App, props }) {
// @ts-expect-error
window.route = useRoute(Ziggy as any);
window.route = useRoute(Ziggy as any)
const appElement = (
<Providers>
<App {...props} />
</Providers>
);
)
if (import.meta.env.SSR) {
hydrateRoot(el, appElement);
return;
hydrateRoot(el, appElement)
return
}

createRoot(el).render(appElement);
createRoot(el).render(appElement)
},
progress: false
});
progress: false,
})
6 changes: 3 additions & 3 deletions resources/js/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from 'axios';
import axios from "axios"

window.axios = axios;
window.axios = axios

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"
20 changes: 10 additions & 10 deletions resources/js/components/flash-message.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { FlashMessageData } from '@/types/index';
import { usePage } from '@inertiajs/react';
import { useEffect } from 'react';
import { toast } from 'sonner';
import { Toast } from 'ui';
import type { FlashMessageData } from "@/types"
import { usePage } from "@inertiajs/react"
import { useEffect } from "react"
import { toast } from "sonner"
import { Toast } from "ui"

export function FlashMessage() {
const { flash_message } = usePage<{ flash_message: FlashMessageData }>().props;
const { flash_message } = usePage<{ flash_message: FlashMessageData }>().props
useEffect(() => {
if (flash_message && flash_message.message) {
(toast as any)[flash_message.type](flash_message.message);
if (flash_message?.message) {
;(toast as any)[flash_message.type](flash_message.message)
}
}, [flash_message]);
return <Toast />;
}, [flash_message])
return <Toast />
}
Loading

0 comments on commit 86c025f

Please sign in to comment.