Skip to content

Instantly share code, notes, and snippets.

@KidkArolis
Created January 7, 2026 18:29
Show Gist options
  • Select an option

  • Save KidkArolis/fcefee2a6cd5c0bfe6fc58ebb7fd1349 to your computer and use it in GitHub Desktop.

Select an option

Save KidkArolis/fcefee2a6cd5c0bfe6fc58ebb7fd1349 to your computer and use it in GitHub Desktop.
Running oxlint --fix in Zed
{
"languages": {
"JavaScript": {
"format_on_save": "on",
"formatter": [
{
"external": {
"command": "./scripts/oxlint-format.sh",
"arguments": ["{buffer_path}"]
}
},
"prettier"
]
},
"TypeScript": {
"format_on_save": "on",
"formatter": [
{
"external": {
"command": "./scripts/oxlint-format.sh",
"arguments": ["{buffer_path}"]
}
},
"prettier"
]
},
"TSX": {
"format_on_save": "on",
"formatter": [
{
"external": {
"command": "./scripts/oxlint-format.sh",
"arguments": ["{buffer_path}"]
}
},
"prettier"
]
}
}
}
#!/bin/bash
# Wrapper to make oxlint --fix work as a stdin→stdout formatter for Zed
# Usage: oxlint-format.sh <original-file-path>
# Disable job control to suppress "Abort trap" messages
set +m
ORIGINAL_PATH="$1"
EXT="${ORIGINAL_PATH##*.}"
# Change to project root so oxlint can find .oxlintrc.json
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$PROJECT_ROOT"
# Create temp file INSIDE the project so oxlint can process it
# (oxlint fails on files outside project root due to gitignore handling)
TEMP_DIR="$PROJECT_ROOT/.oxlint-tmp"
mkdir -p "$TEMP_DIR"
TEMP_FILE="$TEMP_DIR/format-temp.$EXT"
# Read stdin (file content from Zed) into temp file
cat > "$TEMP_FILE"
# Run oxlint --fix, suppress all output including crash messages
"$PROJECT_ROOT/node_modules/.bin/oxlint" --fix "$TEMP_FILE" >/dev/null 2>&1 &
wait $! 2>/dev/null
# Output the fixed content
cat "$TEMP_FILE"
# Cleanup
rm -f "$TEMP_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment