Skip to content
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

build: use biome, pnpm #74

Merged
merged 1 commit into from
Mar 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
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"env": {
"node": true
},
"extends": ["@ctrl/eslint-config"]
"extends": ["@ctrl/eslint-config-react-biome"]
}
36 changes: 27 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3

- uses: pnpm/action-setup@v3
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
cache: "pnpm"

- name: install
run: pnpm install

- name: lint
run: npm run lint
run: pnpm run lint

- name: test
run: npm run test:ci
run: pnpm run test:ci

- name: coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -38,11 +48,19 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- uses: pnpm/action-setup@v3
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
cache: "pnpm"

- name: install
run: pnpm install

- name: release
run: npx semantic-release
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jspm_packages
.node_repl_history
.vscode/*
!.vscode/launch.json
!.vscode/settings.json

# build
build
Expand Down
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"editor.defaultFormatter": "biomejs.biome",
"[javascript][typescript][javascriptreact][typescriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.fixAll.eslint": "explicit"
}
}
}
8 changes: 8 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignoreUnknown": true,
"ignore": ["dist/*", "public/*"]
},
"extends": ["./node_modules/@ctrl/eslint-config-biome/biome.json"]
}
6 changes: 3 additions & 3 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
"serve": "vite preview"
},
"devDependencies": {
"@types/react": "18.2.55",
"@types/react": "18.2.61",
"@types/react-dom": "18.2.19",
"react": "18.2.0",
"react-dom": "18.2.0",
"@tailwindcss/forms": "0.5.7",
"autoprefixer": "10.4.17",
"autoprefixer": "10.4.18",
"postcss": "8.4.35",
"tailwindcss": "3.4.1",
"typescript": "5.3.3",
"vite": "5.1.3"
"vite": "5.1.4"
},
"engines": {
"node": ">=18"
Expand Down
17 changes: 9 additions & 8 deletions demo/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';

// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore
import { filenameParse } from '../../src/index.js';

ReactDOM.render(<Demo />, document.getElementById('root'));
const root = createRoot(document.getElementById('root')!);
root.render(<Demo />);

function Demo() {
const demoDefault = 'Iron.Man.2008.INTERNAL.REMASTERED.2160p.UHD.BluRay.X265-IAMABLE';
const [result, setResult] = useState(filenameParse(demoDefault));
const [input, setInput] = useState(demoDefault);
const [isTvShow, setTvShow] = useState(false);
const [isTvShow, setIsTvShow] = useState(false);

function handleChange(event: any) {
const handleChange = (event: any) => {
setInput(event.target.value);
setResult(filenameParse(event.target.value, isTvShow));
}
};

function handleToggleTvShow(event: any) {
setTvShow(event.target.checked);
const handleToggleTvShow = (event: any) => {
setIsTvShow(event.target.checked);
setResult(filenameParse(input, event.target.checked));
}
};

return (
<div className="py-6">
Expand Down
Loading