Skip to content

JohnDeved/ox-standard

Repository files navigation

ox-standard

Lightning-fast JavaScript Standard Style linting and formatting

Drop-in replacement for ESLint/Prettier that's 50~100 times faster. Enforces JavaScript Standard Style using Rust-based oxlint and oxfmt formatter for TypeScript/React projects.

🚀 Quick Setup

For Node.js Projects

Replace ESLint/Prettier in your project with one command:

npx JohnDeved/ox-standard

That's it! The setup automatically:

  • ✅ Removes ESLint and Prettier packages and configs
  • ✅ Installs oxlint with Standard Style configuration
  • ✅ Installs oxfmt formatter with Standard Style configuration
  • ✅ Updates your package.json scripts
  • ✅ Configures VSCode settings and extensions

For Deno Projects

Run the setup in your Deno project directory:

npx JohnDeved/ox-standard

The setup will:

  • ✅ Detect your Deno project automatically
  • ✅ Create .oxlintrc.json with Deno-specific configuration
  • ✅ Create .oxfmtrc.json with Standard Style formatting
  • ✅ Add lint task to your deno.json
  • ✅ Configure VSCode settings and extensions

Then install oxlint and oxfmt:

# Using npx (recommended)
npx oxlint --fix .
npx oxfmt .

# Or install globally with Deno
deno install -A -n oxlint https://esm.sh/oxlint
deno install -A -n oxfmt https://esm.sh/oxfmt

✨ What You Get

🚀 100x Faster Performance

  • Rust-based oxlint: Sub-second linting even on large codebases
  • oxfmt formatter: Lightning-fast formatting from the oxc ecosystem
  • Single command: npm run lint (Node.js) or deno task lint (Deno) handles both linting and formatting

📏 JavaScript Standard Style Enforced

  • No semicolons, single quotes, 2-space indentation
  • Strict equality (===), modern ES6+ patterns
  • React hooks best practices, TypeScript consistency

🎯 Zero Configuration

  • Works out of the box for TypeScript and React
  • Supports both Node.js and Deno projects
  • Extensible configs you can customize
  • VSCode integration with recommended extensions

🛠 Customization

Need to override rules? Easy:

// .oxlintrc.json
{
  "extends": ["./node_modules/ox-standard/.oxlintrc.json"],
  "rules": {
    "no-console": "warn"
  }
}
// .oxfmtrc.json  
{
  "singleQuote": true,
  "semi": false,
  "printWidth": 120,
  "tabWidth": 2,
  "trailingComma": "es5"
}

💡 VSCode Integration

The setup automatically configures VSCode for the best experience:

  • Auto-formatting on save with oxfmt via the oxc-vscode extension
  • Auto-fixing linting issues on save
  • Recommended extensions installation prompt

The .vscode/settings.json is configured to use oxc-vscode as the default formatter with experimental oxfmt support enabled. Just install the recommended oxc.oxc-vscode extension when prompted, and formatting will work out of the box!

🆚 Migrating from ESLint/Prettier?

The setup script handles everything automatically:

  1. Detects existing ESLint/Prettier configs and packages
  2. Prompts for removal confirmation
  3. Uninstalls old dependencies
  4. Installs and configures ox-standard
  5. Updates VSCode settings

📖 Manual Installation

Node.js Projects

Prefer manual setup?

npm install --save-dev github:JohnDeved/ox-standard

echo '{"extends": ["./node_modules/ox-standard/.oxlintrc.json"]}' > .oxlintrc.json
cp node_modules/ox-standard/.oxfmtrc.json .oxfmtrc.json

npm pkg set scripts.lint="oxlint --fix .; oxfmt ."

Deno Projects

For Deno projects, configuration is embedded directly:

# Run setup script
npx JohnDeved/ox-standard

# Or manually create configs
# The setup script will generate .oxlintrc.json with Deno-specific settings
# including Deno global environment and optimized ignore patterns

# Add to deno.json:
{
  "tasks": {
    "lint": "npx oxlint --fix . && npx oxfmt ."
  }
}

# Run linting
deno task lint

🔧 Complete Rule Reference

70+ carefully selected rules across:

JavaScript Standard Style

  • eqeqeq - Strict equality (===)
  • curly - Consistent braces
  • no-var - Use const/let
  • space-infix-ops - Proper spacing
  • yoda - Readable comparisons

Modern JavaScript

  • prefer-template - Template literals
  • prefer-destructuring - Modern patterns
  • prefer-object-spread - Clean objects
  • no-duplicate-imports - Organized imports

React Best Practices

  • rules-of-hooks - Proper hooks usage
  • jsx-curly-brace-presence - Clean JSX
  • self-closing-comp - Concise components

TypeScript Integration

  • consistent-type-imports - Clean imports
  • array-type - Consistent syntax
  • prefer-as-const - Type assertions

Enhanced Patterns (Unicorn)

  • prefer-includes - Better array methods
  • prefer-string-starts-ends-with - Modern strings
  • throw-new-error - Proper errors

🤝 Contributing

Found an issue or want to suggest improvements? Open an issue or submit a pull request.

📄 License

MIT © Johann Berger

About

oxlint Javascript Standard Style

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •