Repository: ember-template-lint/ember-template-lint (js)

Issue:
Reenabling template rule causes template lint tests to fail
Since today I am getting failing linter tests in my test suite on templates that reenable the `bare-strings` rule.

This is causing failing tests:
```
{{!-- template-lint-disable bare-strings --}}
<i class="material-icons">folder_open</i>
{{!-- template-lint-enable bare-strings --}}
```

Exception:
```my-app/components/foo-bar/template.hbs
  -:-  error  Cannot read property 'indexOf' of undefined  undefined
@ 1 ms
Expected:     
true
Result:     
false
Source:     
    at Object.<anonymous> (http://localhost:7357/assets/tests.js:12058:12)
    at runTest (http://localhost:7357/assets/test-support.js:4199:30)
    at Test.run (http://localhost:7357/assets/test-support.js:4185:6)
    at http://localhost:7357/assets/test-support.js:4406:12
    at advanceTaskQueue (http://localhost:7357/assets/test-support.js:3798:6)
    at advance (http://localhost:7357/assets/test-support.js:3779:4)
```

This works:
```
{{!-- template-lint-disable bare-strings --}}
<i class="material-icons">folder_open</i>
```

Pull request:
Ensure deprecated rule names are properly migrated.
Prior to this change, deprecated rules specified in user specified config would not be included in the final config.

Fixes #417

