PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: gregberge/svgr (ts)

Issue:
Inline css var support
<!-- Love SVGR? Please consider supporting our collective: 👉  https://opencollective.com/svgr/donate -->


I just use a svg file which declares css variable in style attribute.

for example:
test.svg:  
`<svg><path style="--index: 1"></path><path style="--index: 2"></path></svg>`

but it throws an error while transforming:   Expected identifier but found "-"


Pull request:
fix: support CSS variables
Fixes #582


Patch:
diff --git a/packages/hast-util-to-babel-ast/src/stringToObjectStyle.ts b/packages/hast-util-to-babel-ast/src/stringToObjectStyle.ts
index 2d7f4a2..bf9b496 100644
--- a/packages/hast-util-to-babel-ast/src/stringToObjectStyle.ts
+++ b/packages/hast-util-to-babel-ast/src/stringToObjectStyle.ts
@@ -2,21 +2,28 @@
 import * as t from '@babel/types'
 import { hyphenToCamelCase, isNumeric, trimEnd } from './util'
 
+const PX_REGEX = /^\d+px$/
+const MS_REGEX = /^-ms-/
+const VAR_REGEX = /^--/
+
 /**
  * Determines if the CSS value can be converted from a
  * 'px' suffixed string to a numeric value.
  */
 const isConvertiblePixelValue = (value: string) => {
-  return /^\d+px$/.test(value)
+  return PX_REGEX.test(value)
 }
 
 /**
  * Format style key into JSX style object key.
  */
 const formatKey = (key: string) => {
+  if (VAR_REGEX.test(key)) {
+    return t.stringLiteral(key)
+  }
   key = key.toLowerCase()
   // Don't capitalize -ms- prefix
-  if (/^-ms-/.test(key)) key = key.substr(1)
+  if (MS_REGEX.test(key)) key = key.substr(1)
   return t.identifier(hyphenToCamelCase(key))
 }
 


Test patch:
diff --git a/packages/hast-util-to-babel-ast/src/index.test.ts b/packages/hast-util-to-babel-ast/src/index.test.ts
index 5e72b10..30e3054 100644
--- a/packages/hast-util-to-babel-ast/src/index.test.ts
+++ b/packages/hast-util-to-babel-ast/src/index.test.ts
@@ -83,4 +83,16 @@ describe('hast-util-to-babel-ast', () => {
       `"<svg><text><tspan>{\\"<\\"}</tspan></text></svg>;"`,
     )
   })
+
+  it('properly converts style with variables', () => {
+    const code = `<svg><path style="--index: 1; font-size: 24px;"></path><path style="--index: 2"></path></svg>`
+    expect(transform(code)).toMatchInlineSnapshot(`
+      "<svg><path style={{
+          \\"--index\\": 1,
+          fontSize: 24
+        }} /><path style={{
+          \\"--index\\": 2
+        }} /></svg>;"
+    `)
+  })
 })
Repository: bombsimon/wsl (go)

Issue:
Validate error if blocks 
Hi, I have the following issue while using the wsl tool

When two "if" blocks are together, I get: "if statements should only be cuddled with assignments"

```
func validateErr(err error) {
	if err == nil {
         ...
	}
	if errors.Is(err, ErrSomething) {
         ...
	}
...
}
```

But if I insert a space between them, i get : "if statements that check an error must be cuddled with the statement that assigned the error"

```
func validateErr(err error) {
	if err == nil {
         ...
	}

	if errors.Is(err, ErrSomething) {
         ...
	}
...
}
```

Pull request:
Only enforce err cuddling if the statement above was an assignment
Fixes #78

Patch:
diff --git a/wsl.go b/wsl.go
index 3b4a4e9..31520fb 100644
--- a/wsl.go
+++ b/wsl.go
@@ -398,6 +398,18 @@ func (p *Processor) parseBlockStatements(statements []ast.Stmt) {
 			if !cuddledWithLastStmt {
 				checkingErr := atLeastOneInListsMatch(rightAndLeftHandSide, p.config.ErrorVariableNames)
 				if checkingErr {
+					// We only want to enforce cuddling error checks if the
+					// error was assigned on the line above. See
+					// https://github.com/bombsimon/wsl/issues/78.
+					// This is needed since `assignedOnLineAbove` is not
+					// actually just assignments but everything from LHS in the
+					// previous statement. This means that if previous line was
+					// `if err ...`, `err` will now be in the list
+					// `assignedOnLineAbove`.
+					if _, ok := previousStatement.(*ast.AssignStmt); !ok {
+						continue
+					}
+
 					if checkingErrInitializedInline() {
 						continue
 					}


Test patch:
diff --git a/wsl_test.go b/wsl_test.go
index 8d37310..0c5820a 100644
--- a/wsl_test.go
+++ b/wsl_test.go
@@ -1674,6 +1674,50 @@ func TestWithConfig(t *testing.T) {
 				}
 			}`),
 		},
+		{
+			description: "only warn about cuddling errors if it's an expression above",
+			customConfig: &Configuration{
+				ForceCuddleErrCheckAndAssign: true,
+				ErrorVariableNames:           []string{"err"},
+			},
+			code: []byte(`package main
+
+			var ErrSomething error
+
+			func validateErr(err error) {
+				if err == nil {
+					return
+				}
+
+				if errors.Is(err, ErrSomething) {
+					return
+				}
+
+				// Should be valid since the if actually is cuddled so the error
+				// check assumes something right is going on here. If
+				// anotherThingToCheck wasn't used in the if statement we would
+				// get a regular if cuddle error.
+				anotherThingToCheck := someFunc()
+				if multiCheck(anotherThingToCheck, err) {
+					fmt.Println("this must be OK, err is not assigned above")
+				}
+
+				notUsedInNextIf := someFunc()
+
+				if multiCheck(anotherThingToCheck, err) {
+					fmt.Println("this should not warn, we didn't assign err above")
+				}
+
+				// This fails under the cuddle if rule.
+				if err != nil {
+					return
+				}
+				if !errors.Is(err, ErrSomething) {
+					return
+				}
+			}`),
+			expectedErrorStrings: []string{reasonOnlyCuddleIfWithAssign},
+		},
 	}
 
 	for _, tc := range cases {