Skip to content

feat: Set type for RuleDefinition.defaultOptions#173

Merged
fasttime merged 3 commits intomainfrom
default-options-types
Apr 1, 2025
Merged

feat: Set type for RuleDefinition.defaultOptions#173
fasttime merged 3 commits intomainfrom
default-options-types

Conversation

@nzakas
Copy link
Copy Markdown
Member

@nzakas nzakas commented Mar 27, 2025

Prerequisites checklist

What is the purpose of this pull request?

I realized that defaultOptions can be assigned the same type as the rule options for rules to allow for better type validation.

What changes did you make? (Give an overview)

  • Updated the RulesMeta to accept RuleOptions as an argument
  • Updated defaultOptions to be the same type as RuleOptions

Related Issues

Is there anything you'd like reviewers to focus on?

@nzakas nzakas requested a review from Copilot March 27, 2025 20:10
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Mar 27, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the type definitions for ESLint rules by aligning default options with the rule options type for improved type validation.

  • Added a new generic parameter, RuleOptions, to the RulesMeta interface.
  • Changed the defaultOptions type to use the RuleOptions generic.
  • Updated the RuleDefinition.meta property to include RuleOptions.

@fasttime fasttime moved this from Needs Triage to Implementing in Triage Mar 28, 2025
Copy link
Copy Markdown
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Can we add some type tests for meta.defaultOptions?

Comment thread packages/core/tests/types/types.test.ts Outdated
Co-authored-by: Francesco Trotta <github@fasttime.org>
Copy link
Copy Markdown
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@fasttime fasttime merged commit d5806df into main Apr 1, 2025
18 checks passed
@fasttime fasttime deleted the default-options-types branch April 1, 2025 08:43
@github-project-automation github-project-automation Bot moved this from Implementing to Complete in Triage Apr 1, 2025
@github-actions github-actions Bot mentioned this pull request Apr 1, 2025
snitin315 pushed a commit that referenced this pull request Mar 29, 2026
Co-authored-by: Francesco Trotta <github@fasttime.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants