Skip to content

feat(linter/plugins): introduce RuleTester#16206

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-26-feat_linter_plugins_introduce_ruletester_
Nov 30, 2025
Merged

feat(linter/plugins): introduce RuleTester#16206
graphite-app[bot] merged 1 commit intomainfrom
11-26-feat_linter_plugins_introduce_ruletester_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 27, 2025

Part of #16018.

Implement RuleTester class for testing rules. Has same API as ESLint's RuleTester.

A few features not implemented yet:

  • Fixes are not executed, or checked against provided output.
  • Suggestions are not checked (we don't yet have support for suggestions in JS plugins).
  • No use of config provided through RuleTester class constructor or via RuleTester.setDefaultConfig.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins labels Nov 27, 2025
Copy link
Member Author

overlookmotel commented Nov 27, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Nov 27, 2025
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 87f7b96 to 0ef5845 Compare November 27, 2025 16:10
@overlookmotel overlookmotel changed the base branch from main to graphite-base/16206 November 27, 2025 16:23
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 0ef5845 to 7d01b65 Compare November 27, 2025 16:23
@overlookmotel overlookmotel changed the base branch from graphite-base/16206 to 11-27-refactor_linter_plugins_add_registerplugin_function November 27, 2025 16:23
@overlookmotel overlookmotel self-assigned this Nov 27, 2025
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 7d01b65 to 46826a5 Compare November 27, 2025 16:54
@overlookmotel overlookmotel force-pushed the 11-27-refactor_linter_plugins_add_registerplugin_function branch from 1302f61 to afc5df6 Compare November 27, 2025 16:54
@overlookmotel overlookmotel force-pushed the 11-27-refactor_linter_plugins_add_registerplugin_function branch from afc5df6 to df85032 Compare November 27, 2025 16:55
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch 2 times, most recently from 6ce2fd7 to 1baf878 Compare November 27, 2025 17:41
@overlookmotel overlookmotel force-pushed the 11-27-refactor_linter_plugins_add_registerplugin_function branch from df85032 to 54de704 Compare November 27, 2025 17:41
@graphite-app graphite-app bot force-pushed the 11-27-refactor_linter_plugins_add_registerplugin_function branch 2 times, most recently from be3b9ee to 832983a Compare November 27, 2025 17:50
@graphite-app graphite-app bot force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 1baf878 to 04e394c Compare November 27, 2025 17:50
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch 3 times, most recently from b644de3 to 75f972d Compare November 27, 2025 20:47
@overlookmotel overlookmotel force-pushed the 11-27-refactor_linter_plugins_add_registerplugin_function branch from 832983a to b15c057 Compare November 27, 2025 20:47
@overlookmotel overlookmotel changed the base branch from 11-27-refactor_linter_plugins_add_registerplugin_function to graphite-base/16206 November 27, 2025 22:22
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 75f972d to f0fb3fb Compare November 27, 2025 22:22
@overlookmotel overlookmotel changed the base branch from graphite-base/16206 to 11-27-feat_linter_plugins_implement_options_merging November 27, 2025 22:23
@overlookmotel overlookmotel force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch from 6f782ba to b184e4f Compare November 28, 2025 15:44
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 0660dff to 5b44404 Compare November 29, 2025 02:33
@overlookmotel overlookmotel force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch from b184e4f to 1d22ec5 Compare November 29, 2025 02:33
@graphite-app graphite-app bot force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch 2 times, most recently from 43d7fef to 96f4c5b Compare November 29, 2025 02:50
@graphite-app graphite-app bot force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 5b44404 to da999a6 Compare November 29, 2025 02:50
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from da999a6 to e277430 Compare November 30, 2025 15:25
@overlookmotel overlookmotel force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch from 96f4c5b to 4318041 Compare November 30, 2025 15:25
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from e277430 to 89aa6e0 Compare November 30, 2025 16:22
@overlookmotel overlookmotel force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch from 4318041 to eb44265 Compare November 30, 2025 16:22
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch 2 times, most recently from 8203558 to cfe6531 Compare November 30, 2025 19:00
@overlookmotel overlookmotel force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch from eb44265 to fa5947d Compare November 30, 2025 19:00
@overlookmotel overlookmotel force-pushed the 11-28-refactor_linter_plugins_add_parse_function branch from fa5947d to 26e3bdd Compare November 30, 2025 23:16
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from cfe6531 to 261bd1b Compare November 30, 2025 23:16
@overlookmotel overlookmotel marked this pull request as ready for review November 30, 2025 23:22
@overlookmotel overlookmotel force-pushed the 11-26-feat_linter_plugins_introduce_ruletester_ branch from 261bd1b to ea8ffb9 Compare November 30, 2025 23:31
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Nov 30, 2025
Copy link
Member Author

overlookmotel commented Nov 30, 2025

Merge activity

Part of #16018.

Implement `RuleTester` class for testing rules. Has same API as ESLint's `RuleTester`.

A few features not implemented yet:

* Fixes are not executed, or checked against provided `output`.
* Suggestions are not checked (we don't yet have support for suggestions in JS plugins).
* No use of config provided through `RuleTester` class constructor or via `RuleTester.setDefaultConfig`.
graphite-app bot pushed a commit that referenced this pull request Nov 30, 2025
…ion (#16302)

Pure refactor. Move placeholder replacement into it's own function, so it can also be used by rule tester (#16206).
graphite-app bot pushed a commit that referenced this pull request Nov 30, 2025
Store `messageId` in `DiagnosticReport` objects. It's not required for sending to Rust, but it is needed for rule tester (#16206).

I think it's fine to add a little code that's redundant in the main runtime, because it only has an overhead when a rule produces diagnostics, which should be an uncommon path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant