PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: yargs/yargs (js)
Issue: Expose yargs-parser
Would you be willing to have yargs re-expose yargs-parser?  My hope is for nyc to be able to do something like `const {Parser} = require('yargs/yargs')`.  This would have the benefit of guaranteeing that when nyc uses the exact same version of `yargs-parser` as yargs itself.  It would also reduce the maintenance burden for packages like nyc, for example right now `yargs-parser@16.1.0` is available but latest yargs uses `yargs-parser@^15.0.0` so anyone who blindly upgrades (my CI passed so it's good) would cause two copies of yargs-parser to get installed.
Pull request description: feat: Expose `Parser` from `require('yargs/yargs')`
Fixes #1475

Patch:
diff --git a/yargs.js b/yargs.js
index 24db759..f901734 100644
--- a/yargs.js
+++ b/yargs.js
@@ -1221,6 +1221,9 @@ function Yargs (processArgs, cwd, parentRequire) {
   return self
 }
 
+// allow consumers to directly use the version of yargs-parser used by yargs
+exports.Parser = Parser
+
 // rebase an absolute path to a relative one with respect to a base directory
 // exported for tests
 exports.rebase = rebase


Test patch:
diff --git a/test/parser.js b/test/parser.js
new file mode 100644
index 0000000..8b9eecd
--- /dev/null
+++ b/test/parser.js
@@ -0,0 +1,11 @@
+'use strict'
+/* global it */
+
+const yargs = require('../yargs')
+const Parser = require('yargs-parser')
+
+require('chai').should()
+
+it('should expose yargs-parser as Parser', () => {
+  yargs.Parser.should.equal(Parser)
+})
Repository: dcastil/tailwind-merge (ts)
Issue: Incorrectly identifies `via-(length:...)` as a color
### Describe the bug

Incorrectly identifies `via-(length:--some-variable)` as a color.

### To Reproduce

```
// prints "via-(length:--mobile-header-gradient-height)"
console.log(
    twMerge(
      "via-background via-(length:--mobile-header-gradient-height)",
    ),
  );
```

### Expected behavior

```
// prints "via-background via-(length:--mobile-header-gradient-height)"
console.log(
    twMerge(
      "via-background via-(length:--mobile-header-gradient-height)",
    ),
  );
```

### Environment

<!-- Add any relevant environment info -->

-   tailwind-merge version: 3.0.2

### Additional context

I managed to workaround the issue by adding this to the `classGroups` of my tailwind merge config:
`"gradient-via-pos": [{ via: [(str: string) => str.startsWith("(length:")] }]`

Pull request description: Fix length variable in `via-(length:*)` class being merged with `via-<color>` classes accidentally
Closes #557

Patch:
diff --git a/src/lib/default-config.ts b/src/lib/default-config.ts
index c8d375f..b332426 100644
--- a/src/lib/default-config.ts
+++ b/src/lib/default-config.ts
@@ -112,7 +112,8 @@ export const getDefaultConfig = () => {
             ...scaleUnambiguousSpacing(),
         ] as const
     const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue] as const
-    const scaleGradientStopPosition = () => [isPercent, isArbitraryLength] as const
+    const scaleGradientStopPosition = () =>
+        [isPercent, isArbitraryVariableLength, isArbitraryLength] as const
     const scaleRadius = () =>
         [
             // Deprecated since Tailwind CSS v4.0.0


Test patch:
diff --git a/tests/tailwind-css-versions.test.ts b/tests/tailwind-css-versions.test.ts
index c8588ec..9c47b4d 100644
--- a/tests/tailwind-css-versions.test.ts
+++ b/tests/tailwind-css-versions.test.ts
@@ -80,4 +80,10 @@ test('supports Tailwind CSS v4.0 features', () => {
         'font-stretch-50%',
     )
     expect(twMerge('col-span-full col-2 row-span-3 row-4')).toBe('col-2 row-4')
+    expect(twMerge('via-red-500 via-(--mobile-header-gradient)')).toBe(
+        'via-(--mobile-header-gradient)',
+    )
+    expect(twMerge('via-red-500 via-(length:--mobile-header-gradient)')).toBe(
+        'via-red-500 via-(length:--mobile-header-gradient)',
+    )
 })