Patch:
diff --git a/docs/rule/no-attrs-in-components.md b/docs/rule/no-attrs-in-components.md
deleted file mode 100644
index f598738b..00000000
--- a/docs/rule/no-attrs-in-components.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## no-attrs-in-components
-
-This rule prevents the usage of `attrs` property to access values passed to the component since all the values can be accessed directly from the from the template.
-
-For example, doing
-
-```components/templates/layout.hbs
-{{attr.foo}}
-```
-is bad. The correct way would be to directly consume `foo` in the template like,
-
-```components/templates/layout.hbs
-{{foo}}
-```
-
-or if you using Ember 3.1 and above,
-
-```components/templates/layout.hbs
-{{@foo}}
-```
-
-
-The following values are valid configuration:
-
-  * boolean -- `true` for enabled / `false` for disabled
diff --git a/lib/get-config.js b/lib/get-config.js
index ff631dd3..2f560f61 100644
--- a/lib/get-config.js
+++ b/lib/get-config.js
@@ -284,7 +284,7 @@ function validateRules(config, options) {
       const deprecation = DEPRECATED_RULES.get(key);
       if (deprecation) {
         deprecatedNamesFound.push({ oldName: key, newName: deprecation });
-        config.rules[deprecation.newName] = config.rules[key];
+        config.rules[deprecation] = config.rules[key];
         delete config.rules[key];
       } else {
         invalidKeysFound.push(key);
diff --git a/lib/rules/index.js b/lib/rules/index.js
index c45a6daa..37759299 100644
--- a/lib/rules/index.js
+++ b/lib/rules/index.js
@@ -36,5 +36,4 @@ module.exports = {
   'no-unnecessary-concat': require('./lint-no-unnecessary-concat'),
   'no-partial': require('./lint-no-partial'),
   'invocable-blacklist': require('./lint-invocable-blacklist'),
-  'no-attr-in-components': require('./lint-no-attr-in-components'),
 };
diff --git a/lib/rules/lint-no-attr-in-components.js b/lib/rules/lint-no-attr-in-components.js
deleted file mode 100644
index 0f98fdb4..00000000
--- a/lib/rules/lint-no-attr-in-components.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-
-const Rule = require('./base');
-const componentTemplateRegex = new RegExp('templates/components|components/.*/template|ui/components|-components/');
-
-module.exports = class LinkNoAttrComponent extends Rule {
-  isComponentTemplate() {
-    return componentTemplateRegex.test(this.templateEnvironmentData.moduleName);
-  }
-  visitor() {
-    return {
-      PathExpression(node) {
-        if (!this.isComponentTemplate()) {
-          return;
-        }
-        if (node.parts && node.parts[0] === 'attrs') {
-          this.log({
-            message: 'Component templates should not contain `attrs`.',
-            line: node.loc && node.loc.start.line,
-            column: node.loc && node.loc.start.column,
-            source: this.sourceForNode(node)
-          });
-        }
-      }
-    };
-  }
-};


Test patch:
diff --git a/test/acceptance-test.js b/test/acceptance-test.js
index 4826d574..955a3df4 100644
--- a/test/acceptance-test.js
+++ b/test/acceptance-test.js
@@ -69,6 +69,18 @@ describe('public api', function() {
 
       expect(linter.config.rules).to.deep.equal(expected.rules);
     });
+
+    it('with deprecated rule config', function() {
+      let basePath = path.join(fixturePath, 'deprecated-rule-config');
+      let expected = require(path.join(basePath, '.template-lintrc'));
+
+      let linter = new Linter({
+        console: mockConsole,
+        config: expected
+      });
+
+      expect(linter.config.rules).to.deep.equal({ 'no-bare-strings': true });
+    });
   });
 
   describe('Linter.prototype.constructor', function() {
diff --git a/test/fixtures/deprecated-rule-config/.template-lintrc.js b/test/fixtures/deprecated-rule-config/.template-lintrc.js
new file mode 100644
index 00000000..15b200d9
--- /dev/null
+++ b/test/fixtures/deprecated-rule-config/.template-lintrc.js
@@ -0,0 +1,5 @@
+module.exports = {
+  rules: {
+    'bare-strings': true,
+  }
+}
diff --git a/test/unit/rules/lint-no-attr-in-components-test.js b/test/unit/rules/lint-no-attr-in-components-test.js
deleted file mode 100644
index 456b03a2..00000000
--- a/test/unit/rules/lint-no-attr-in-components-test.js
+++ /dev/null
@@ -1,129 +0,0 @@
-'use strict';
-
-const generateRuleTests = require('../../helpers/rule-test-harness');
-
-generateRuleTests({
-  name: 'no-attr-in-components',
-
-  config: 'true',
-  good: [
-    '<div></div>',
-    '{{foo}}',
-    '<div>{{foo.bar}}</div>',
-    '{{attrs.foo}}', // defaults to layout.hbs
-  ],
-  bad: [
-    {
-      template: '{{attrs.foo}}',
-
-      meta: {
-        moduleId: 'templates/components/layout.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'templates/components/layout.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 2,
-      }
-    },
-    {
-      template: '<div class={{attrs.foo}}></div>',
-
-      meta: {
-        moduleId: 'templates/components/layout.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'templates/components/layout.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 13,
-      }
-    },
-    {
-      template: '{{#if attrs.foo}}bar{{/if}}',
-
-      meta: {
-        moduleId: 'templates/components/layout.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'templates/components/layout.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 6,
-      }
-    },
-    {
-      template: '{{bar foo=attrs.foo}}',
-
-      meta: {
-        moduleId: 'templates/components/layout.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'templates/components/layout.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 10,
-      }
-    },
-    {
-      template: '{{component attrs.foo}}',
-
-      meta: {
-        moduleId: 'templates/components/layout.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'templates/components/layout.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 12,
-      }
-    },
-    {
-      template: '{{bar/baz (hash foo=attrs.foo)}}',
-
-      meta: {
-        moduleId: 'templates/components/layout.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'templates/components/layout.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 20,
-      }
-    },
-    {
-      template: '{{attrs.foo}}',
-
-      meta: {
-        moduleId: 'components/comment/template.hbs',
-      },
-
-      result: {
-        rule: 'no-attr-in-components',
-        message: 'Component templates should not contain `attrs`.',
-        moduleId: 'components/comment/template.hbs',
-        source: 'attrs.foo',
-        line: 1,
-        column: 2,
-      }
-    }
-  ]
-});
diff --git a/test/unit/rules/lint-no-bare-strings-test.js b/test/unit/rules/lint-no-bare-strings-test.js
index 5d1ee32e..de507083 100644
--- a/test/unit/rules/lint-no-bare-strings-test.js
+++ b/test/unit/rules/lint-no-bare-strings-test.js
@@ -73,7 +73,14 @@ generateRuleTests({
       // combine bare string with a variable
       config: ['X'],
       template: '<input placeholder="{{foo}}X">'
-    }
+    },
+
+    '{{! template-lint-disable bare-strings}}LOL{{! template-lint-enable bare-strings}}',
+
+    `{{!-- template-lint-disable bare-strings --}}
+<i class="material-icons">folder_open</i>
+{{!-- template-lint-enable bare-strings --}}`,
+    '<div data-test-foo-bar></div>',
   ],
 
   bad: [