nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: rwjblue/ember-template-lint
Pull request #335 (2018-01-11 16:04:19)

table-groups textnode bug
table-groups gave false positives, since text nodes where not supported.



Patch:
diff --git a/lib/rules/lint-table-groups.js b/lib/rules/lint-table-groups.js
index cda3eb1..d75ac11 100644
--- a/lib/rules/lint-table-groups.js
+++ b/lib/rules/lint-table-groups.js
@@ -6,11 +6,12 @@ const message = 'Tables must have a table group (thead, tbody or tfoot).';
 const ALLOWED_TABLE_CHILDREN = ['thead', 'tbody', 'tfoot', 'caption', 'colgroup'];
 
 function hasDisallowedChildren(tableNode) {
-  const tableGroup = tableNode.children.find((child) => {
-    return !(child.type === 'ElementNode' && ALLOWED_TABLE_CHILDREN.indexOf(child.tag) > -1);
-  });
-
-  return !!tableGroup;
+  return tableNode.children.some((child) =>
+    !(
+      (child.type === 'ElementNode' && ALLOWED_TABLE_CHILDREN.indexOf(child.tag) > -1) ||
+      (child.type === 'TextNode' && !/\S/.test(child.chars))
+    )
+  );
 }
 
 function hasChildTags(tableNode) {


Test patch:
diff --git a/test/unit/rules/lint-table-groups-test.js b/test/unit/rules/lint-table-groups-test.js
index 8ece163..692eb9f 100644
--- a/test/unit/rules/lint-table-groups-test.js
+++ b/test/unit/rules/lint-table-groups-test.js
@@ -10,7 +10,7 @@ generateRuleTests({
 
   good: [
     '<table> </table>',
-    '<table><caption>Foo</caption></table>',
+    '<table> <caption>Foo</caption></table>',
     '<table><colgroup><col style="background-color: red"></colgroup></table>',
     '<table><thead><tr><td>Header</td></tr></thead></table>',
     '<table><tbody><tr><td>Body</td></tr></tbody></table>',
@@ -34,6 +34,10 @@ generateRuleTests({
         '<tr><td>Body</td></tr>' +
       '</tbody>' +
     '</table>',
+    '<table>\n' +
+      '<tbody>\n' +
+      '</tbody>\n' +
+    '</table>',
   ],
 
   bad: [
@@ -86,6 +90,17 @@ generateRuleTests({
         line: 1,
         column: 0
       }
+    },
+    {
+      template: '<table> whitespace<thead></thead></table>',
+
+      result: {
+        message,
+        moduleId: 'layout.hbs',
+        source: '<table> whitespace<thead></thead></table>',
+        line: 1,
+        column: 0
+      }
     }
   ]
 });
Repository: rwjblue/ember-template-lint
Pull request #355 (2018-03-04 01:35:20)

Allow form elements to have reset actions
An exception to the invalid-interactive rule already exists for allowing `onsubmit` attributes and `{{action "foo" on="submit"}}` on form elements. This makes that same exception for `reset` events. 

- allow `onreset={{action "foo"}}` on form tags
- allow `{{action "foo" on="reset"}}` on form tags


Patch:
diff --git a/lib/rules/lint-invalid-interactive.js b/lib/rules/lint-invalid-interactive.js
index 1680603..c938dfd 100644
--- a/lib/rules/lint-invalid-interactive.js
+++ b/lib/rules/lint-invalid-interactive.js
@@ -47,6 +47,11 @@ module.exports = class InvalidInteractive extends Rule {
             return;
           }
 
+          // Allow {{action "foo" on="reset"}} on form tags
+          if (this._element.tag === 'form' && isResetAction(node)) {
+            return;
+          }
+
           this.log({
             message: 'Interaction added to non-interactive element',
             line: node.loc && node.loc.start.line,
@@ -71,6 +76,11 @@ module.exports = class InvalidInteractive extends Rule {
             return;
           }
 
+          // Allow onreset={{action "foo"}} on form tags
+          if (this._element.tag === 'form' && node.name === 'onreset') {
+            return;
+          }
+
           this.log({
             message: 'Interaction added to non-interactive element',
             line: node.loc && node.loc.start.line,
@@ -86,7 +96,7 @@ module.exports = class InvalidInteractive extends Rule {
   }
 };
 
-function isSubmitAction(node) {
+function isActionName(node, name) {
   let hashPairs = node.hash.pairs || [];
   let i;
   let l = hashPairs.length;
@@ -94,10 +104,18 @@ function isSubmitAction(node) {
 
   for (i = 0; i < l; i++) {
     hashItem = hashPairs[i];
-    if (hashItem.key === 'on' && hashItem.value.value === 'submit') {
+    if (hashItem.key === 'on' && hashItem.value.value === name) {
       return true;
     }
   }
 
   return false;
 }
+
+function isSubmitAction(node) {
+  return isActionName(node, 'submit');
+}
+
+function isResetAction(node) {
+  return isActionName(node, 'reset');
+}


Test patch:
diff --git a/test/unit/rules/lint-invalid-interactive-test.js b/test/unit/rules/lint-invalid-interactive-test.js
index b2d5002..8e23d9e 100644
--- a/test/unit/rules/lint-invalid-interactive-test.js
+++ b/test/unit/rules/lint-invalid-interactive-test.js
@@ -13,6 +13,8 @@ generateRuleTests({
     '<li><button {{action "foo"}}></button></li>',
     '<form {{action "foo" on="submit"}}></form>',
     '<form onsubmit={{action "foo"}}></form>',
+    '<form {{action "foo" on="reset"}}></form>',
+    '<form onreset={{action "foo"}}></form>',
     {
       config: { additionalInteractiveTags: ['div'] },
       template: '<div {{action "foo"}}></div>'
Repository: uber-web/baseui
Pull request #162 (2018-08-29 20:39:38)

feat: extend styled function to use withStyleDeep
<!-- Thanks so much for your PR, your contribution is appreciated! ❤️ -->

#### Patch: Bug Fix?

This allows this behavior to work as expected

```js
import {styled} from 'baseui';

const Base = styled('div', {color: 'red'});
const BaseBlue = styled(Base, {color: 'blue'});
```

#### Tests Added + Pass?

Yes

#### License

MIT

<!-- Describe your changes below in as much detail as possible -->



Patch:
diff --git a/src/styles/styled.js b/src/styles/styled.js
index 1539b2177..55a17de04 100644
--- a/src/styles/styled.js
+++ b/src/styles/styled.js
@@ -42,11 +42,14 @@ const baseStyled = createStyled({wrapper, getInitialStyle, driver});
 // TODO: Need a flow expert to help remove this 'any' type
 // eslint-disable-next-line flowtype/no-weak-types
 export default function styledWrapper(...args: any) {
+  // If user is trying to style a styled component
+  // use withStyleDeep, otherwise use baseStyled
+  const styleFn = typeof args[0] === 'function' ? withStyleDeep : baseStyled;
   // Also allow passing deep style overrides via $style prop
   // Ex: <StyledDiv $style={{color: 'red'}} />
   // Issue for supporting this natively in styletron:
   // https://github.com/rtsao/styletron/issues/221
-  return withStyleDeep(baseStyled(...args), (props: {$style?: ?{}}) => {
+  return withStyleDeep(styleFn(...args), (props: {$style?: ?{}}) => {
     const {$style} = props;
     if (typeof $style === 'function') {
       return $style(props);


Test patch:
diff --git a/src/styles/__tests__/styled.test.js b/src/styles/__tests__/styled.test.js
index 128e243e5..794d0c9c7 100644
--- a/src/styles/__tests__/styled.test.js
+++ b/src/styles/__tests__/styled.test.js
@@ -99,3 +99,31 @@ test('styled override prop', () => {
 
   wrapper.unmount();
 });
+
+test('styled override styled component', () => {
+  const StyledBase = styled('div', {
+    color: 'red',
+  });
+  const StyledBaseOverride = styled(StyledBase, {
+    color: 'blue',
+  });
+  const TestComponent = withStyletronProvider(() => (
+    <div>
+      <StyledBase />
+      <StyledBaseOverride />
+    </div>
+  ));
+
+  const wrapper = mount(<TestComponent />);
+
+  const base = wrapper.find(StyledBase).getDOMNode();
+  expect(base.classList).toHaveLength(1);
+  const redColorClass = base.classList.item(0);
+
+  // BaseOverride should not have red color class
+  const override = wrapper.find(StyledBaseOverride).getDOMNode();
+  expect(override.classList).toHaveLength(1);
+  expect(override.classList).not.toContain(redColorClass);
+
+  wrapper.unmount();
+});
Repository: uber-web/baseui
Pull request #169 (2018-08-31 17:26:48)

Feature/select
#### Minor: Styles for Select component

gergelyke: @nguyensomniac can you take a look?

Patch:
diff --git a/src/select/styled-components.js b/src/select/styled-components.js
index cee8b89c2..a86efbcc6 100644
--- a/src/select/styled-components.js
+++ b/src/select/styled-components.js
@@ -17,11 +17,17 @@ export const Root = styled('div', props => {
 });
 
 export const Input = styled('input', props => {
+  const {$theme} = props;
+  const {
+    sizing: {scale300},
+  } = $theme;
   return {
     ...getInputStyles({...props, $size: SIZE.default}),
     cursor: 'pointer',
     width: 'auto',
     flexGrow: '1',
+    paddingTop: scale300,
+    paddingBottom: scale300,
   };
 });
 
@@ -29,14 +35,16 @@ export const InputContainer = styled('div', props => {
   const {$theme, $isFocused} = props;
   const {
     colors: {mono700},
-    sizing: {scale300, scale1000},
+    sizing: {scale300},
   } = $theme;
   const color = $isFocused ? {} : {borderColor: mono700};
   return {
     ...getInputContainerStyles({...props, $size: SIZE.default}),
-    height: scale1000,
     flexWrap: 'wrap',
-    padding: scale300,
+    paddingLeft: scale300,
+    paddingRight: scale300,
+    paddingTop: '0',
+    paddingBottom: '0',
     alignItems: 'center',
     position: 'relative',
     ...color,


Test patch:
diff --git a/src/select/__tests__/__snapshots__/styled-components.test.js.snap b/src/select/__tests__/__snapshots__/styled-components.test.js.snap
index a3473014a..819398105 100644
--- a/src/select/__tests__/__snapshots__/styled-components.test.js.snap
+++ b/src/select/__tests__/__snapshots__/styled-components.test.js.snap
@@ -130,10 +130,10 @@ Object {
   "lineHeight": "$theme.typography.font300.lineHeight",
   "maxWidth": "100%",
   "outline": "none",
-  "paddingBottom": "$theme.sizing.scale400",
+  "paddingBottom": "$theme.sizing.scale300",
   "paddingLeft": "$theme.sizing.scale500",
   "paddingRight": "$theme.sizing.scale500",
-  "paddingTop": "$theme.sizing.scale400",
+  "paddingTop": "$theme.sizing.scale300",
   "width": "auto",
 }
 `;
@@ -154,9 +154,11 @@ Object {
   "fontFamily": "$theme.typography.font300.fontFamily",
   "fontSize": "$theme.typography.font300.fontSize",
   "fontWeight": "$theme.typography.font300.fontWeight",
-  "height": "$theme.sizing.scale1000",
   "lineHeight": "$theme.typography.font300.lineHeight",
-  "padding": "$theme.sizing.scale300",
+  "paddingBottom": "0",
+  "paddingLeft": "$theme.sizing.scale300",
+  "paddingRight": "$theme.sizing.scale300",
+  "paddingTop": "0",
   "position": "relative",
   "transitionDuration": "$theme.animation.timing100",
   "transitionProperty": "border, boxShadow, backgroundColor",
Repository: uber-web/baseui
Pull request #201 (2018-09-06 16:28:48)

fix: styled should work properly for regular components again
Fixes https://github.com/uber-web/baseui/issues/184


Patch:
diff --git a/src/styles/styled.js b/src/styles/styled.js
index 8c5f61ec6..84d226f3d 100644
--- a/src/styles/styled.js
+++ b/src/styles/styled.js
@@ -27,7 +27,10 @@ const baseStyled = createStyled({wrapper, getInitialStyle, driver});
 export default function styledWrapper(...args: any) {
   // If user is trying to style a styled component
   // use withStyleDeep, otherwise use baseStyled
-  const styleFn = typeof args[0] === 'function' ? withStyleDeep : baseStyled;
+  let styleFn = baseStyled;
+  if (args[0] && args[0].__STYLETRON__) {
+    styleFn = withStyleDeep;
+  }
   // Also allow passing deep style overrides via $style prop
   // Ex: <StyledDiv $style={{color: 'red'}} />
   // Issue for supporting this natively in styletron:


Test patch:
diff --git a/src/styles/__tests__/styled.test.js b/src/styles/__tests__/styled.test.js
index a45e67a3d..be4d2a876 100644
--- a/src/styles/__tests__/styled.test.js
+++ b/src/styles/__tests__/styled.test.js
@@ -90,10 +90,13 @@ test('styled override styled component', () => {
   const StyledBaseOverride = styled(StyledBase, {
     color: 'blue',
   });
+  const BaseComp = props => <div {...props} />;
+  const StyledBaseComp = styled(BaseComp, {color: 'black'});
   const TestComponent = withStyletronProvider(() => (
     <div>
       <StyledBase />
       <StyledBaseOverride />
+      <StyledBaseComp />
     </div>
   ));
 
@@ -108,5 +111,9 @@ test('styled override styled component', () => {
   expect(override.classList).toHaveLength(1);
   expect(override.classList).not.toContain(redColorClass);
 
+  // Making sure this doesn't throw an error
+  const styledBase = wrapper.find(StyledBaseComp).getDOMNode();
+  expect(styledBase.classList).toHaveLength(1);
+
   wrapper.unmount();
 });
Repository: uber-web/baseui
Pull request #564 (2018-11-29 21:14:32)

fix: proper fallback for size prop
Previously, if you passed in a string for $size, Icon would set the height and width to that string, resulting in an invalid CSS property (and causing the icon to not render). This is easy to repro by supplying an icon as a Button enhancer and leaving the size as the default. (Button spreads the $size prop to the Icon eventually)

This didn't get caught before because the examples use
`enhancer={() => <Icon />}` instead of `enhancer={Icon}`, which creates an intermediate component layer between Button and Icon, which "traps" the props and prevents them from being spread all the way down.

gergelyke: thanks for the fix @phou87 !

Patch:
diff --git a/src/icon/examples.js b/src/icon/examples.js
index b33424ed3..0a7c9073d 100644
--- a/src/icon/examples.js
+++ b/src/icon/examples.js
@@ -99,7 +99,7 @@ export default {
             const Icon = Icons[key];
             return (
               <ButtonContainer key={key}>
-                <Button kind={buttonKind} endEnhancer={() => <Icon />}>
+                <Button kind={buttonKind} endEnhancer={Icon}>
                   {Icon.name}
                 </Button>
               </ButtonContainer>
diff --git a/src/icon/styled-components.js b/src/icon/styled-components.js
index 715688e39..d82063ae7 100644
--- a/src/icon/styled-components.js
+++ b/src/icon/styled-components.js
@@ -14,6 +14,8 @@ export function getSvgStyles({$theme, $size, $color}: StyledComponentParamsT) {
       $size = $theme.sizing[$size];
     } else if (typeof $size === 'number') {
       $size = `${$size}px`;
+    } else {
+      $size = $theme.sizing.scale600;
     }
   } else {
     $size = $theme.sizing.scale600;


Test patch:
diff --git a/src/icon/__tests__/styled-components.test.js b/src/icon/__tests__/styled-components.test.js
index 2930b963c..a8d8beaee 100644
--- a/src/icon/__tests__/styled-components.test.js
+++ b/src/icon/__tests__/styled-components.test.js
@@ -28,4 +28,11 @@ describe('Icon styled components', () => {
     expect(styles).toHaveProperty('width', '$theme.sizing.scale400');
     expect(styles).toHaveProperty('height', '$theme.sizing.scale400');
   });
+
+  test('Svg handles default size', () => {
+    const wrapper = shallow(<Svg $size="default" />);
+    const styles = wrapper.instance().getStyles();
+    expect(styles).toHaveProperty('width', '$theme.sizing.scale600');
+    expect(styles).toHaveProperty('height', '$theme.sizing.scale600');
+  });
 });