Repository: platers/obsidian-linter (ts)
Issue: Capitalize Headings rule is applied to lines that start with a tag
With the option enabled, this text
```
# title

This note is #incomplete because I was distracted

#incomplete because I was distracted
```
turns into this
```
# Title

This note is #incomplete because I was distracted

#incomplete Because I Was Distracted
```

The rule shouldn't have applied it to the last line, which starts with a tag. (No space after #)

Pull request description: fix capitalize headings applying to tags
fixes #117 

Patch:
diff --git a/src/utils.ts b/src/utils.ts
index b7d67db..358f3de 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -4,7 +4,7 @@ import type {Position} from 'unist';
 
 // Useful regexes
 
-export const headerRegex = /^(\s*)(#+)(\s*)(.*)$/;
+export const headerRegex = /^(\s*)(#+)(\s+)(.*)$/;
 export const fencedRegexTemplate = '^XXX\\.*?\n(?:((?:.|\n)*?)\n)?XXX(?=\\s|$)$';
 export const yamlRegex = /^---\n(?:((?:.|\n)*?)\n)?---(?=\n|$)/;
 export const backtickBlockRegexTemplate = fencedRegexTemplate.replaceAll('X', '`');


Test patch:
diff --git a/src/test.ts b/src/test.ts
index 97c3e71..0f6fe52 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -172,6 +172,15 @@ describe('Rules tests', () => {
         `;
       expect(rulesDict['capitalize-headings'].apply(before, {'Style': 'Title Case'})).toBe(after);
     });
+    it('Ignores tags', () => {
+      const before = dedent`
+        #tag not line
+        `;
+      const after = dedent`
+        #tag not line
+        `;
+      expect(rulesDict['capitalize-headings'].apply(before, {'Style': 'Title Case'})).toBe(after);
+    });
   });
   describe('File Name Heading', () => {
     it('Handles stray dashes', () => {
Repository: phpactor/phpactor (php)
Issue: __destruct() type  declaration
When I have no type declared for __destruct(), phpactor says I should add void return type, but this can't be done, since PHPs definition of __destruct().
Pull request description: gh-1992: Do not suggest return type for __destruct
Fixes #1992

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad79ffda..5249e6c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ Changelog
 Bug fixes:
 
   - Allow class completion within constant declaration in class #1985 @przepompownia
+  - Do not suggest return type on `__destruct` #1992
+
 
 ## 2022.12.12
 
diff --git a/lib/WorseReflection/Bridge/TolerantParser/Diagnostics/MissingReturnTypeProvider.php b/lib/WorseReflection/Bridge/TolerantParser/Diagnostics/MissingReturnTypeProvider.php
index 1e259f83..3899c770 100644
--- a/lib/WorseReflection/Bridge/TolerantParser/Diagnostics/MissingReturnTypeProvider.php
+++ b/lib/WorseReflection/Bridge/TolerantParser/Diagnostics/MissingReturnTypeProvider.php
@@ -62,6 +62,10 @@ class MissingReturnTypeProvider implements DiagnosticProvider
             return;
         }
 
+        if ($method->name() === '__destruct') {
+            return;
+        }
+
         if ($method->type()->isDefined()) {
             return;
         }


Test patch:
diff --git a/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProvider/MissingReturnTypeConstructDestruct.test b/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProvider/MissingReturnTypeConstructDestruct.test
new file mode 100644
index 00000000..12a68adf
--- /dev/null
+++ b/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProvider/MissingReturnTypeConstructDestruct.test
@@ -0,0 +1,11 @@
+<?php
+
+class Foobar {
+    public function __construct()
+    {
+    }
+
+    public function __destruct()
+    {
+    }
+}
diff --git a/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProviderTest.php b/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProviderTest.php
index ae7e068a..94751222 100644
--- a/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProviderTest.php
+++ b/lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Diagonstics/MissingReturnTypeProviderTest.php
@@ -17,6 +17,11 @@ class MissingReturnTypeProviderTest extends DiagnosticsTestCase
         );
     }
 
+    public function checkMissingReturnTypeConstructDestruct(Diagnostics $diagnostics): void
+    {
+        self::assertCount(0, $diagnostics);
+    }
+
     public function checkMissingReturnTypeWithMissingType(Diagnostics $diagnostics): void
     {
         self::assertCount(1, $diagnostics);
Repository: fabien0102/ts-to-zod (ts)
Issue: Error when referencing an imported type in an Index Signature Type
## Feature description

<!-- A clear and concise description of what the feature could be. -->
To support index signature type.

### Input

```ts
// typescript type or interface causing the output
export interface ResourceLink {
    /**
     * The link url.
     * @type {string}
     * @memberof ResourceLink
     */
    href: string;
    /**
     * The link method.
     * @type {string}
     * @memberof ResourceLink
     */
    method: string;
    /**
     * Additional data about the link.
     * @type {string}
     * @memberof ResourceLink
     */
    metadata?: string | null;
}

export interface AppDto {
    /**
     * The links.
     * @type {{ [key: string]: ResourceLink; }}
     * @memberof AppDto
     */
    links: {
        [key: string]: ResourceLink;
    };
}
```

### Output

```ts
// Expected Zod schemas
export const resourceLinkSchema = z.object({
  href: z.string(),
  method: z.string(),
  metadata: z.string().optional().nullable(),
});

export const appDtoSchema = z.object({
  links: z.record(resourceLinkSchema),
});
```

Pull request description: fix: correctly extract types from index signature declaration
# Why

Fixes #277 



Patch:
diff --git a/src/utils/traverseTypes.ts b/src/utils/traverseTypes.ts
index 853683d..1b99335 100644
--- a/src/utils/traverseTypes.ts
+++ b/src/utils/traverseTypes.ts
@@ -38,13 +38,13 @@ export function getReferencedTypeNames(
   referenceTypeNames.add({ name: node.name.text, partOfQualifiedName: false });
 
   const visitorExtract = (child: ts.Node) => {
-    if (!ts.isPropertySignature(child)) {
-      return;
-    }
-
-    const childNode = child as ts.PropertySignature;
-    if (childNode.type) {
-      handleTypeNode(childNode.type);
+    if (ts.isPropertySignature(child)) {
+      const childNode = child as ts.PropertySignature;
+      if (childNode.type) {
+        handleTypeNode(childNode.type);
+      }
+    } else if (ts.isIndexSignatureDeclaration(child) && child.type) {
+      handleTypeNode(child.type);
     }
   };
 


Test patch:
diff --git a/src/utils/traverseTypes.test.ts b/src/utils/traverseTypes.test.ts
index ba011a2..47d22bf 100644
--- a/src/utils/traverseTypes.test.ts
+++ b/src/utils/traverseTypes.test.ts
@@ -477,6 +477,18 @@ describe("traverseTypes", () => {
         { name: "Skill", partOfQualifiedName: false },
       ]);
     });
+
+    it("should extract type in index signature", () => {
+      const source = `export interface Hero {
+        powers: {[name: string] : Power}
+      }`;
+
+      const result = extractNames(source);
+      expect(result).toEqual([
+        { name: "Hero", partOfQualifiedName: false },
+        { name: "Power", partOfQualifiedName: false },
+      ]);
+    });
   });
 });
Repository: capricorn86/happy-dom (ts)
Issue: Serializer escapes attributes too much
I tried using happy-dom with Vitest and when switching from jsdom I got a failing test:

![image](https://user-images.githubusercontent.com/2339406/150375626-9222cbc2-cfe2-47d1-b9b4-b0c976630346.png)
  
![image](https://user-images.githubusercontent.com/2339406/150375278-4d61320c-caf7-4464-96af-771a173cc134.png)
 
happy-dom is escaping characters in html attributes that are allowed. These is not need to use `encode` from `he`, `escape` is enough.
Pull request description: Task/335 fix xml serializer
Fixes #335

Patch:
diff --git a/packages/happy-dom/src/xml-serializer/XMLSerializer.ts b/packages/happy-dom/src/xml-serializer/XMLSerializer.ts
index cbb47440..e3630f94 100644
--- a/packages/happy-dom/src/xml-serializer/XMLSerializer.ts
+++ b/packages/happy-dom/src/xml-serializer/XMLSerializer.ts
@@ -3,7 +3,7 @@ import Node from '../nodes/node/Node';
 import SelfClosingElements from '../config/SelfClosingElements';
 import UnclosedElements from '../config/UnclosedElements';
 import DocumentType from '../nodes/document-type/DocumentType';
-import { encode } from 'he';
+import { escape } from 'he';
 import INode from '../nodes/node/INode';
 import IElement from '../nodes/element/IElement';
 
@@ -70,7 +70,7 @@ export default class XMLSerializer {
 		let attributeString = '';
 		for (const attribute of Object.values((<Element>element)._attributes)) {
 			if (attribute.value !== null) {
-				attributeString += ' ' + attribute.name + '="' + encode(attribute.value) + '"';
+				attributeString += ' ' + attribute.name + '="' + escape(attribute.value) + '"';
 			}
 		}
 		return attributeString;


Test patch:
diff --git a/packages/happy-dom/test/xml-serializer/XMLSerializer.test.ts b/packages/happy-dom/test/xml-serializer/XMLSerializer.test.ts
index c4f37cf0..94526f67 100644
--- a/packages/happy-dom/test/xml-serializer/XMLSerializer.test.ts
+++ b/packages/happy-dom/test/xml-serializer/XMLSerializer.test.ts
@@ -100,5 +100,17 @@ describe('XMLSerializer', () => {
 				'<div><custom-element attr1="value1" attr2="value2" attr3=""></custom-element></div>'
 			);
 		});
+
+		it('Does not escape unicode attributes.', () => {
+			const div = document.createElement('div');
+
+			div.setAttribute('attr1', 'Hello \u{2068}John\u{2069}');
+			div.setAttribute('attr2', '<span> test');
+			div.setAttribute('attr3', '');
+
+			expect(xmlSerializer.serializeToString(div)).toBe(
+				'<div attr1="Hello \u{2068}John\u{2069}" attr2="&lt;span&gt; test" attr3=""></div>'
+			);
+		});
 	});
 });
Repository: tightenco/tlint (php)
Issue: False Positive: `implements X` "There should be no unused imports."
Pull request description: Fix False Positive: `implements X` "There should be no unused imports.
Closes #59 

Patch:
diff --git a/src/Linters/NoUnusedImports.php b/src/Linters/NoUnusedImports.php
index d645706..36c1035 100644
--- a/src/Linters/NoUnusedImports.php
+++ b/src/Linters/NoUnusedImports.php
@@ -32,11 +32,16 @@ class NoUnusedImports extends BaseLinter
                 $used[] = $node->class->toString();
             } elseif ($node instanceof Node\Expr\ClassConstFetch) {
                 $used[] = $node->class->toString();
-            } elseif ($node instanceof Node\Stmt\Class_
-                && property_exists($node, 'extends')
-                && method_exists($node->extends, 'toString')
-            ) {
-                $used[] = $node->extends->toString();
+            } elseif ($node instanceof Node\Stmt\Class_) {
+                if (property_exists($node, 'extends') && method_exists($node->extends, 'toString')) {
+                    $used[] = $node->extends->toString();
+                }
+
+                if (property_exists($node, 'implements')) {
+                    array_map(function ($implemented) use (&$used) {
+                        $used[] = $implemented->toString();
+                    }, $node->implements);
+                }
             } elseif ($node instanceof Node\Param
                 && $node->type instanceof Node\Name
                 && property_exists($node, 'type')


Test patch:
diff --git a/tests/Linters/NoUnusedImportsTest.php b/tests/Linters/NoUnusedImportsTest.php
index e3b942f..bb971b8 100644
--- a/tests/Linters/NoUnusedImportsTest.php
+++ b/tests/Linters/NoUnusedImportsTest.php
@@ -216,4 +216,48 @@ file;
 
         $this->assertEquals(3, $lints[0]->getNode()->getLine());
     }
+
+    /** @test */
+    public function does_not_trigger_when_import_is_used_as_an_interface()
+    {
+        $file = <<<file
+<?php
+
+use Test\ThingA;
+
+class Thing implements ThingA
+{
+}
+
+file;
+
+        $lints = (new TLint)->lint(
+            new NoUnusedImports($file)
+        );
+
+        $this->assertEmpty($lints);
+    }
+
+    /** @test */
+    public function does_not_trigger_when_import_is_used_as_an_interface_along_with_extends()
+    {
+        $file = <<<file
+<?php
+
+namespace App\Jobs;
+
+use Illuminate\Contracts\Queue\ShouldQueue;
+
+class CancelUserForBadCredentials extends Job implements ShouldQueue
+{
+}
+
+file;
+
+        $lints = (new TLint)->lint(
+            new NoUnusedImports($file)
+        );
+
+        $this->assertEmpty($lints);
+    }
 }