Skip to content

Commit

Permalink
feat: add Biome formatting code and optimize project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sun0225SUN committed Jan 31, 2025
1 parent 52b17ec commit 2e56230
Show file tree
Hide file tree
Showing 40 changed files with 307 additions and 348 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
},
"eslint.enable": false,
"prettier.enable": false
}
36 changes: 0 additions & 36 deletions README.md

This file was deleted.

95 changes: 95 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignoreUnknown": false,
"ignore": ["src/components/ui/*.tsx", "node_modules", ".next"]
},
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noDebugger": "off"
},
"style": {},
"a11y": {
"useSemanticElements": "off",
"useKeyWithClickEvents": "off"
},
"correctness": {
"noUnusedImports": "error"
},
"nursery": {
"useSortedClasses": {
"level": "warn",
"fix": "safe",
"options": {
"attributes": ["className"],
"functions": ["clsx", "cva", "cn"]
}
}
}
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto",
"useEditorconfig": false
},
"organizeImports": {
"enabled": true
},
"javascript": {
"formatter": {
"enabled": true,
"quoteStyle": "single",
"jsxQuoteStyle": "single",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"bracketSameLine": false,
"bracketSpacing": true,
"attributePosition": "multiline"
}
},
"json": {
"parser": {
"allowComments": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80
}
},
"css": {
"parser": {
"cssModules": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"quoteStyle": "single"
}
}
}
Binary file modified bun.lockb
Binary file not shown.
6 changes: 6 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pre-commit:
commands:
check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: npx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stage_fixed: true
39 changes: 20 additions & 19 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import nextra from "nextra";
import nextra from 'nextra'

const withNextra = nextra({
latex: true,
search: {
codeblocks: false,
},
contentDirBasePath: "/docs",
});
})

export default withNextra({
reactStrictMode: true,
assetPrefix:
process.env.NODE_ENV === "development"
? "http://localhost:3000"
: "https://docs.createwise.ai",
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
{
protocol: "http",
hostname: "**",
// https://github.com/vercel/turborepo/issues/4832#issuecomment-1751407444
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
use: ['@svgr/webpack'],
})

return config
},
experimental: {
turbo: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
],
},
},
});
})
55 changes: 31 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
{
"name": "createwise-docs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^15.1.6",
"nextra": "^4.2.1",
"nextra-theme-docs": "^4.2.1",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^20.17.16",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"pagefind": "^1.3.0",
"postcss": "^8.5.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3"
}
"name": "createwise-docs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "biome check ./src",
"lint:fix": "biome check --write ./src"
},
"dependencies": {
"@svgr/webpack": "^8.1.0",
"@tailwindcss/postcss": "^4.0.1",
"lefthook": "^1.10.10",
"next": "^15.1.6",
"nextra": "^4.2.1",
"nextra-theme-docs": "^4.2.1",
"postcss": "^8.5.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwind-merge": "^3.0.1",
"tailwindcss": "^4.0.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^20.17.16",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"pagefind": "^1.3.0",
"typescript": "^5.7.3"
}
}
6 changes: 3 additions & 3 deletions postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
'@tailwindcss/postcss': {},
},
};
}

export default config;
export default config
Binary file removed public/android-icon-192x192.png
Binary file not shown.
Binary file added public/favicon.ico
Binary file not shown.
Binary file removed public/ms-icon-144x144.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable react-hooks/rules-of-hooks -- false positive, useMDXComponents isn't react hooks */

import { generateStaticParamsFor, importPage } from 'nextra/pages'
import { useMDXComponents } from '../../../../mdx-components'
import { useMDXComponents } from '~/mdx-components'

export const generateStaticParams = generateStaticParamsFor('mdxPath')

// @ts-ignore
export async function generateMetadata(props) {
const params = await props.params
const { metadata } = await importPage(params.mdxPath)
Expand All @@ -13,13 +12,20 @@ export async function generateMetadata(props) {

const Wrapper = useMDXComponents().wrapper

// @ts-ignore
export default async function Page(props) {
const params = await props.params
const result = await importPage(params.mdxPath)
const { default: MDXContent, toc, metadata } = result
return (
<Wrapper toc={toc} metadata={metadata}>
<MDXContent {...props} params={params} />
<Wrapper
toc={toc}
metadata={metadata}
>
<MDXContent
{...props}
params={params}
/>
</Wrapper>
)
}
2 changes: 0 additions & 2 deletions src/app/_ignored/_meta.js

This file was deleted.

1 change: 0 additions & 1 deletion src/app/_ignored/page.mdx

This file was deleted.

13 changes: 0 additions & 13 deletions src/app/_meta.js

This file was deleted.

Binary file removed src/app/apple-icon.png
Binary file not shown.
16 changes: 0 additions & 16 deletions src/app/blog/page.jsx

This file was deleted.

Binary file removed src/app/favicon.ico
Binary file not shown.
Binary file removed src/app/icon.png
Binary file not shown.
53 changes: 0 additions & 53 deletions src/app/layout.jsx

This file was deleted.

Loading

0 comments on commit 2e56230

Please sign in to comment.