Unverified Commit 110493e2 authored by Jon Seager's avatar Jon Seager Committed by GitHub
Browse files

tsgolint: fix version field, add updateScript, 0.10.1 -> 0.11.0 (#479740)

parents 5538ef3c a4b75975
Loading
Loading
Loading
Loading
+38 −32
Original line number Diff line number Diff line
@@ -3,45 +3,47 @@
  buildGoModule,
  fetchFromGitHub,
  findutils,
  applyPatches,
  go,
  nix-update-script,
}:

buildGoModule (finalAttrs: {
  pname = "tsgolint";
  version = "v0.10.1";
  version = "0.11.0";

  src = applyPatches rec {
  src = fetchFromGitHub {
    owner = "oxc-project";
    repo = "tsgolint";
      tag = finalAttrs.version;
      hash = "sha256-6cDQjYVNfujIh3s+9pNCfqUEtfdvgx66oZoENqpJ7jE=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-AVyZ/2jjAq9rqLvvzaiZrSYwhGoc/stADvrnh7hCwNk=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ findutils ];

  prePatch = ''
      cd typescript-go
    pushd typescript-go
  '';

  # These patches are applied to the typescript-go submodule in justfile's "init" target upstream.
  patches = [
      (src + "/patches/0001-Parallel-readDirectory-visitor.patch")
      (src + "/patches/0002-Adapt-project-service-for-single-run-mode.patch")
      (src + "/patches/0003-patch-expose-more-functions-via-the-shim-with-type-f.patch")
      (src + "/patches/0004-feat-improve-panic-message-for-extracting-TS-extensi.patch")
      (src + "/patches/0005-fix-early-return-from-invalid-tsconfig-for-better-er.patch")
    (finalAttrs.src + "/patches/0001-Parallel-readDirectory-visitor.patch")
    (finalAttrs.src + "/patches/0002-Adapt-project-service-for-single-run-mode.patch")
    (finalAttrs.src + "/patches/0003-patch-expose-more-functions-via-the-shim-with-type-f.patch")
    (finalAttrs.src + "/patches/0004-feat-improve-panic-message-for-extracting-TS-extensi.patch")
    (finalAttrs.src + "/patches/0005-fix-early-return-from-invalid-tsconfig-for-better-er.patch")
  ];

  postPatch =
    # We don't want to build with go.work, so we add the replacement to
    # the local module to the go.mod instead.
    postPatch = ''
      cd ..
    ''
      popd
      ${lib.getExe go} mod edit --replace=github.com/microsoft/typescript-go=./typescript-go
    '';
  };

  nativeBuildInputs = [ findutils ];

    ''
    +
    # From justfile's "init" target upstream.
  postPatch = ''
    ''
      rm go.work{,.sum}
      mkdir -p internal/collections && find ./typescript-go/internal/collections -type f ! -name '*_test.go' -exec cp {} internal/collections/ \;
    '';
@@ -53,6 +55,10 @@ buildGoModule (finalAttrs: {

  env.GOEXPERIMENT = "greenteagc";

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = {
    description = "Type aware linting for oxlint";
    homepage = "https://github.com/oxc-project/tsgolint";