Skip to content

Commit

Permalink
chore: switch to biome, bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Jul 12, 2024
1 parent 11b94a7 commit 7f2062e
Show file tree
Hide file tree
Showing 18 changed files with 1,517 additions and 2,548 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

23 changes: 0 additions & 23 deletions .eslintrc

This file was deleted.

29 changes: 12 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master]
pull_request:
branches: [master]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
- uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable pnpm
- uses: actions/setup-node@v4
with:
node-version: '14.16.1'
- name: install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 6.2.5
node-version: 18.x
cache: 'pnpm'
- run: pnpm install
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
- name: Run Biome
run: biome ci .
- run: pnpm test:coverage
- run: pnpm test:report
- name: Coveralls
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
dist
coverage
coverage*
29 changes: 0 additions & 29 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@
#!/bin/sh
if [ -z "$husky_skip_init" ]; then
debug () {
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
}

readonly hook_name="$(basename "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

export readonly husky_skip_init=1
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

exit $exitCode
fi
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --config commitlint.config.cjs --edit "$1"
npx --no-install commitlint --config commitlint.config.js --edit "$1"
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"npm.packageManager": "pnpm",
"editor.formatOnSave": true,
"biome.enabled": true,
"eslint.enable": false,
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
30 changes: 30 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json",
"files": {
"ignore": ["node_modules", "dist", "coverage", ".pnpm-store"]
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 120
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteProperties": "asNeeded",
"trailingCommas": "none",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"quoteStyle": "single"
}
}
}
7 changes: 3 additions & 4 deletions commitlint.config.cjs → commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const defaultConfig = require('@commitlint/config-conventional')
import _default from '@commitlint/config-conventional'

module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
rules: {
...defaultConfig.rules,
..._default.rules,
'type-enum': [
2,
'always',
Expand Down
61 changes: 22 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,37 @@
"url": "https://github.com/tinyhttp/cors.git"
},
"engines": {
"node": ">=12.4 || 14.x || >=16"
"node": ">=12.20 || 14.x || >=16"
},
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"keywords": [
"tinyhttp",
"node.js",
"web framework",
"web",
"backend"
],
"keywords": ["tinyhttp", "node.js", "web framework", "web", "backend"],
"author": "v1rtl",
"license": "MIT",
"files": [
"dist"
],
"dependencies": {
"es-vary": "^0.1.2"
},
"files": ["dist"],
"scripts": {
"build": "rollup -c",
"test": "tsm node_modules/uvu/bin.js tests",
"build": "tsc -p tsconfig.build.json",
"test": "tsx --test src/*.test.ts",
"test:coverage": "c8 --include=src pnpm test",
"test:report": "c8 report --reporter=text-lcov > coverage.lcov",
"lint": "eslint . --ext=ts",
"format": "prettier --check \"./**/*.{ts,md}\"",
"format:fix": "prettier --write \"./**/*.{ts,md}\"",
"prepare": "husky install"
"lint": "biome lint .",
"format": "biome format .",
"check": "biome check ."
},
"devDependencies": {
"@commitlint/cli": "16.2.1",
"@commitlint/config-conventional": "16.2.1",
"@rollup/plugin-typescript": "^8.3.1",
"@tinyhttp/app": "2.0.19",
"@types/node": "^17.0.21",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"c8": "^7.11.0",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"expect": "^27.5.1",
"husky": "^7.0.4",
"prettier": "^2.5.1",
"rollup": "^2.69.1",
"supertest-fetch": "^1.5.0",
"tsm": "^2.2.1",
"typescript": "~4.6.2",
"uvu": "^0.5.3"
"@biomejs/biome": "1.8.3",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@tinyhttp/app": "2.2.4",
"@types/node": "^20.14.10",
"c8": "^10.1.2",
"husky": "^9.0.11",
"supertest-fetch": "^2.0.0",
"tsx": "^4.16.2",
"typescript": "~5.5.3"
},
"packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a",
"dependencies": {
"@tinyhttp/vary": "^0.1.3"
}
}
Loading

0 comments on commit 7f2062e

Please sign in to comment.