Skip to content

Conversation

jellydn
Copy link

@jellydn jellydn commented Oct 1, 2025

What

Add a Bun-based TypeScript CLI that enables users to run this ESLint plugin via npx without installing it to their project.

Why

  • Zero Installation: Developers can try the plugin instantly without modifying their package.json
  • Quick Evaluation: Perfect for evaluating the plugin on existing codebases
  • CI/CD Integration: Can be used in pipelines without adding dependencies
  • Better DX: Reduces friction for first-time users and one-off checks
  • Native TypeScript: Bun runs TypeScript natively without compilation step

How

Implementation

  1. CLI Script (bin/lint-react-effects.ts):

    • TypeScript executed directly by Bun (no compilation needed)
    • Creates temporary directory with ESLint + plugin + TypeScript support
    • Generates minimal ESLint config (only React effect rules enabled)
    • Symlinks node_modules to user's directory for dependency resolution
    • Runs ESLint from user's current directory
    • Parses JSON output to filter only plugin-related warnings
    • Filters out "unknown rule" errors from existing eslint-disable comments
    • Auto-cleanup of temporary files and symlinks
  2. Developer Experience:

    • Added bin entry in package.json pointing to TypeScript file
    • Makefile with targets: install, test-cli, check, help
    • Updated .gitignore for test files
    • Added "Quick Try" section to README

Usage

cd /path/to/your/project npx eslint-plugin-react-you-might-not-need-an-effect "src/**/*.jsx" npx eslint-plugin-react-you-might-not-need-an-effect --fix "src/**/*.{js,jsx,ts,tsx}"

Features

  • ✅ Supports JavaScript (.js, .jsx) and TypeScript (.ts, .tsx)
  • ✅ Only plugin rules enabled (no noise from other ESLint rules)
  • ✅ Ignores unknown rule errors from eslint-disable comments
  • ✅ Automatic setup and cleanup
  • ✅ No installation required in target project
  • ✅ Native TypeScript execution with Bun

Requirements

  • Bun runtime installed
  • Run from your project directory

Testing

Tested on real-world React projects with:

  • Existing ESLint configurations
  • Mixed JS/JSX/TS/TSX files
  • Inline eslint-disable comments for various rules
  • Glob patterns and individual files

Commands

# Test CLI locally make test-cli make install # Install globally for testing

🤖 Generated with Claude Code

Add Bun-based TypeScript CLI enabling npx usage without installation. Features: - Run via npx without project installation (requires Bun) - Support for JavaScript (.js, .jsx) and TypeScript (.ts, .tsx) - Only plugin rules enabled (filters other ESLint noise) - Ignores unknown rule errors from eslint-disable comments - Automatic temp environment setup and cleanup Usage: cd /path/to/your/project npx eslint-plugin-react-you-might-not-need-an-effect \ "src/**/*.jsx" Implementation: - Creates temp dir with ESLint + plugin + TypeScript support - Generates minimal config (React effect rules only) - Symlinks node_modules for ESLint dependency resolution - Parses JSON output to filter plugin warnings - Auto-cleanup of temp files and symlinks Development: - Makefile with install, test-cli, check targets - Updated .gitignore for test files - README Quick Try section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
@jellydn jellydn changed the title feat: Add npx CLI for instant linting with Bun feat: Add npx CLI for instant linting Oct 1, 2025
@jellydn jellydn force-pushed the feat/npx-cli-with-bun branch from 9f9a769 to 8576414 Compare October 1, 2025 16:15
@jellydn jellydn changed the title feat: Add npx CLI for instant linting feat: Add npx CLI with Bun for instant linting Oct 1, 2025
@NickvanDyke
Copy link
Owner

This is a neat idea! However I'm not keen on the dependencies and maintenance it adds, and afaict it's not typical for ESLint plugins. It might make sense as a separate tool? That can transiently trial any ESLint plugin, not just this one 🙂

@NickvanDyke NickvanDyke closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants