Skip to content

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Sep 4, 2025

I took @camc314's branch and updated based on the latest code. I'm not familiar with Go, so it's very possible I've made some mistakes here, please review carefully 🙏

The goal of this PR is to ultimately enable doing custom configurations for rules without needing to specify redudant rule information. The new config format emphasizes configs over files, where each config defines a set of files it should apply to, and the rules that should be run.

Copy link
Member Author

camchenry commented Sep 4, 2025


How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

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.

@camchenry camchenry marked this pull request as ready for review September 4, 2025 18:05
@Boshen Boshen requested a review from camc314 September 5, 2025 01:27
@camchenry camchenry force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 0d84bbb to 5fbdc6c Compare September 5, 2025 20:45
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

This looks good. I'll merge this monday when i'm less tired and have re-reviewed with a fresh pair of eyes

@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch 3 times, most recently from b342f4b to 470f1da Compare September 8, 2025 03:05
@camc314 camc314 requested a review from Copilot September 8, 2025 03:05
@camc314 camc314 self-assigned this Sep 8, 2025

This comment was marked as outdated.

@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 470f1da to 581982c Compare September 8, 2025 04:27
@camc314 camc314 requested a review from Copilot September 8, 2025 04:27

This comment was marked as outdated.

@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 581982c to 788d754 Compare September 8, 2025 04:36
@camc314 camc314 requested a review from Copilot September 8, 2025 04:37
@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 788d754 to fcaf6c1 Compare September 8, 2025 04:37

This comment was marked as outdated.

@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from fcaf6c1 to 400bf44 Compare September 8, 2025 05:50
@camc314 camc314 changed the base branch from main to graphite-base/182 September 8, 2025 06:53
@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 400bf44 to ff886b9 Compare September 8, 2025 06:53
@camc314 camc314 changed the base branch from graphite-base/182 to c/09-08-test_add_test_for_linting_files_outside_a_project September 8, 2025 06:53
@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from ff886b9 to 5e99d9e Compare September 8, 2025 06:55
@camc314 camc314 requested a review from Copilot September 8, 2025 06:56

This comment was marked as outdated.

@graphite-app graphite-app bot changed the base branch from c/09-08-test_add_test_for_linting_files_outside_a_project to graphite-base/182 September 8, 2025 07:02
@graphite-app graphite-app bot force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 5e99d9e to 4989e6e Compare September 8, 2025 07:15
@graphite-app graphite-app bot changed the base branch from graphite-base/182 to main September 8, 2025 07:15
@graphite-app graphite-app bot force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 4989e6e to 3bffc86 Compare September 8, 2025 07:15
@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch 4 times, most recently from f200896 to 5067784 Compare September 10, 2025 08:07
@camc314 camc314 requested a review from Copilot September 10, 2025 08:10

This comment was marked as outdated.

Copy link
Contributor

camc314 commented Sep 10, 2025

Merge activity

@camc314 camc314 requested a review from Copilot September 10, 2025 08:13

This comment was marked as outdated.

@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch 2 times, most recently from 7885aba to 4d07dfd Compare September 10, 2025 08:15
@camc314 camc314 requested a review from Copilot September 10, 2025 08:16
Copy link

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 PR refactors the headless payload format from file-based to config-based, introducing a new version 2 format while maintaining backward compatibility with version 1. The new format allows multiple files to be grouped under a single configuration with shared rules, reducing redundancy.

  • Updates headless payload structure to use configs containing file paths and rules instead of individual file configurations
  • Implements backward compatibility for version 1 payloads by converting them to version 2 format
  • Updates test utilities and fixtures to use the new config-based format

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
cmd/tsgolint/payload.go New file implementing payload deserialization with version handling and V1 to V2 conversion
cmd/tsgolint/headless.go Updated to use new payload format and removed old struct definitions
e2e/snapshot.test.ts Updated test utilities to generate V2 payloads and added backward compatibility test
internal/linter/linter.go Minor formatting change removing extra blank line

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@camc314 camc314 force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 4d07dfd to 366a6bb Compare September 10, 2025 08:24
…based (#182)

- based on #125 (cc @camc314)

I took @camc314's branch and updated based on the latest code. I'm not familiar with Go, so it's very possible I've made some mistakes here, please review carefully 🙏

The goal of this PR is to ultimately enable doing custom configurations for rules without needing to specify redudant rule information. The new config format emphasizes configs over files, where each config defines a set of files it should apply to, and the rules that should be run.
@graphite-app graphite-app bot force-pushed the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch from 366a6bb to 707c5e7 Compare September 10, 2025 08:36
@graphite-app graphite-app bot merged commit 707c5e7 into main Sep 10, 2025
11 checks passed
@graphite-app graphite-app bot deleted the 09-04-refactor_update_headless_payload_to_be_config-based_instead_of_file-based branch September 10, 2025 08:47
@graphite-app graphite-app bot removed the 0-merge label Sep 10, 2025
graphite-app bot pushed a commit to oxc-project/oxc that referenced this pull request Sep 11, 2025
- oxc side of oxc-project/tsgolint#182

Updates the payload that `oxlint` sends to `tsgolint` to match the new format. The new structure is based around sets of rules and configurations first, and then specifying the files those configs act upon. That looks like something like this (output from running `oxlint --type-aware apps/oxlint/fixtures`)

```json
{
  "configs": [
    {
      "file_paths": [
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/use-unknown-in-catch-callback-variable/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/prefer-reduce-type-parameter/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/return-await/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/non-tsgolint.ts",
        "..."
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-unnecessary-template-expression/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-unsafe-type-assertion/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-unsafe-member-access/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-unsafe-call/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-unnecessary-boolean-literal-compare/index.ts"
      ],
      "rules": [
        { "name": "await-thenable" },
        { "name": "no-floating-promises" },
        { "name": "no-array-delete" },
        { "name": "no-base-to-string" },
        { "name": "no-confusing-void-expression" },
        { "name": "no-duplicate-type-constituents" },
        { "...": "..."},
        { "name": "restrict-plus-operands" },
        { "name": "restrict-template-expressions" },
        { "name": "return-await" },
        { "name": "switch-exhaustiveness-check" },
        { "name": "unbound-method" },
        { "name": "use-unknown-in-catch-callback-variable" }
      ]
    },
    {
      "file_paths": [
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-floating-promises/src/index.ts",
        "/Users/<user>/workspace/oxc/apps/oxlint/fixtures/tsgolint/no-floating-promises/src/overrides.ts"
      ],
      "rules": [{ "name": "no-floating-promises" }]
    }
  ]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants