nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: ember-template-lint/ember-template-lint
Pull request #412 (2018-05-22 00:01:37)

add aria-* properties to bare-strings rule
This commit adds aria-label [1], aria-placeholder [2],
aria-roledescription [3], and aria-valuetext [4] to the
GLOBAL_ATTRIBUTES array in the bare-strings rule.

These are 4 of the 5 aria properties that take free-form strings
(aria-keyshortcuts is the other and it's not clear to me that would
be translated)

[1]: https://www.w3.org/TR/wai-aria-1.1/#aria-label
[2]: https://www.w3.org/TR/wai-aria-1.1/#aria-placeholder
[3]: https://www.w3.org/TR/wai-aria-1.1/#aria-roledescription
[3]: https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext


Patch:
diff --git a/lib/rules/lint-bare-strings.js b/lib/rules/lint-bare-strings.js
index 6e90653d..c89abc20 100644
--- a/lib/rules/lint-bare-strings.js
+++ b/lib/rules/lint-bare-strings.js
@@ -26,7 +26,11 @@ const Rule = require('./base');
 const createErrorMessage = require('../helpers/create-error-message');
 
 const GLOBAL_ATTRIBUTES = [
-  'title'
+  'title',
+  'aria-label',
+  'aria-placeholder',
+  'aria-roledescription',
+  'aria-valuetext'
 ];
 
 const TAG_ATTRIBUTES = {


Test patch:
diff --git a/test/unit/rules/lint-bare-strings-test.js b/test/unit/rules/lint-bare-strings-test.js
index 746c5a34..6247b428 100644
--- a/test/unit/rules/lint-bare-strings-test.js
+++ b/test/unit/rules/lint-bare-strings-test.js
@@ -136,6 +136,54 @@ generateRuleTests({
       }
     },
 
+    {
+      template: '<div role="contentinfo" aria-label="Contact, Policies and Legal"></div>',
+
+      result: {
+        moduleId: 'layout.hbs',
+        message: 'Non-translated string used in `aria-label` attribute',
+        line: 1,
+        column: 24,
+        source: 'Contact, Policies and Legal'
+      }
+    },
+
+    {
+      template: '<div contenteditable role="searchbox" aria-placeholder="Search for things"></div>',
+
+      result: {
+        moduleId: 'layout.hbs',
+        message: 'Non-translated string used in `aria-placeholder` attribute',
+        line: 1,
+        column: 38,
+        source: 'Search for things'
+      }
+    },
+
+    {
+      template: '<div role="region" aria-roledescription="slide"></div>',
+
+      result: {
+        moduleId: 'layout.hbs',
+        message: 'Non-translated string used in `aria-roledescription` attribute',
+        line: 1,
+        column: 19,
+        source: 'slide'
+      }
+    },
+
+    {
+      template: '<div role="slider" aria-valuetext="Off" tabindex="0" aria-valuemin="0" aria-valuenow="0" aria-valuemax="3"></div>',
+
+      result: {
+        moduleId: 'layout.hbs',
+        message: 'Non-translated string used in `aria-valuetext` attribute',
+        line: 1,
+        column: 19,
+        source: 'Off'
+      }
+    },
+
     {
       config: { globalAttributes: ['data-foo'] },
       template: '<div data-foo="derpy"></div>',
Repository: ember-template-lint/ember-template-lint
Pull request #422 (2018-06-07 14:25:56)

Allow angle bracket components to have actions


Patch:
diff --git a/lib/helpers/is-angle-bracket-component.js b/lib/helpers/is-angle-bracket-component.js
new file mode 100644
index 00000000..2cb42072
--- /dev/null
+++ b/lib/helpers/is-angle-bracket-component.js
@@ -0,0 +1,19 @@
+'use strict';
+
+function isDynamicComponent(element) {
+  let open = element.tag.charAt(0);
+
+  let maybeLocal = element.tag.split('.').length > 1;
+  let isNamedArgument = open === '@';
+  let isThisPath = element.tag.indexOf('this.') === 0;
+  return maybeLocal || isNamedArgument || isThisPath;
+}
+
+module.exports = function isAngleBracketComponent(element) {
+  let open = element.tag.charAt(0);
+  let isPath = element.tag.indexOf('.') > -1;
+
+  let isUpperCase = open === open.toUpperCase() && open !== open.toLowerCase();
+
+  return (isUpperCase && !isPath) || isDynamicComponent(element);
+};
diff --git a/lib/rules/lint-no-invalid-interactive.js b/lib/rules/lint-no-invalid-interactive.js
index c938dfd3..24e615e4 100644
--- a/lib/rules/lint-no-invalid-interactive.js
+++ b/lib/rules/lint-no-invalid-interactive.js
@@ -2,6 +2,7 @@
 
 const Rule = require('./base');
 const isInteractiveElement = require('../helpers/is-interactive-element');
+const isAngleBracketComponent = require('../helpers/is-angle-bracket-component');
 const parseConfig = require('../helpers/parse-interactive-element-config');
 
 module.exports = class InvalidInteractive extends Rule {
@@ -24,7 +25,7 @@ module.exports = class InvalidInteractive extends Rule {
 
     let visitor = {
       enter(node) {
-        let isInteractive = isInteractiveElement(node) || this.isCustomInteractiveElement(node);
+        let isInteractive = isInteractiveElement(node) || this.isCustomInteractiveElement(node) || isAngleBracketComponent(node);
         this._element = !isInteractive ? node : null;
       },
 


Test patch:
diff --git a/test/unit/rules/lint-no-invalid-interactive-test.js b/test/unit/rules/lint-no-invalid-interactive-test.js
index e2a2f9fc..c80e0fb8 100644
--- a/test/unit/rules/lint-no-invalid-interactive-test.js
+++ b/test/unit/rules/lint-no-invalid-interactive-test.js
@@ -15,6 +15,9 @@ generateRuleTests({
     '<form onsubmit={{action "foo"}}></form>',
     '<form {{action "foo" on="reset"}}></form>',
     '<form onreset={{action "foo"}}></form>',
+    '<InputSearch @onInput={{action "foo"}} />',
+    '<InputSearch @onInput={{action "foo"}}></InputSearch>',
+    '<foo.bar @onInput={{action "foo"}}></foo.bar>',
     {
       config: { additionalInteractiveTags: ['div'] },
       template: '<div {{action "foo"}}></div>'
Repository: ember-template-lint/ember-template-lint
Pull request #452 (2018-07-12 01:00:07)

Add failing test for no-unused-block-params regression
Failing test for #451. 

cc/ @mmun @rwjblue 


Patch:
diff --git a/lib/rules/lint-no-unused-block-params.js b/lib/rules/lint-no-unused-block-params.js
index 06c62f0b..d665a439 100644
--- a/lib/rules/lint-no-unused-block-params.js
+++ b/lib/rules/lint-no-unused-block-params.js
@@ -61,19 +61,23 @@ module.exports = class UnusedBlockParams extends Rule {
       },
 
       ElementNode: {
-        enter(node) {
-          this.scope.useLocal(node);
-        },
-
-        exit(node) {
-          let unusedLocal = this.scope.frameHasUnusedBlockParams();
-          if (unusedLocal) {
-            this.log({
-              message: `'${unusedLocal}' is defined but never used`,
-              line: node.loc && node.loc.start.line,
-              column: node.loc && node.loc.start.column,
-              source: this.sourceForNode(node)
-            });
+        keys: {
+          children: {
+            enter(node) {
+              this.scope.useLocal(node);
+            },
+
+            exit(node) {
+              let unusedLocal = this.scope.frameHasUnusedBlockParams();
+              if (unusedLocal) {
+                this.log({
+                  message: `'${unusedLocal}' is defined but never used`,
+                  line: node.loc && node.loc.start.line,
+                  column: node.loc && node.loc.start.column,
+                  source: this.sourceForNode(node)
+                });
+              }
+            }
           }
         }
       },


Test patch:
diff --git a/test/unit/rules/lint-no-unused-block-params-test.js b/test/unit/rules/lint-no-unused-block-params-test.js
index b80b8e75..001c698b 100644
--- a/test/unit/rules/lint-no-unused-block-params-test.js
+++ b/test/unit/rules/lint-no-unused-block-params-test.js
@@ -22,6 +22,8 @@ generateRuleTests({
     '{{#each cats as |cat|}}{{#meow-meow cat as |cat|}}{{cat}}{{/meow-meow}}{{/each}}',
     '{{! template-lint-disable unused-block-params}}{{#each cats as |cat|}}Dogs{{/each}}',
     '{{#with (component "foo-bar") as |FooBar|}}<FooBar />{{/with}}',
+    '<BurgerMenu as |menu|><header>Something</header><menu.item>Text</menu.item></BurgerMenu>',
+    '{{#burger-menu as |menu|}}<header>Something</header>{{#menu.item}}Text{{/menu.item}}{{/burger-menu}}',
   ],
 
   bad: [
Repository: ember-template-lint/ember-template-lint
Pull request #492 (2018-09-07 02:44:16)

Ensure invalid (cannot parse) configs throw a useful error.
Prior to this when a config had some syntax error, we would silently fallback to using no configuration.

Fixes https://github.com/ember-template-lint/ember-template-lint/issues/489


Patch:
diff --git a/lib/get-config.js b/lib/get-config.js
index 2f560f61..374cee33 100644
--- a/lib/get-config.js
+++ b/lib/get-config.js
@@ -22,13 +22,16 @@ function resolveConfigPath(configPath, pluginPath) {
 
   }
 
+  let filePath = pluginPath || configPath;
   try {
-    let filePath = pluginPath || configPath;
     return require(filePath);
   } catch(e) {
-    return {};
-  }
+    if (e.code === 'MODULE_NOT_FOUND') {
+      return {};
+    }
 
+    throw e;
+  }
 }
 
 function forEachPluginConfiguration(plugins, callback) {


Test patch:
diff --git a/test/acceptance-test.js b/test/acceptance-test.js
index 9ebf6638..43833bad 100644
--- a/test/acceptance-test.js
+++ b/test/acceptance-test.js
@@ -30,6 +30,17 @@ describe('public api', function() {
   });
 
   describe('Linter.prototype.loadConfig', function() {
+    it('throws an error if the config file has an error on parsing', function() {
+      let basePath = path.join(fixturePath, 'config-with-parse-error');
+      process.chdir(basePath);
+
+      expect(() => {
+        new Linter({
+          console: mockConsole,
+        });
+      }).to.throw(/error happening during config loading/);
+    });
+
     it('uses provided config', function() {
       let basePath = path.join(fixturePath, 'config-in-root');
       let expected = require(path.join(basePath, '.template-lintrc'));
diff --git a/test/fixtures/config-with-parse-error/.template-lintrc.js b/test/fixtures/config-with-parse-error/.template-lintrc.js
new file mode 100644
index 00000000..ec2e2a49
--- /dev/null
+++ b/test/fixtures/config-with-parse-error/.template-lintrc.js
@@ -0,0 +1,1 @@
+throw Error('error happening during config loading');
Repository: ember-template-lint/ember-template-lint
Pull request #503 (2018-09-11 00:35:37)

Fix attribute-indentation for indented blocks
Regression occurs in 4d6ed0e


Patch:
diff --git a/lib/rules/lint-attribute-indentation.js b/lib/rules/lint-attribute-indentation.js
index f438634e..21bd674a 100644
--- a/lib/rules/lint-attribute-indentation.js
+++ b/lib/rules/lint-attribute-indentation.js
@@ -56,7 +56,7 @@ module.exports = class AttributeSpacing extends Rule {
     // of the block param. All the examples are given with the "}}" at the end
     // of the block param (e.g.: as |employee|}}). This assumption is incorrect so we need
     // to verify if the "}}" are on a new line and adjust the program start location accordingly
-    const actualProgramStartLine = this.source[node.program.loc.start.line - 1].startsWith('}}') ? 1 : 0;
+    const actualProgramStartLine = /^\s*\}\}/.test(this.source[node.program.loc.start.line - 1]) ? 1 : 0;
     const programStartLoc = {
       line: node.program.loc.start.line - actualProgramStartLine,
       column: node.program.loc.start.column,


Test patch:
diff --git a/test/unit/rules/lint-attribute-indentation-test.js b/test/unit/rules/lint-attribute-indentation-test.js
index 5b08c76d..1f0e70f1 100644
--- a/test/unit/rules/lint-attribute-indentation-test.js
+++ b/test/unit/rules/lint-attribute-indentation-test.js
@@ -482,6 +482,14 @@ generateRuleTests({
     '}}' + '\n' +
     '  {{foo}}' + '\n' +
     '{{/t.body}}',
+    //with indented block params
+    '  {{#t.body' + '\n' +
+    '    canExpand=(helper help)' + '\n' +
+    '    multiRowExpansion=false' + '\n' +
+    '  as |body|' + '\n' +
+    '  }}' + '\n' +
+    '    {{foo}}' + '\n' +
+    '  {{/t.body}}',
 
     //Block form with open-invocation more than 80 characters
     {
Repository: ember-template-lint/ember-template-lint
Pull request #559 (2018-11-05 14:45:15)

Added video and audio with control attribute as interactive elements
Fix for #558 


Patch:
diff --git a/lib/helpers/is-interactive-element.js b/lib/helpers/is-interactive-element.js
index 4f78bb3a..dcf6dd4e 100644
--- a/lib/helpers/is-interactive-element.js
+++ b/lib/helpers/is-interactive-element.js
@@ -34,6 +34,10 @@ const ARIA_WIDGET_ROLES = [
   'treeitem',
 ];
 
+function isAudioVideoWithControls(node) {
+  return (node.tag === 'audio' || node.tag === 'video') && ast.hasAttribute(node, 'controls');
+}
+
 function isHyperLink(node) {
   return node.tag === 'a' && ast.hasAttribute(node, 'href');
 }
@@ -68,6 +72,10 @@ function getInteractiveAriaRole(node) {
  there is a need to use it nested with `<object>` and `<a>`
  */
 function reason(node) {
+  if (isAudioVideoWithControls(node)) {
+    return `an <${node.tag}> element with the \`controls\` attribute`;
+  }
+
   if (!ast.isElementNode(node) && !ast.isComponentNode(node)) {
     return null;
   }


Test patch:
diff --git a/test/unit/helpers/is-interactive-element-test.js b/test/unit/helpers/is-interactive-element-test.js
index 85e0599f..a4ab9f87 100644
--- a/test/unit/helpers/is-interactive-element-test.js
+++ b/test/unit/helpers/is-interactive-element-test.js
@@ -42,6 +42,8 @@ describe('isInteractiveElement', function() {
     '<label></label>': '<label>',
     '<div role="button"></div>': 'an element with `role="button"`',
     '<div role="textbox"></div>': 'an element with `role="textbox"`',
+    '<video controls></video>': 'an <video> element with the `controls` attribute',
+    '<audio controls></audio>': 'an <audio> element with the `controls` attribute',
   };
 
   nonInteractive.forEach(function(template) {
Repository: ember-template-lint/ember-template-lint
Pull request #600 (2019-01-08 20:12:53)

Add {{welcome-page}} to default allowed list for no-implicit-this.
This will fix issues seen during testing of enabling `no-implicit-this` by default.

Specifically this scenario:

```
ember new foo
cd foo
ember test
```

Prior to this change would flag `{{welcome-page}}` in the default blueprint.


Patch:
diff --git a/lib/rules/lint-no-implicit-this.js b/lib/rules/lint-no-implicit-this.js
index 823fd368..5dc38319 100644
--- a/lib/rules/lint-no-implicit-this.js
+++ b/lib/rules/lint-no-implicit-this.js
@@ -27,6 +27,11 @@ const ARGLESS_BUILTINS = [
   'yield',
 ];
 
+// arg'less Components / Helpers in default ember-cli blueprint
+const ARGLESS_DEFAULT_BLUEPRINT = [
+  'welcome-page',
+];
+
 module.exports = class StrictPaths extends Rule {
   parseConfig(config) {
     if (config === false || config === undefined) {
@@ -40,7 +45,10 @@ module.exports = class StrictPaths extends Rule {
     case 'boolean':
       if (config) {
         return {
-          allow: ARGLESS_BUILTINS
+          allow: [].concat(
+            ARGLESS_BUILTINS,
+            ARGLESS_DEFAULT_BLUEPRINT
+          )
         };
       } else {
         return false;
@@ -49,7 +57,11 @@ module.exports = class StrictPaths extends Rule {
     case 'object':
       if (Array.isArray(config.allow) && config.allow.every(isString)) {
         return {
-          allow: ARGLESS_BUILTINS.concat(config.allow)
+          allow: [].concat(
+            ARGLESS_BUILTINS,
+            ARGLESS_DEFAULT_BLUEPRINT,
+            config.allow
+          )
         };
       }
       break;


Test patch:
diff --git a/test/unit/rules/lint-no-implicit-this-test.js b/test/unit/rules/lint-no-implicit-this-test.js
index 9ff5e3a0..efd98670 100644
--- a/test/unit/rules/lint-no-implicit-this-test.js
+++ b/test/unit/rules/lint-no-implicit-this-test.js
@@ -21,6 +21,7 @@ let good = [
   '{{outlet}}',
   '{{textarea}}',
   '{{yield}}',
+  '{{welcome-page}}',
   {
     config: { allow: ['book-details'] },
     template: '{{book-details}}'
Repository: ember-template-lint/ember-template-lint
Pull request #728 (2019-05-29 14:40:31)

Allow role="presentation" to opt out of alt requirement for object.


Patch:
diff --git a/lib/rules/lint-require-valid-alt-text.js b/lib/rules/lint-require-valid-alt-text.js
index 3cb6a303..ce769b92 100644
--- a/lib/rules/lint-require-valid-alt-text.js
+++ b/lib/rules/lint-require-valid-alt-text.js
@@ -73,13 +73,18 @@ module.exports = class A11yLintAltText extends Rule {
             });
           }
         } else if (isObj) {
+          const roleValue = AstNodeInfo.elementAttributeValue(node, 'role');
           const hasValidAttributes = AstNodeInfo.hasAnyAttribute(node, [
             'aria-label',
             'aria-labelledby',
             'title',
           ]);
 
-          if (hasValidAttributes || hasAccessibleChild(node)) {
+          if (
+            hasValidAttributes ||
+            hasAccessibleChild(node) ||
+            ['presentation', 'none'].includes(roleValue)
+          ) {
             return;
           }
 


Test patch:
diff --git a/test/unit/rules/lint-require-valid-alt-text-test.js b/test/unit/rules/lint-require-valid-alt-text-test.js
index 7b9de775..d1932f4a 100644
--- a/test/unit/rules/lint-require-valid-alt-text-test.js
+++ b/test/unit/rules/lint-require-valid-alt-text-test.js
@@ -24,6 +24,8 @@ generateRuleTests({
     '<input type="image" aria-hidden="true">',
 
     '<object title="some-alt"></object>',
+    '<object role="presentation"></object>',
+    '<object role="none"></object>',
     '<object hidden></object>',
     '<object aria-hidden="true"></object>',
     '<object aria-labelledby="some-alt"></object>',
Repository: sunng87/handlebars-rust
Pull request #313 (2020-01-24 22:35:17)

[#312]: Re-enable usage of template names from walk dir
This change re-enables the ability to use the template names generated by the "walk dirs" feature of handlebars-rust. It generates template names like `foo/bar/baz`, which couldn't be used in 3.0.0, as the character `/` was not allowed in the name of the referenced template.


Patch:
diff --git a/src/grammar.pest b/src/grammar.pest
index 35e5a32..6287d83 100644
--- a/src/grammar.pest
+++ b/src/grammar.pest
@@ -22,9 +22,11 @@ object_literal = { "{" ~ (string_literal ~ ":" ~ literal)?
                    ~ ("," ~ string_literal ~ ":" ~ literal)* ~ "}" }
 
 symbol_char = _{'a'..'z'|'A'..'Z'|ASCII_DIGIT|"-"|"_"|'\u{80}'..'\u{7ff}'|'\u{800}'..'\u{ffff}'|'\u{10000}'..'\u{10ffff}'}
+partial_symbol_char = _{'a'..'z'|'A'..'Z'|ASCII_DIGIT|"-"|"_"|'\u{80}'..'\u{7ff}'|'\u{800}'..'\u{ffff}'|'\u{10000}'..'\u{10ffff}'|"/"}
 path_char = _{ "/" }
 
 identifier = @{ symbol_char+ }
+partial_identifier = @{ partial_symbol_char+ }
 reference = ${ path_inline }
 
 name = _{ subexpression | reference }
@@ -33,7 +35,7 @@ param = { !(keywords ~ !symbol_char) ~ (literal | reference | subexpression) }
 hash = { identifier ~ "=" ~ param }
 block_param = { "as" ~ "|" ~ identifier ~ identifier? ~ "|"}
 exp_line = _{ identifier ~ (hash|param)* ~ block_param?}
-partial_exp_line = _{ (identifier ~ (hash|param)+) | name }
+partial_exp_line = _{ (partial_identifier ~ (hash|param)+) | name }
 
 subexpression = { "(" ~ ((identifier ~ (hash|param)+) | reference)  ~ ")" }
 
diff --git a/src/template.rs b/src/template.rs
index 653f9e7..b8f63a5 100644
--- a/src/template.rs
+++ b/src/template.rs
@@ -214,7 +214,7 @@ impl Template {
         let rule = name_node.as_rule();
         let name_span = name_node.as_span();
         match rule {
-            Rule::identifier | Rule::invert_tag_item => {
+            Rule::identifier | Rule::partial_identifier | Rule::invert_tag_item => {
                 Ok(Parameter::Name(name_span.as_str().to_owned()))
             }
             Rule::reference => {


Test patch:
diff --git a/tests/template_names.rs b/tests/template_names.rs
new file mode 100644
index 0000000..d8a0826
--- /dev/null
+++ b/tests/template_names.rs
@@ -0,0 +1,39 @@
+extern crate handlebars;
+#[macro_use]
+extern crate serde_json;
+
+use handlebars::Handlebars;
+
+#[test]
+fn test_walk_dir_template_name()  {
+    let mut hbs = Handlebars::new();
+
+    let data = json!({
+        "a": [1, 2, 3, 4],
+        "b": "top"
+    });
+
+    hbs.register_template_string("foo/bar", "{{@root/b}}").unwrap();
+    assert_eq!(
+        hbs.render_template("{{> foo/bar }}", &data)
+            .unwrap(),
+        "top"
+    );
+}
+
+#[test]
+fn test_walk_dir_template_name_with_args()  {
+    let mut hbs = Handlebars::new();
+
+    let data = json!({
+        "a": [1, 2, 3, 4],
+        "b": "top"
+    });
+
+    hbs.register_template_string("foo/bar", "{{this}}").unwrap();
+    assert_eq!(
+        hbs.render_template("{{> foo/bar b }}", &data)
+            .unwrap(),
+        "top"
+    );
+}