nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: ember-codemods/ember-angle-brackets-codemod
Pull request #144 (2019-10-01 06:20:19)

Fix inline link-to with subexpression caption crash
see test case 😉 


Patch:
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index bda11a4..ad67f7f 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -303,7 +303,9 @@ function transformToAngleBracket(env, fileInfo, config) {
   }
 
   function transformLinkToTextParam(textParam) {
-    if (textParam.type.includes('Literal')) {
+    if (textParam.type === 'SubExpression') {
+      return subExpressionToMustacheStatement(textParam);
+    } else if (textParam.type.includes('Literal')) {
       return b.text(textParam.value);
     } else {
       return b.mustache(textParam.original);
@@ -466,12 +468,16 @@ function transformToAngleBracket(env, fileInfo, config) {
     );
   }
 
+  function subExpressionToMustacheStatement(subExpression) {
+    return b.mustache(subExpression.path, subExpression.params, subExpression.hash);
+  }
+
   return {
     MustacheStatement(node) {
       // Don't change attribute statements
       const isValidMustache =
         node.loc.source !== '(synthetic)' && !shouldIgnoreMustacheStatement(node.path.original);
-      const tagName = node.path.original;
+      const tagName = node.path && node.path.original;
       const isNestedComponent = isNestedComponentTagName(tagName);
 
       if (


Test patch:
diff --git a/transforms/angle-brackets/test.js b/transforms/angle-brackets/test.js
index d4d068a..1a1b521 100644
--- a/transforms/angle-brackets/test.js
+++ b/transforms/angle-brackets/test.js
@@ -370,6 +370,7 @@ test('link-to-inline', () => {
       segment
       class="t__em-link"
     }}
+    {{link-to (t "show") "flight" event.flight.id class="btn btn-default btn-sm pull-right"}}
   `;
 
   /**
@@ -383,6 +384,7 @@ test('link-to-inline', () => {
         <LinkTo @route=\\"apps.segments\\" class=\\"tabs__discrete-tab\\" @activeClass=\\"o__selected\\" @current-when=\\"apps.segments\\" data-test-segment-link=\\"segments\\">Segments</LinkTo>
         <LinkTo @route={{this.dynamicPath}} class=\\"tabs__discrete-tab\\" @activeClass=\\"o__selected\\" @current-when=\\"apps.segments\\" data-test-segment-link=\\"segments\\">Segments</LinkTo>
         <LinkTo @route=\\"apps.app.companies.segments.segment\\" @model={{segment}} class=\\"t__em-link\\">{{segment.name}}</LinkTo>
+        <LinkTo @route=\\"flight\\" @model={{event.flight.id}} class=\\"btn btn-default btn-sm pull-right\\">{{t \\"show\\"}}</LinkTo>
       "
   `);
 });
Repository: ember-codemods/ember-angle-brackets-codemod
Pull request #168 (2019-10-15 14:09:26)

Skip block component conversion if the component has an `inverse` block
This was causing issues in our app in a few rare cases where this feature was unfortunately used :-/


Patch:
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index 801cd53..e4a6f43 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -340,6 +340,10 @@ function transformToAngleBracket(env, fileInfo, config) {
       return;
     }
 
+    if (node.inverse) {
+      return;
+    }
+
     const newTagName = transformTagName(tagName);
 
     let attributes;


Test patch:
diff --git a/transforms/angle-brackets/test.js b/transforms/angle-brackets/test.js
index baed04b..aa5c755 100644
--- a/transforms/angle-brackets/test.js
+++ b/transforms/angle-brackets/test.js
@@ -981,3 +981,23 @@ test('handles link-to concat with hash', () => {
       "
   `);
 });
+
+test('component-else', () => {
+  let input = `
+    {{#foo bar="baz"}}
+      42
+    {{else}}
+      123
+    {{/foo}}
+  `;
+
+  expect(runTest('component-else.hbs', input)).toMatchInlineSnapshot(`
+    "
+        {{#foo bar=\\"baz\\"}}
+          42
+        {{else}}
+          123
+        {{/foo}}
+      "
+  `);
+});
Repository: ember-codemods/ember-angle-brackets-codemod
Pull request #182 (2019-10-28 16:20:18)

fix hyphen usage
Given
```hbs
{{shared/documents-modal/-email-client}}
```
Expect
```hbs
<Shared::DocumentsModal::-EmailClient />
```

tylerturdenpants: as @rwjblue suggested, I will use `curly-component-invocation` helper in `ember-template-lint`
tylerturdenpants: I will open a new PR for using the helper in `ember-template-lint`

Patch:
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index 158e74a..990c8d9 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -35,6 +35,7 @@ function capitalizedTagName(tagname) {
   return tagname
     .split('-')
     .map(s => {
+      if (!s) return '-';
       return s[0].toUpperCase() + s.slice(1);
     })
     .join('');


Test patch:
diff --git a/transforms/angle-brackets/test.js b/transforms/angle-brackets/test.js
index 48b6f8c..d5c8c44 100644
--- a/transforms/angle-brackets/test.js
+++ b/transforms/angle-brackets/test.js
@@ -1001,3 +1001,25 @@ test('component-else', () => {
       "
   `);
 });
+
+test('hyphens with nested usage', () => {
+  let input = `
+    {{shared/documents-modal/-email-client}}
+    {{shared/-documents-modal/-email-client}}
+    {{-shared/-documents-modal/-email-client}}
+    {{-shared/documents-modal/-email-client}}
+    {{-shared/documents-modal/email-client}}
+    {{shared/-documents-modal/email-client}}
+  `;
+
+  expect(runTest('hyphens-everywhere.hbs', input)).toMatchInlineSnapshot(`
+    "
+        <Shared::DocumentsModal::-EmailClient />
+        <Shared::-DocumentsModal::-EmailClient />
+        <-Shared::-DocumentsModal::-EmailClient />
+        <-Shared::DocumentsModal::-EmailClient />
+        <-Shared::DocumentsModal::EmailClient />
+        <Shared::-DocumentsModal::EmailClient />
+      "
+  `);
+});
Repository: ember-cli/eslint-plugin-ember
Pull request #1539 (2022-07-23 00:36:01)

Fix false positive with `RSVP.reject()` in `no-array-prototype-extensions`
(partially) fixes https://github.com/ember-cli/eslint-plugin-ember/issues/1537.


Patch:
diff --git a/lib/rules/no-array-prototype-extensions.js b/lib/rules/no-array-prototype-extensions.js
index 832e3b17..ba791708 100644
--- a/lib/rules/no-array-prototype-extensions.js
+++ b/lib/rules/no-array-prototype-extensions.js
@@ -62,6 +62,9 @@ const KNOWN_NON_ARRAY_FUNCTION_CALLS = new Set([
   'window.Promise.reject',
   'Promise.reject',
 
+  // RSVP.reject
+  'RSVP.reject',
+
   // *storage.clear()
   'window.localStorage.clear',
   'window.sessionStorage.clear',


Test patch:
diff --git a/tests/lib/rules/no-array-prototype-extensions.js b/tests/lib/rules/no-array-prototype-extensions.js
index 1cece71f..85293660 100644
--- a/tests/lib/rules/no-array-prototype-extensions.js
+++ b/tests/lib/rules/no-array-prototype-extensions.js
@@ -49,6 +49,10 @@ ruleTester.run('no-array-prototype-extensions', rule, {
     'Promise.reject("some reason");',
     'reject();',
 
+    // Global non-array class (RSVP.reject)
+    'RSVP.reject();',
+    'RSVP.reject("some reason");',
+
     // Global non-array class (*storage.clear)
     'window.localStorage.clear();',
     'window.sessionStorage.clear();',