PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: pmcelhaney/counterfact (ts)

Issue:
Trailing slashes on an endpoint?
### Discussed in https://github.com/pmcelhaney/counterfact/discussions/702

<div type='discussions-op-text'>

<sup>Originally posted by **dethell-jh** January  5, 2024</sup>
Some of our codebase has endpoint references written with a trailing slash such as: `${myApiUrl}/someEndPoint/`. This throws off Counterfact because even though I have a file at `paths/someEndPoint.ts` that handles the need, Counterfact is expecting a subpath after the trailing slash. If I update the codebase to remove the trailing slash it works, but I'm trying to get my Counterfact setup to be a drop-in for the API that doesn't require the UX side to make changes just to accommodate Counterfact. Ideas?</div>

Pull request:
fix(server): Trailing slashes on an endpoint #703
fix #703

Patch:
diff --git a/.changeset/selfish-cameras-wave.md b/.changeset/selfish-cameras-wave.md
new file mode 100644
index 0000000..37db5d5
--- /dev/null
+++ b/.changeset/selfish-cameras-wave.md
@@ -0,0 +1,5 @@
+---
+"counterfact": patch
+---
+
+Fix issue 703: Endpoint with trailing slash
diff --git a/src/server/module-tree.ts b/src/server/module-tree.ts
index 5ddb24f..7e1c218 100644
--- a/src/server/module-tree.ts
+++ b/src/server/module-tree.ts
@@ -168,7 +168,10 @@ export class ModuleTree {
       );
     }
 
