Skip to content

[Tracking]: Schema-driven rule options frameworks with auto TS type generation #1216

Description

@swwind

Add JSON Schema-based validation, default values, and TypeScript type generation for rule options.

Reference ESLint document: https://eslint.org/docs/latest/extend/custom-rules#options-schemas

Steps

  1. Add JSON Schema support
    • Vendor a JSON Schema validation library
    • Add a small wrapper for compiling and validating schemas
    • Add unit tests
  2. Implement new schema framework
    • Make rules accept a plain options array (aligned with ESLint) instead of the legacy rslint-specific format
    • Remove support for the legacy object-style rule configuration
    • Update all existing rules (using scripts for now)
    • Ensure the full test suite passes
    • Validate user configs against each rule's schema with clear error messages
    • Populate unspecified options using schema defaults
    • Verify the behavior end-to-end with a couple of real rules
    • Write a guide describing how to author rule schemas consistently for future rules
  3. Generate TypeScript types for rule options
    • Generate precise TypeScript types for rslint.config.ts from each rule's schema
    • Integrate type generation into the build process
  4. Migrate existing rule packages
    • Migrate rules package by package, remove legacy code in rules one by one.
    • Packages:
      • eslint
      • typescript-eslint
      • import
      • jest
      • jsx_a11y
      • promise
      • react
      • react_hooks
      • unicorn
  5. Remove legacy compatibility code
    • Remove the legacy rule configuration format
    • Remove compatibility shims and unused code
    • Ensure the new implementation is the only supported path

Checklist

  • Step 1 — Add JSON Schema support (feat(rule): add jsonschema-based options schema compiler #1222)
  • Step 2 — Implement new schema framework
  • Step 3 — Generate TypeScript types for rule options
  • Step 4 — Migrate eslint
  • Step 4 — Migrate typescript-eslint
  • Step 4 — Migrate import
  • Step 4 — Migrate jest
  • Step 4 — Migrate jsx_a11y
  • Step 4 — Migrate promise
  • Step 4 — Migrate react
  • Step 4 — Migrate react_hooks
  • Step 4 — Migrate unicorn
  • Step 5 — Remove legacy compatibility code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions