Skip to content
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
54 changes: 27 additions & 27 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ pre-commit:
run: |-
# Lefthook expands {staged_files} as shell-escaped args, so paths with spaces stay intact.
oxlint_files="$(printf '%s\n' {staged_files} | grep -E '(\.astro$|\.cjs$|\.cts$|\.js$|\.jsx$|\.mjs$|\.mts$|\.svelte$|\.ts$|\.tsx$|\.vue$)' || true)"
oxfmt_files="$(printf '%s\n' {staged_files} | grep -E '(\.astro$|\.cjs$|\.css$|\.cts$|\.gql$|\.graphql$|\.hbs$|\.htm$|\.html$|\.js$|\.json$|\.json5$|\.jsonc$|\.jsx$|\.less$|\.md$|\.mdx$|\.mjs$|\.mts$|\.scss$|\.svelte$|\.toml$|\.ts$|\.tsx$|\.vue$|\.yaml$|\.yml$)' || true)"
oxfmt_files="$(printf '%s\n' {staged_files} | grep -E '(\.astro$|\.cjs$|\.css$|\.cts$|\.gql$|\.graphql$|\.hbs$|\.htm$|\.html$|\.js$|\.json$|\.json5$|\.jsonc$|\.jsx$|\.less$|\.md$|\.mdx$|\.mjs$|\.mts$|\.scss$|\.svelte$|\.toml$|\.ts$|\.tsx$|\.vue$|\.yaml$|\.yml$)' | grep -v -E '(^|/)package\.json$' || true)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regex for matching file extensions can be simplified for better readability and maintainability. Instead of repeating the anchor $ for each extension, you can group them and use a single anchor at the end.

        oxfmt_files="$(printf '%s\n' {staged_files} | grep -E '\.(astro|cjs|css|cts|gql|graphql|hbs|htm|html|js|json|json5|jsonc|jsx|less|md|mdx|mjs|mts|scss|svelte|toml|ts|tsx|vue|yaml|yml)$' | grep -v -E '(^|/)package\.json$' || true)"
References
  1. Simplify code as much as possible to eliminate redundancy. (link)

prettier_files="$(printf '%s\n' {staged_files} | grep -E '(\.java$)' || true)"
package_json_files="$(printf '%s\n' {staged_files} | grep -E '(^|/)package\.json$' || true)"




if [ -n "$oxfmt_files" ]; then
node node_modules/.bin/oxfmt --write --no-error-on-unmatched-pattern $oxfmt_files
node node_modules/.bin/oxfmt --write --no-error-on-unmatched-pattern '!**/package.json' $oxfmt_files
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The exclusion pattern '!**/package.json' is redundant here because package.json is already filtered out from the $oxfmt_files variable in line 19. Additionally, note that $oxfmt_files is used without quotes, which will cause the command to fail if any staged filenames contain spaces. While this is an existing pattern in the file, it's worth considering a more robust way to handle the file list (e.g., using xargs).

          node node_modules/.bin/oxfmt --write --no-error-on-unmatched-pattern $oxfmt_files
References
  1. Simplify code as much as possible to eliminate redundancy. (link)

fi

if [ -n "$prettier_files" ]; then
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@
"exercode",
"judge"
],
"license": "Apache-2.0",
"author": "WillBooster Inc.",
"repository": {
"type": "git",
"url": "git+https://github.com/WillBooster/exercode-problem-utils.git"
},
"files": [
"dist/"
],
"type": "module",
"license": "Apache-2.0",
"author": "WillBooster Inc.",
"sideEffects": false,
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand All @@ -32,16 +26,19 @@
"require": "./dist/presets/*.cjs"
}
},
"publishConfig": {
"access": "public"
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"build": "build-ts lib --input src/index.ts src/presets/*.ts",
"check-all-for-ai": "yarn check-for-ai && yarn test",
"check-for-ai": "yarn install > /dev/null && yarn format > /dev/null 2> /dev/null || true && yarn lint-fix --quiet",
"cleanup": "yarn format && yarn lint-fix",
"format": "sort-package-json && yarn format-code && yarn prettify",
"format-code": "oxfmt --write --no-error-on-unmatched-pattern .",
"format-code": "oxfmt --write --no-error-on-unmatched-pattern . '!**/package.json'",
"lint": "oxlint --no-error-on-unmatched-pattern .",
"lint-fix": "yarn lint --fix",
"prepare": "lefthook install || true",
Expand All @@ -51,6 +48,7 @@
"test/ci-setup": "yarn build && bun install --cwd example",
"typecheck": "tsgo --noEmit"
},
"prettier": "@willbooster/prettier-config",
"dependencies": {
"@ai-sdk/amazon-bedrock": "4.0.96",
"@ai-sdk/google": "3.0.64",
Expand All @@ -66,26 +64,28 @@
"@tsconfig/node24": "24.0.4",
"@types/node": "24.12.2",
"@typescript/native-preview": "7.0.0-dev.20260421.2",
"@willbooster/oxfmt-config": "1.2.1",
"@willbooster/oxlint-config": "1.4.4",
"@willbooster/oxfmt-config": "1.2.2",
"@willbooster/oxlint-config": "1.4.5",
"@willbooster/prettier-config": "10.4.0",
"build-ts": "17.1.8",
"conventional-changelog-conventionalcommits": "9.3.1",
"dotenv-cli": "11.0.0",
"lefthook": "2.1.6",
"oxfmt": "0.45.0",
"oxfmt": "0.46.0",
"oxlint": "1.61.0",
"oxlint-tsgolint": "0.21.1",
"oxlint-tsgolint": "0.22.0",
"prettier": "3.8.3",
"prettier-plugin-java": "2.8.1",
"puppeteer": "24.42.0",
"semantic-release": "25.0.3",
"sort-package-json": "3.6.1",
"vitest": "4.1.4"
},
"prettier": "@willbooster/prettier-config",
"packageManager": "yarn@4.14.1",
"engines": {
"node": ">=24"
},
"packageManager": "yarn@4.14.1"
"publishConfig": {
"access": "public"
}
}
Loading
Loading