Skip to content

Commit ad5f89e

Browse files
committed
refactor: added biome and lefthook, removed eslint, prettier, and unused packages. config and readme (#137)
1 parent f4cbaee commit ad5f89e

29 files changed

+1124
-3061
lines changed

.babelrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.commitlintrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.editorconfig

Lines changed: 0 additions & 9 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: Main
33
on: [push]
44

55
jobs:
6-
run-ci:
6+
main:
77
env:
88
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99

10-
name: Run Type Check & Linters
10+
name: Test & Build
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 10
1313

@@ -46,16 +46,16 @@ jobs:
4646
run: pnpm install --frozen-lockfile
4747

4848
- name: Check types
49-
run: pnpm type-check
49+
run: pnpm tsc
5050

5151
- name: Check linting
52-
run: pnpm lint
52+
run: pnpm lint:ci
5353

5454
- name: Run tests
5555
run: pnpm test:ci
5656

5757
- name: Build storybook
58-
run: pnpm build-storybook
58+
run: pnpm storybook:build
5959

6060
- name: Build package
6161
run: pnpm build

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: bitovi/github-actions-storybook-to-github-pages@v1.0.2
5252
with:
5353
install_command: pnpm install --frozen-lockfile
54-
build_command: pnpm build-storybook
54+
build_command: pnpm storybook:build
5555
path: storybook-static
5656
env:
5757
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}

.husky/_/pre-commit

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/sh
2+
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook -h >/dev/null 2>&1
17+
then
18+
lefthook "$@"
19+
else
20+
dir="$(git rev-parse --show-toplevel)"
21+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
22+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
23+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
24+
then
25+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
26+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
27+
then
28+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
32+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
33+
then
34+
"$dir/node_modules/lefthook/bin/index.js" "$@"
35+
36+
elif bundle exec lefthook -h >/dev/null 2>&1
37+
then
38+
bundle exec lefthook "$@"
39+
elif yarn lefthook -h >/dev/null 2>&1
40+
then
41+
yarn lefthook "$@"
42+
elif pnpm lefthook -h >/dev/null 2>&1
43+
then
44+
pnpm lefthook "$@"
45+
elif swift package plugin lefthook >/dev/null 2>&1
46+
then
47+
swift package --disable-sandbox plugin lefthook "$@"
48+
elif command -v mint >/dev/null 2>&1
49+
then
50+
mint run csjones/lefthook-plugin "$@"
51+
elif command -v npx >/dev/null 2>&1
52+
then
53+
npx lefthook "$@"
54+
else
55+
echo "Can't find lefthook in PATH"
56+
fi
57+
fi
58+
}
59+
60+
call_lefthook run "pre-commit" "$@"

.husky/_/prepare-commit-msg

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/sh
2+
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook -h >/dev/null 2>&1
17+
then
18+
lefthook "$@"
19+
else
20+
dir="$(git rev-parse --show-toplevel)"
21+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
22+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
23+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
24+
then
25+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
26+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
27+
then
28+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
32+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
33+
then
34+
"$dir/node_modules/lefthook/bin/index.js" "$@"
35+
36+
elif bundle exec lefthook -h >/dev/null 2>&1
37+
then
38+
bundle exec lefthook "$@"
39+
elif yarn lefthook -h >/dev/null 2>&1
40+
then
41+
yarn lefthook "$@"
42+
elif pnpm lefthook -h >/dev/null 2>&1
43+
then
44+
pnpm lefthook "$@"
45+
elif swift package plugin lefthook >/dev/null 2>&1
46+
then
47+
swift package --disable-sandbox plugin lefthook "$@"
48+
elif command -v mint >/dev/null 2>&1
49+
then
50+
mint run csjones/lefthook-plugin "$@"
51+
elif command -v npx >/dev/null 2>&1
52+
then
53+
npx lefthook "$@"
54+
else
55+
echo "Can't find lefthook in PATH"
56+
fi
57+
fi
58+
}
59+
60+
call_lefthook run "prepare-commit-msg" "$@"

.husky/commit-msg

Lines changed: 0 additions & 5 deletions
This file was deleted.

.husky/common.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.husky/pre-commit

Lines changed: 0 additions & 2 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
import type { StorybookConfig } from '@storybook/react-webpack5';
1+
import type { StorybookConfig } from "@storybook/react-webpack5";
22
const config: StorybookConfig = {
3-
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
4-
addons: [
5-
'@storybook/addon-links',
6-
'@storybook/addon-essentials',
7-
'@storybook/addon-interactions',
8-
'@storybook/addon-webpack5-compiler-swc',
9-
],
10-
framework: {
11-
name: '@storybook/react-webpack5',
12-
options: {},
13-
},
14-
docs: {
15-
autodocs: 'tag',
16-
},
3+
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx|mdx)"],
4+
addons: [
5+
"@storybook/addon-links",
6+
"@storybook/addon-essentials",
7+
"@storybook/addon-interactions",
8+
"@storybook/addon-webpack5-compiler-swc",
9+
],
10+
framework: {
11+
name: "@storybook/react-webpack5",
12+
options: {
13+
builder: {
14+
// biome-ignore lint/style/useNamingConvention: <explanation>
15+
useSWC: true,
16+
},
17+
},
18+
},
19+
swc: () => ({
20+
jsc: {
21+
transform: {
22+
react: {
23+
runtime: "automatic",
24+
},
25+
},
26+
},
27+
}),
28+
docs: {
29+
autodocs: "tag",
30+
},
1731
};
1832
export default config;

.storybook/preview.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import type { Preview } from '@storybook/react';
1+
import type { Preview } from "@storybook/react";
22

33
const preview: Preview = {
4-
parameters: {
5-
controls: {
6-
matchers: {
7-
color: /(background|color)$/i,
8-
date: /Date$/,
9-
},
10-
},
11-
},
4+
parameters: {
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
},
1212
};
1313

1414
export default preview;

0 commit comments

Comments
 (0)