PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: moment/luxon (js)

Issue:
`Duration#toFormat` should support a formatting token for `week`
I'm surprised that `Duration#toFormat` doesn't support a token for `week` (7 days). (e.g. `w`)

Is there a reason this unit token was omitted for Duration specifically?

Current release tag source ref: https://github.com/moment/luxon/blob/2.3.1/src/duration.js#L397-L426

Pull request:
feat: add week formatting token "w" for duration
Resolves #1164

(Working with casual conversion accuracy was quite confusing when writing the test. 🤯)

Patch:
diff --git a/src/duration.js b/src/duration.js
index 2530a410..0cec4f56 100644
--- a/src/duration.js
+++ b/src/duration.js
@@ -401,6 +401,7 @@ export default class Duration {
    * * `m` for minutes
    * * `h` for hours
    * * `d` for days
+   * * `w` for weeks
    * * `M` for months
    * * `y` for years
    * Notes:
diff --git a/src/impl/formatter.js b/src/impl/formatter.js
index 38200c85..b3486301 100644
--- a/src/impl/formatter.js
+++ b/src/impl/formatter.js
@@ -363,6 +363,8 @@ export default class Formatter {
             return "hour";
           case "d":
             return "day";
+          case "w":
+            return "week";
           case "M":
             return "month";
           case "y":


Test patch:
diff --git a/test/duration/format.test.js b/test/duration/format.test.js
index 686154fe..abcf4f4c 100644
--- a/test/duration/format.test.js
+++ b/test/duration/format.test.js
@@ -206,6 +206,19 @@ test("Duration#toFormat('d') returns days", () => {
   expect(lil.toFormat("dddd")).toBe("0006");
 });
 
+test("Duration#toFormat('w') returns weeks", () => {
+  expect(dur().toFormat("w")).toBe("61");
+  expect(dur().toFormat("w", { floor: false })).toBe("61.453");
+  expect(dur().toFormat("w:s")).toBe("61:273906");
+  expect(dur().toFormat("w:dd:h:mm:ss.SSS")).toBe("61:03:4:05:06.007");
+
+  const lil = Duration.fromObject({ weeks: 6 });
+  expect(lil.toFormat("w")).toBe("6");
+  expect(lil.toFormat("ww")).toBe("06");
+  expect(lil.toFormat("www")).toBe("006");
+  expect(lil.toFormat("wwww")).toBe("0006");
+});
+
 test("Duration#toFormat('M') returns months", () => {
   expect(dur().toFormat("M")).toBe("14");
   expect(dur().toFormat("M", { floor: false })).toBe("14.356");
Repository: jlongster/prettier (js)

Issue:
Missing parentheses around weird arrow function body
Input: (using an object as a template literal tagger)

```js
() => ({}`a`)
```

Output:

```js
(() => {}`a`);
```

... which is invalid JS.

Expected:

```js
(() => ({}`a`));
```

https://jlongster.github.io/prettier/#%7B%22content%22%3A%22()%20%3D%3E%20(%7B%7D%60a%60)%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Afalse%2C%22trailingComma%22%3Afalse%2C%22bracketSpacing%22%3Atrue%2C%22doc%22%3Afalse%7D%7D

Found using the fuzzer.

Pull request:
Fix parenthesis in object as left-hand-side of template
Fixes #392

Patch:
diff --git a/src/fast-path.js b/src/fast-path.js
index 74e994d07..1d34e7421 100644
--- a/src/fast-path.js
+++ b/src/fast-path.js
@@ -405,6 +405,7 @@ FPp.needsParens = function(assumeExpressionContext) {
 
     case "ClassExpression":
       switch (parent.type) {
+        case "BinaryExpression":
         case "ExportDefaultDeclaration":
         case "ExpressionStatement":
           return true;
@@ -416,6 +417,9 @@ FPp.needsParens = function(assumeExpressionContext) {
       if (parent.type === "ArrowFunctionExpression" && name === "body") {
         return true;
       }
+      if (parent.type === "TaggedTemplateExpression") {
+        return true;
+      }
 
     default:
       if (


Test patch:
diff --git a/tests/classes/__snapshots__/jsfmt.spec.js.snap b/tests/classes/__snapshots__/jsfmt.spec.js.snap
index 4644dbbd2..d2de13bf1 100644
--- a/tests/classes/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/classes/__snapshots__/jsfmt.spec.js.snap
@@ -74,6 +74,19 @@ new E().x;
 "
 `;
 
+exports[`test binary.js 1`] = `
+"(class {}) + 1;
+(class a {}) + 1;
+(class extends b {}) + 1;
+(class a extends b {}) + 1;
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+(class {}) + 1;
+(class a {}) + 1;
+(class extends b {}) + 1;
+(class a extends b {}) + 1;
+"
+`;
+
 exports[`test class_shapes.js 1`] = `
 "/* @flow */
 
diff --git a/tests/classes/binary.js b/tests/classes/binary.js
new file mode 100644
index 000000000..f60f9c8f7
--- /dev/null
+++ b/tests/classes/binary.js
@@ -0,0 +1,4 @@
+(class {}) + 1;
+(class a {}) + 1;
+(class extends b {}) + 1;
+(class a extends b {}) + 1;
diff --git a/tests/objects/__snapshots__/jsfmt.spec.js.snap b/tests/objects/__snapshots__/jsfmt.spec.js.snap
index 74d07ce15..c3fa28ebb 100644
--- a/tests/objects/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/objects/__snapshots__/jsfmt.spec.js.snap
@@ -43,6 +43,15 @@ var z = Object(123);
 "
 `;
 
+exports[`test expression.js 1`] = `
+"() => ({}\`\`);
+({})\`\`;
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+(() => ({})\`\`);
+({})\`\`;
+"
+`;
+
 exports[`test objects.js 1`] = `
 "/* @flow */
 
diff --git a/tests/objects/expression.js b/tests/objects/expression.js
new file mode 100644
index 000000000..fd92a69bf
--- /dev/null
+++ b/tests/objects/expression.js
@@ -0,0 +1,2 @@
+() => ({}``);
+({})``;