nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: postcss/autoprefixer
Pull request #983 (2018-02-07 15:47:12)

[grid-template-areas] Repetitive grid-area declarations

ai: Awesome! I will merge and release it tomorrow.
evgeny-petukhov: It was incredibly fast, less than a minute 😀
Thank you!
ai: Sorry, release will be delayed until https://github.com/facebook/jest/pull/5489 release

Patch:
diff --git a/lib/hacks/grid-template-areas.js b/lib/hacks/grid-template-areas.js
index 2c27d76..0c84f46 100644
--- a/lib/hacks/grid-template-areas.js
+++ b/lib/hacks/grid-template-areas.js
@@ -58,16 +58,20 @@ class GridTemplateAreas extends Declaration {
         if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes);
 
         const areas = parseGridAreas(decl.value);
+        let missed = Object.keys(areas);
+
         this.getRoot(decl.parent).walkDecls('grid-area', gridArea => {
             const value = gridArea.value;
             const area = areas[value];
-            delete areas[value];
 
-            if (gridArea.parent.some(i => i.prop === '-ms-grid-row')) {
-                return undefined;
-            }
+            missed = missed.filter(e => e !== value);
 
             if (area) {
+                gridArea.parent
+                    .walkDecls(/-ms-grid-(row|column)/, (d) => {
+                        d.remove();
+                    });
+
                 gridArea.cloneBefore({
                     prop: '-ms-grid-row',
                     value: String(area.row.start)
@@ -92,7 +96,6 @@ class GridTemplateAreas extends Declaration {
             return undefined;
         });
 
-        const missed = Object.keys(areas);
         if (missed.length > 0) {
             decl.warn(result, 'Can not find grid areas: ' + missed.join(', '));
         }


Test patch:
diff --git a/test/cases/grid-template-areas.css b/test/cases/grid-template-areas.css
index 41b96b3..fbf2318 100644
--- a/test/cases/grid-template-areas.css
+++ b/test/cases/grid-template-areas.css
@@ -2,7 +2,8 @@
     grid-template-areas:
         "head head"
         "nav  main"
-        "nav  foot";
+        "nav  foot"
+        "another";
 }
 
 .b {
@@ -21,6 +22,10 @@
     grid-area: foot;
 }
 
+.f {
+    grid-area: foot;
+}
+
 @media (max-width: 1000px) {
     .a {
         grid-template-areas: "head main";
@@ -33,4 +38,8 @@
     .c {
         grid-area: main;
     }
+
+    .d {
+        grid-area: main;
+    }
 }
diff --git a/test/cases/grid-template-areas.out.css b/test/cases/grid-template-areas.out.css
index 68e50ec..348c6ce 100644
--- a/test/cases/grid-template-areas.out.css
+++ b/test/cases/grid-template-areas.out.css
@@ -2,7 +2,8 @@
     grid-template-areas:
         "head head"
         "nav  main"
-        "nav  foot";
+        "nav  foot"
+        "another";
 }
 
 .b {
@@ -31,6 +32,12 @@
     grid-area: foot;
 }
 
+.f {
+    -ms-grid-row: 3;
+    -ms-grid-column: 2;
+    grid-area: foot;
+}
+
 @media (max-width: 1000px) {
     .a {
         grid-template-areas: "head main";
@@ -47,4 +54,10 @@
         -ms-grid-column: 2;
         grid-area: main;
     }
+
+    .d {
+        -ms-grid-row: 1;
+        -ms-grid-column: 2;
+        grid-area: main;
+    }
 }