Skip to content

Commit

Permalink
feat: lefthook & biome
Browse files Browse the repository at this point in the history
  • Loading branch information
lovrozagar committed Aug 20, 2024
1 parent f6655ad commit 8c943fb
Show file tree
Hide file tree
Showing 370 changed files with 11,461 additions and 11,792 deletions.
18 changes: 9 additions & 9 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
27 changes: 27 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"config",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
],
"scope-empty": [0],
"subject-empty": [2, "never"],
"subject-case": [2, "always", "lower-case"],
"body-leading-blank": [2, "always"]
}
}
6 changes: 6 additions & 0 deletions .lefthook/commit-msg/commitlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .lefthook/commit-msg/commitlint.sh

#!/bin/bash

# Print the commit message
echo $(head -n1 "$1") | bunx commitlint --color
92 changes: 41 additions & 51 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,43 @@
{
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"javascript.preferences.importModuleSpecifier": "non-relative",
"javascript.updateImportsOnFileMove.enabled": "always",
"prettier.useEditorConfig": true,
"search.exclude": {
"**/package-lock.json": true,
"**/pnpm-lock.yaml": true,
".cache/**": true,
".git/**": true,
"coverage/**": true,
"dist/**": true,
"generated/**": true,
"node_modules/**": true,
"public/**": true
},
"tailwindCSS.experimental.classRegex": [
["cn"],
["className\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["classNams\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
],
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.suggest.autoImports": true,
"typescript.updateImportsOnFileMove.enabled": "always"
"[css]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"javascript.preferences.importModuleSpecifier": "non-relative",
"javascript.updateImportsOnFileMove.enabled": "always",
"search.exclude": {
"**/package-lock.json": true,
"**/pnpm-lock.yaml": true,
".cache/**": true,
".git/**": true,
"coverage/**": true,
"dist/**": true,
"generated/**": true,
"node_modules/**": true,
"public/**": true
},
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.suggest.autoImports": true,
"typescript.updateImportsOnFileMove.enabled": "always"
}
80 changes: 40 additions & 40 deletions app.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import {
Button,
Combobox,
ComboboxContent,
ComboboxItem,
ComboboxTrigger,
Drawer,
DrawerContent,
DrawerTrigger,
Popover,
PopoverContent,
PopoverTrigger,
Select,
SelectContent,
SelectItem,
SelectTrigger,
} from "@/components";
import { DrawerClose } from "@/components/drawer/components/drawer-close";
import { DrawerDescription } from "@/components/drawer/components/drawer-description";
import { DrawerHeader } from "@/components/drawer/components/drawer-header";
import { DrawerTitle } from "@/components/drawer/components/drawer-title";
import React, { useState } from "react";
Button,
Combobox,
ComboboxContent,
ComboboxItem,
ComboboxTrigger,
Drawer,
DrawerContent,
DrawerTrigger,
Popover,
PopoverContent,
PopoverTrigger,
Select,
SelectContent,
SelectItem,
SelectTrigger,
} from '@/components'
import { DrawerClose } from '@/components/drawer/components/drawer-close'
import { DrawerDescription } from '@/components/drawer/components/drawer-description'
import { DrawerHeader } from '@/components/drawer/components/drawer-header'
import { DrawerTitle } from '@/components/drawer/components/drawer-title'
import React, { useState } from 'react'

const App = () => {
const [state, setValue] = useState("");
const [state, setValue] = useState('')

return (
<div className="h-screen w-full flex justify-center items-center gap-8">
{/* <Popover shouldForwardOutsideInteraction>
return (
<div className='h-screen w-full flex justify-center items-center gap-8'>
{/* <Popover shouldForwardOutsideInteraction>
<PopoverTrigger>Trigger</PopoverTrigger>
<PopoverContent>
<Button>Button</Button>
Expand All @@ -45,25 +45,25 @@ const App = () => {
<SelectItem value='item-2'>Item 2</SelectItem>
</SelectContent>
</Select> */}
{/* <Combobox>
{/* <Combobox>
<ComboboxTrigger>Trigger</ComboboxTrigger>
<ComboboxContent hasScroll={false} emptyContent={'No data.'}>
<ComboboxItem value='item-1'>Item</ComboboxItem>
<ComboboxItem value='item-2'>Item 2</ComboboxItem>
</ComboboxContent>
</Combobox> */}
<Drawer>
<DrawerTrigger>Trigger</DrawerTrigger>
<DrawerContent>
<DrawerClose>X</DrawerClose>
<DrawerHeader>
<DrawerTitle>Title</DrawerTitle>
<DrawerDescription>Description</DrawerDescription>
</DrawerHeader>
</DrawerContent>
</Drawer>
</div>
);
};
<Drawer>
<DrawerTrigger>Trigger</DrawerTrigger>
<DrawerContent>
<DrawerClose>X</DrawerClose>
<DrawerHeader>
<DrawerTitle>Title</DrawerTitle>
<DrawerDescription>Description</DrawerDescription>
</DrawerHeader>
</DrawerContent>
</Drawer>
</div>
)
}

export { App };
export { App }
34 changes: 34 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"complexity": {
"noStaticOnlyClass": "off",
"noForEach": "off"
},
"suspicious": {
"noArrayIndexKey": "off"
},
"a11y": {
"useKeyWithClickEvents": "off",
"noSvgWithoutTitle": "off"
},
"recommended": true
}
},
"formatter": {
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "single",
"quoteProperties": "preserve",
"semicolons": "asNeeded"
}
}
}
23 changes: 23 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# lefthook.yml

commit-msg:
scripts:
"commitlint.sh":
runner: bash

pre-commit:
commands:
1_lint_check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: yarn biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true {staged_files} && git update-index --again
2_type_check:
glob: "*.{json,js,ts,tsx}"
run: yarn tsc --noEmit -p ./tsconfig.json
3_build:
run: yarn next build

pre-push:
commands:
check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: yarn biome check --no-errors-on-unmatched --files-ignore-unknown=true {push_files}
6 changes: 3 additions & 3 deletions main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { App } from './app'

// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
ReactDOM.createRoot(document.querySelector('#root') as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
<React.StrictMode>
<App />
</React.StrictMode>,
)
Loading

0 comments on commit 8c943fb

Please sign in to comment.