Skip to content

refactor: added biome and lefthook, removed eslint, prettier, and unu… #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .babelrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .commitlintrc.json

This file was deleted.

74 changes: 0 additions & 74 deletions .eslintrc.js

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Main
on: [push]

jobs:
run-ci:
main:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Expand Down Expand Up @@ -46,16 +46,16 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Check types
run: pnpm type-check
run: pnpm tsc

- name: Check linting
run: pnpm lint
run: pnpm lint:ci

- name: Run tests
run: pnpm test:ci

- name: Build storybook
run: pnpm build-storybook
run: pnpm storybook:build

- name: Build package
run: pnpm build
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
uses: bitovi/github-actions-storybook-to-github-pages@v1.0.2
with:
install_command: pnpm install --frozen-lockfile
build_command: pnpm build-storybook
build_command: pnpm storybook:build
path: storybook-static
env:
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
Expand Down
60 changes: 60 additions & 0 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
set -x
fi

if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi

call_lefthook()
{
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
then
lefthook "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
elif yarn lefthook -h >/dev/null 2>&1
then
yarn lefthook "$@"
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
elif command -v npx >/dev/null 2>&1
then
npx lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
fi
}

call_lefthook run "pre-commit" "$@"
60 changes: 60 additions & 0 deletions .husky/_/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
set -x
fi

if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi

call_lefthook()
{
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
then
lefthook "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
elif yarn lefthook -h >/dev/null 2>&1
then
yarn lefthook "$@"
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
elif command -v npx >/dev/null 2>&1
then
npx lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
fi
}

call_lefthook run "prepare-commit-msg" "$@"
5 changes: 0 additions & 5 deletions .husky/commit-msg

This file was deleted.

8 changes: 0 additions & 8 deletions .husky/common.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .husky/pre-commit

This file was deleted.

12 changes: 0 additions & 12 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

44 changes: 29 additions & 15 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import type { StorybookConfig } from '@storybook/react-webpack5';
import type { StorybookConfig } from "@storybook/react-webpack5";
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-webpack5-compiler-swc',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: 'tag',
},
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx|mdx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-webpack5-compiler-swc",
],
framework: {
name: "@storybook/react-webpack5",
options: {
builder: {
// biome-ignore lint/style/useNamingConvention: <explanation>
useSWC: true,
},
},
},
swc: () => ({
jsc: {
transform: {
react: {
runtime: "automatic",
},
},
},
}),
docs: {
autodocs: "tag",
},
};
export default config;
18 changes: 9 additions & 9 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Preview } from '@storybook/react';
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
Loading