-    if (remainingSegments.length === 0) {
+    if (
+      remainingSegments.length === 0 ||
+      (remainingSegments.length === 1 && remainingSegments[0] === "")
+    ) {
       return this.buildMatch(directory, segment, pathVariables, matchedPath);
     }
 


Test patch:
diff --git a/test/server/module-tree.test.ts b/test/server/module-tree.test.ts
index c644ffe..5295f0e 100644
--- a/test/server/module-tree.test.ts
+++ b/test/server/module-tree.test.ts
@@ -33,6 +33,12 @@ it("finds a file under a subdirectory", () => {
   expect(match(moduleTree, "/a/b")).toBe("b");
 });
 
+it("finds a file with a trailing slash in the path", () => {
+  const moduleTree = new ModuleTree();
+  add(moduleTree, "/a", "a");
+  expect(match(moduleTree, "/a/")).toBe("a");
+});
+
 it("finds a file with a wildcard match", () => {
   const moduleTree = new ModuleTree();
   add(moduleTree, "/a", "a");
Repository: typescript-eslint/tslint-to-eslint-config (ts)

Issue:
Convert space-within-parens to space-in-parens
### 🐛 Bug Report

-   `tslint-to-eslint-config` version: 0.5.0
-   ESLint version: 6.8.0
-   Node version: 11.10.0

#### Actual Behavior

TSLint rule `space-within-parens` will be converted to `@typescript-eslint/space-within-parens` (see #184 and #193), but there is no rule for that (anymore?) in the `@typescript-eslint` plugin. Instead ESLint's core rule `space-in-parens` should be used, as stated [here](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md#style) as well.

#### Expected Behavior

TSLint rule `space-within-parens` will be converted to `space-in-parens`.

Pull request:
Convert space-within-parens to space-in-parens
## PR Checklist

-   [x] Addresses an existing issue: fixes #307 
-   [x] That issue was marked as [`status: accepting prs`](https://github.com/typescript-eslint/tslint-to-eslint-config/labels/status%3A%20accepting%20prs)

## Overview

TSLint rule `space-within-parens` will be converted to `space-in-parens` instead of `@typescript-eslint/space-within-parens`




Patch:
diff --git a/src/rules/converters/space-within-parens.ts b/src/rules/converters/space-within-parens.ts
index 307dfba..f24c898 100644
--- a/src/rules/converters/space-within-parens.ts
+++ b/src/rules/converters/space-within-parens.ts
@@ -16,7 +16,7 @@ export const convertSpaceWithinParens: RuleConverter = tslintRule => {
             {
                 ...(notices !== undefined && { notices }),
                 ruleArguments: [arg],
-                ruleName: "@typescript-eslint/space-within-parens",
+                ruleName: "space-in-parens",
             },
         ],
     };


Test patch:
diff --git a/src/rules/converters/tests/space-within-parens.test.ts b/src/rules/converters/tests/space-within-parens.test.ts
index 923af54..32aed65 100644
--- a/src/rules/converters/tests/space-within-parens.test.ts
+++ b/src/rules/converters/tests/space-within-parens.test.ts
@@ -10,7 +10,7 @@ describe(convertSpaceWithinParens, () => {
             rules: [
                 {
                     ruleArguments: ["never"],
-                    ruleName: "@typescript-eslint/space-within-parens",
+                    ruleName: "space-in-parens",
                 },
             ],
         });
@@ -26,7 +26,7 @@ describe(convertSpaceWithinParens, () => {
                 {
                     notices: ["The number of spaces will be ignored"],
                     ruleArguments: ["always"],
-                    ruleName: "@typescript-eslint/space-within-parens",
+                    ruleName: "space-in-parens",
                 },
             ],
         });
Repository: tomekpiotrowski/lets_expect (rust)

Issue:
`u128` type is not supported by the number humanizer

Pull request:
Support `u128` type in the number humanizer
Fixes #59

Patch:
diff --git a/lets_expect_core/src/core/to_ident.rs b/lets_expect_core/src/core/to_ident.rs
index 6150d9c..57dbcc3 100644
--- a/lets_expect_core/src/core/to_ident.rs
+++ b/lets_expect_core/src/core/to_ident.rs
@@ -207,7 +207,13 @@ fn expr_lit_to_ident(lit: &syn::ExprLit) -> String {
         Lit::ByteStr(_) => todo!(),
         Lit::Byte(_) => todo!(),
         Lit::Char(_) => todo!(),
-        Lit::Int(value) => humanize(value.base10_parse::<i64>().unwrap()),
+        Lit::Int(value) => {
+            if let Ok(parsed) = value.base10_parse::<i64>() {
+                humanize(parsed)
+            } else {
+                "number_".to_string() + value.to_string().as_str()
+            }
+        }
         Lit::Float(value) => {
             let value: f64 = value.base10_parse().unwrap();
             let formatted = format!("{:.2}", value);


Test patch:
diff --git a/tests/let.rs b/tests/let.rs
index eef38c2..f02636b 100644
--- a/tests/let.rs
+++ b/tests/let.rs
@@ -35,6 +35,10 @@ mod tests {
             when(value = value * 3) {
                 to equal(30)
             }
+
+            when(value: u128 = 1267650600228229401496703205376) {
+                to equal(2535301200456458802993406410752)
+            }
         }
 
     }
Repository: myelin-ai/mockiato (rust)

Issue:
Implement Default for mocks
Simply let `fn default() -> Self` return `Self::new()`. This needs to be documented at [the trait bounds documentation](https://github.com/myelin-ai/mockiato/blob/master/docs/trait-bounds.md) or, if #46 has been resolved, in the readme.

Pull request:
Implement Default for mocks
Resolves #45

Patch:
diff --git a/mockiato-codegen/src/generate/mock_struct.rs b/mockiato-codegen/src/generate/mock_struct.rs
index 204f691..588a8b7 100644
--- a/mockiato-codegen/src/generate/mock_struct.rs
+++ b/mockiato-codegen/src/generate/mock_struct.rs
@@ -62,6 +62,13 @@ pub(crate) fn generate_mock_struct(
 
             #expect_methods
         }
+
+        impl Default for #mock_struct_ident {
+            /// Creates a new mock with no expectations.
+            fn default() -> Self {
+                Self::new()
+            }
+        }
     }
 }
 
diff --git a/mockiato/examples/default.rs b/mockiato/examples/default.rs
new file mode 100644
index 0000000..e58ee44
--- /dev/null
+++ b/mockiato/examples/default.rs
@@ -0,0 +1,14 @@
+use mockiato::mockable;
+use std::fmt::Debug;
+
+#[mockable]
+trait Animal: Debug {
+    fn make_sound(&self);
+}
+
+fn main() {
+    let mut animal = AnimalMock::default();
+
+    animal.expect_make_sound().times(1);
+    animal.make_sound();
+}
diff --git a/readme.md b/readme.md
index 9fc842d..cfa1583 100644
--- a/readme.md
+++ b/readme.md
@@ -12,3 +12,5 @@ The following traits are always implemented for mocks:
   Example: `cargo run --example debug`
 - [Clone](https://doc.rust-lang.org/std/clone/trait.Clone.html)  
   Example: `cargo test --example clone` 
+- [Default](https://doc.rust-lang.org/std/default/trait.Default.html)  
+  Example: `cargo test --example default` 


Test patch:
diff --git a/mockiato/tests/default.rs b/mockiato/tests/default.rs
new file mode 100644
index 0000000..6449b08
--- /dev/null
+++ b/mockiato/tests/default.rs
@@ -0,0 +1,11 @@
+mod foo {
+    use mockiato::mockable;
+
+    #[mockable]
+    pub(super) trait Bar {}
+}
+
+#[test]
+fn default_works() {
+    let _ = foo::BarMock::default();
+}
Repository: okonet/lint-staged (js)

Issue:
Upgrade cosmiconfig to 3.x
https://github.com/davidtheclark/cosmiconfig 2.x offers caching and [`transform`](https://github.com/davidtheclark/cosmiconfig#transform) function that should potentially make #262 obsolete. 

Pull request:
chore: Bump cosmiconfig to v3, rm greenkeeper ignore
- Bump cosmiconfig {`1.1.0` ➡ `3.1.0`}, refactor usage.
- Remove greenkeeper directive for ignoring cosmiconfig.
- Update test mock impls for new cosmiconfig API.

Closes #282.

Patch:
diff --git a/package.json b/package.json
index 4423aef..47ded3d 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
     "app-root-path": "^2.0.0",
     "chalk": "^2.1.0",
     "commander": "^2.11.0",
-    "cosmiconfig": "^1.1.0",
+    "cosmiconfig": "^3.1.0",
     "execa": "^0.8.0",
     "is-glob": "^4.0.0",
     "jest-validate": "^21.1.0",
@@ -70,11 +70,6 @@
       "./testSetup.js"
     ]
   },
-  "greenkeeper": {
-    "ignore": [
-      "cosmiconfig"
-    ]
-  },
   "keywords": [
     "lint",
     "git",
diff --git a/src/index.js b/src/index.js
index bfd807e..df60a1e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -28,11 +28,14 @@ const errConfigNotFound = new Error('Config could not be found')
 module.exports = function lintStaged(injectedLogger, configPath) {
   const logger = injectedLogger || console
 
-  return cosmiconfig('lint-staged', {
+  const explorer = cosmiconfig('lint-staged', {
     configPath,
     rc: '.lintstagedrc',
     rcExtensions: true
   })
+
+  return explorer
+    .load(process.cwd())
     .then(result => {
       if (result == null) throw errConfigNotFound
 


Test patch:
diff --git a/test/index.spec.js b/test/index.spec.js
index f73388a..d29e065 100644
--- a/test/index.spec.js
+++ b/test/index.spec.js
@@ -10,6 +10,10 @@ const replaceSerializer = (from, to) => ({
 
 jest.mock('cosmiconfig')
 
+const mockCosmiconfigWith = result => {
+  cosmiconfig.mockImplementationOnce(() => ({ load: () => Promise.resolve(result) }))
+}
+
 describe('lintStaged', () => {
   let logger
 
@@ -24,7 +28,7 @@ describe('lintStaged', () => {
         '*': 'mytask'
       }
     }
-    cosmiconfig.mockImplementationOnce(() => Promise.resolve({ config }))
+    mockCosmiconfigWith({ config })
     await lintStaged(logger)
     expect(logger.printHistory()).toMatchSnapshot()
   })
@@ -33,7 +37,7 @@ describe('lintStaged', () => {
     const config = {
       '*': 'mytask'
     }
-    cosmiconfig.mockImplementationOnce(() => Promise.resolve({ config }))
+    mockCosmiconfigWith({ config })
     await lintStaged(logger)
     expect(logger.printHistory()).toMatchSnapshot()
   })
@@ -44,7 +48,7 @@ describe('lintStaged', () => {
   })
 
   it('should print helpful error message when config file is not found', async () => {
-    cosmiconfig.mockImplementationOnce(() => Promise.resolve(null))
+    mockCosmiconfigWith(null)
     await lintStaged(logger)
     expect(logger.printHistory()).toMatchSnapshot()
   })
Repository: capricorn86/happy-dom (ts)

Issue:
the default pathname is '/'
Associate with #508 

```javascript
const { Window } = require('../packages/happy-dom');
const window = new Window();

const url = 'https://www.example.com';
const u = new window.URL(url);
console.log(u.pathname);
// happy-dom: ''
// browers: '/'
```

Pull request:
#515@patch: Fixes default pathname when parse URL.
Fixes #515

Patch:
diff --git a/packages/happy-dom/src/location/URL.ts b/packages/happy-dom/src/location/URL.ts
index c1fd73c6..e66e4317 100644
--- a/packages/happy-dom/src/location/URL.ts
+++ b/packages/happy-dom/src/location/URL.ts
@@ -85,7 +85,7 @@ export default class URL {
 			this.protocol = match[1] || '';
 			this.hostname = hostnamePart.length > 1 ? hostnamePart[1] : hostnamePart[0];
 			this.port = match[3] || '';
-			this.pathname = match[4] || '';
+			this.pathname = match[4] || '/';
 			this.search = match[5] || '';
 			this.hash = match[6] || '';
 			this.username = credentialsPart ? credentialsPart[0] : '';


Test patch:
diff --git a/packages/happy-dom/test/location/URL.test.ts b/packages/happy-dom/test/location/URL.test.ts
index 806ab863..7a8477f4 100644
--- a/packages/happy-dom/test/location/URL.test.ts
+++ b/packages/happy-dom/test/location/URL.test.ts
@@ -49,5 +49,21 @@ describe('URL', () => {
 			expect(url.host).toBe('google.com:8080');
 			expect(url.origin).toBe('https://google.com:8080');
 		});
+		it('Parses "https://google.com".', () => {
+			const formatHref = 'https://google.com/';
+			const href = 'https://google.com';
+			const url = new URL(href);
+			expect(url.href).toBe(formatHref);
+			expect(url.protocol).toBe('https:');
+			expect(url.hostname).toBe('google.com');
+			expect(url.port).toBe('');
+			expect(url.pathname).toBe('/');
+			expect(url.search).toBe('');
+			expect(url.hash).toBe('');
+			expect(url.username).toBe('');
+			expect(url.password).toBe('');
+			expect(url.host).toBe('google.com');
+			expect(url.origin).toBe('https://google.com');
+		});
 	});
 });
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 339
Good morning! Here's your coding interview problem for today.

This problem was asked by Microsoft.

Given an array of numbers and a number k, determine if there are three entries in the array which add up to the specified number k. For example, given `[20, 303, 3, 4, 25]` and `k = 49`, return true as `20 + 4 + 25 = 49`.

Pull request:
Day339
Resolves #676.

Patch:
diff --git a/README.md b/README.md
index d5171eb..c4ca6c1 100644
--- a/README.md
+++ b/README.md
@@ -329,3 +329,4 @@ problems from
 * [Day 323](https://github.com/vaskoz/dailycodingproblem-go/issues/656)
 * [Day 324](https://github.com/vaskoz/dailycodingproblem-go/issues/658)
 * [Day 325](https://github.com/vaskoz/dailycodingproblem-go/issues/660)
+* [Day 339](https://github.com/vaskoz/dailycodingproblem-go/issues/676)
diff --git a/day339/problem.go b/day339/problem.go
new file mode 100644
index 0000000..1b69736
--- /dev/null
+++ b/day339/problem.go
@@ -0,0 +1,29 @@
+package day339
+
+// ThreeSum returns the first possible answer to the 3-SUM
+// problem.
+// Runs in O(N^2) time and O(N) space due to a map.
+// If no answer exists it returns nil.
+func ThreeSum(nums []int, k int) []int {
+	m := make(map[int]int)
+	for _, v := range nums {
+		m[v]++
+	}
+	for i := 0; i < len(nums)-2; i++ {
+		for j := i + 1; j < len(nums)-1; j++ {
+			needed := k - nums[i] - nums[j]
+			if m[needed] >= 0 {
+				m[nums[i]]--
+				m[nums[j]]--
+				m[needed]--
+				if m[nums[i]] >= 0 && m[nums[j]] >= 0 && m[needed] >= 0 {
+					return []int{nums[i], nums[j], needed}
+				}
+				m[nums[i]]++
+				m[nums[j]]++
+				m[needed]++
+			}
+		}
+	}
+	return nil
+}


Test patch:
diff --git a/day339/problem_test.go b/day339/problem_test.go
new file mode 100644
index 0000000..e187240
--- /dev/null
+++ b/day339/problem_test.go
@@ -0,0 +1,36 @@
+package day339
+
+import (
+	"reflect"
+	"testing"
+)
+
+// nolint
+var testcases = []struct {
+	nums     []int
+	k        int
+	expected []int
+}{
+	{[]int{20, 303, 3, 4, 25}, 49, []int{20, 4, 25}},
+	{[]int{20, 303, 3, 4, 25}, 1000, nil},
+	{[]int{300}, 900, nil},
+	{[]int{300, 301, 300}, 900, nil},
+	{[]int{300, 300, 301}, 900, nil},
+}
+
+func TestThreeSum(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ThreeSum(tc.nums, tc.k); !reflect.DeepEqual(result, tc.expected) {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkThreeSum(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ThreeSum(tc.nums, tc.k)
+		}
+	}
+}