Repository: ember-codemods/ember-angle-brackets-codemod (js)

Issue:
Simple block `link-to` not converted
```
{{#link-to 'data-access'}}Accessing the Crates.io Data{{/link-to}}.
```

I don't know why, but the snippet above was not converted to Angle Brackets for some reason 🤔 

source: https://github.com/rust-lang/crates.io

Pull request description:
Fix false negatives for `link-to` with `data-` prefixed route name
The original logic would consider any parameter a data attribute if the `original` had the substring `data-` .  This fix further reduces the ambiguity of the  parameter by enforcing that it also can't be a `StringLiteral` and that it must be a `PathExpression`

This fixes #212 

Patch:
diff --git a/transforms/angle-brackets/transform.js b/transforms/angle-brackets/transform.js
index 988e3c1..c4a2ade 100755
--- a/transforms/angle-brackets/transform.js
+++ b/transforms/angle-brackets/transform.js
@@ -262,12 +262,16 @@ function transformNodeAttributes(tagName, node) {
   return node.params.concat(attributes);
 }
 
+function isDataAttrPathExpression(node) {
+  return node.type === 'PathExpression' && node.original.startsWith('data-');
+}
+
 function getDataAttributesFromParams(params) {
-  return params.filter(param => param.original && `${param.original}`.startsWith('data-'));
+  return params.filter(it => isDataAttrPathExpression(it));
 }
 
 function getNonDataAttributesFromParams(params) {
-  return params.filter(p => !(p.original && `${p.original}`.startsWith('data-')));
+  return params.filter(it => !isDataAttrPathExpression(it));
 }
 
 function shouldIgnoreMustacheStatement(fullName, config, invokableData) {


Test patch:
diff --git a/transforms/angle-brackets/transform.test.js b/transforms/angle-brackets/transform.test.js
index 534f52d..b4607a8 100644
--- a/transforms/angle-brackets/transform.test.js
+++ b/transforms/angle-brackets/transform.test.js
@@ -376,6 +376,7 @@ test('let', () => {
 test('link-to', () => {
   let input = `
     {{#link-to "about"}}About Us{{/link-to}}
+    {{#link-to "data-access"}}Accessing the Crates.io Data{{/link-to}}
     {{#link-to this.dynamicRoute}}About Us{{/link-to}}
     {{#link-to "user" this.first this.second}}Show{{/link-to}}
     {{#link-to "user" this.first this.second (query-params foo="baz")}}Show{{/link-to}}
@@ -386,6 +387,7 @@ test('link-to', () => {
   expect(runTest('link-to.hbs', input)).toMatchInlineSnapshot(`
     "
         <LinkTo @route=\\"about\\">About Us</LinkTo>
+        <LinkTo @route=\\"data-access\\">Accessing the Crates.io Data</LinkTo>
         <LinkTo @route={{this.dynamicRoute}}>About Us</LinkTo>
         <LinkTo @route=\\"user\\" @models={{array this.first this.second}}>Show</LinkTo>
         <LinkTo @route=\\"user\\" @models={{array this.first this.second}} @query={{hash foo=\\"baz\\"}}>Show</LinkTo>