Skip to content

feat: pass rule settings into rule context#587

Merged
fansenze merged 3 commits intoweb-infra-dev:mainfrom
eryue0220:feat/add-rules-settings
Apr 1, 2026
Merged

feat: pass rule settings into rule context#587
fansenze merged 3 commits intoweb-infra-dev:mainfrom
eryue0220:feat/add-rules-settings

Conversation

@eryue0220
Copy link
Copy Markdown
Contributor

Summary

This change fixes a gap in internal/rule_tester where test case Settings were defined but never propagated to rule.RuleContext.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a Settings field to the linter's rule configuration and context, allowing rules to access global settings. Changes include updates to the ConfiguredRule and RuleContext structs, as well as the rule testing framework to support settings in test cases. Feedback suggests exporting the cloneSettings helper to avoid code duplication across api.go and rule_registry.go, optimizing the cloning logic by moving it outside of loops to reduce allocations, and ensuring that settings are correctly populated when converting ESLint test cases to maintain compatibility.

Comment thread internal/rule_tester/rule_tester.go
Comment thread internal/config/rule_registry.go Outdated
Comment thread internal/config/rule_registry.go Outdated
Comment thread cmd/rslint/api.go
@fansenze fansenze merged commit f35630c into web-infra-dev:main Apr 1, 2026
10 checks passed
@eryue0220 eryue0220 deleted the feat/add-rules-settings branch April 9, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants