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

Issue:
Deprecate 'img-alt-attributes' rule
Deprecate 'img-alt-attributes' rule since it's been replaced by a more complete/universal rule, 'require-valid-alt-text'.

Pull request:
Remove deprecated rule `img-alt-attributes` (replaced by `require-valid-alt-text`)
BREAKING CHANGE: cleanup ahead of v2 release.

Follow-up to #759. Fixes #739.

CC: @MelSumner

Patch:
diff --git a/docs/rule/img-alt-attributes.md b/docs/rule/img-alt-attributes.md
deleted file mode 100644
index 9f317379..00000000
--- a/docs/rule/img-alt-attributes.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## img-alt-attributes
-
-**NOTE**: This rule is deprecated in favor of the more comprehensive rule [require-valid-alt-text](./require-valid-alt-text.md).
-
-An `<img>` without an `alt` attribute is essentially invisible to assistive/accessibility technology (i.e. screen readers).
-In order to ensure that screen readers can provide useful information, we need to ensure that all `<img>` elements
-have an `alt` attribute specified.
-
-This rule **forbids** the following:
-
-```hbs
-<img src="rwjblue.png">
-```
-
-This rule **allows** the following:
-
-```hbs
-<img src="rwjblue.png" alt="picture of Robert Jackson">
-```
-
-### References
-
-* See [WCAG Suggestion H37](https://www.w3.org/TR/WCAG20-TECHS/H37.html)
diff --git a/docs/rules.md b/docs/rules.md
index 480c55a7..c28c52ec 100644
--- a/docs/rules.md
+++ b/docs/rules.md
@@ -3,7 +3,6 @@
 * [attribute-indentation](rule/attribute-indentation.md)
 * [block-indentation](rule/block-indentation.md)
 * [eol-last](rule/eol-last.md)
-* [img-alt-attributes](rule/img-alt-attributes.md)
 * [inline-link-to](rule/inline-link-to.md)
 * [invocable-blacklist](rule/invocable-blacklist.md)
 * [linebreak-style](rule/linebreak-style.md)
diff --git a/lib/config/0-8-recommended.js b/lib/config/0-8-recommended.js
index 1699cc73..ee2d77e8 100644
--- a/lib/config/0-8-recommended.js
+++ b/lib/config/0-8-recommended.js
@@ -11,7 +11,6 @@ module.exports = {
     'no-triple-curlies': true,
     'link-rel-noopener': true,
     'no-invalid-interactive': true,
-    'img-alt-attributes': true,
     'style-concatenation': true,
     'deprecated-inline-view-helper': true,
     'deprecated-render-helper': true,
diff --git a/lib/config/1-x-recommended.js b/lib/config/1-x-recommended.js
index f3fb7628..6d8118e3 100644
--- a/lib/config/1-x-recommended.js
+++ b/lib/config/1-x-recommended.js
@@ -4,7 +4,6 @@ module.exports = {
   rules: {
     'block-indentation': true,
     'deprecated-render-helper': true,
-    'img-alt-attributes': true,
     'linebreak-style': true,
     'link-rel-noopener': true,
     'no-attrs-in-components': true,
diff --git a/lib/rules/index.js b/lib/rules/index.js
index 888ab646..b380cfad 100644
--- a/lib/rules/index.js
+++ b/lib/rules/index.js
@@ -7,7 +7,6 @@ module.exports = {
   'deprecated-inline-view-helper': require('./deprecations/lint-deprecated-inline-view-helper'),
   'deprecated-render-helper': require('./deprecations/lint-deprecated-render-helper'),
   'eol-last': require('./lint-eol-last'),
-  'img-alt-attributes': require('./lint-img-alt-attributes'),
   'inline-link-to': require('./lint-inline-link-to'),
   'invocable-blacklist': require('./lint-invocable-blacklist'),
   'linebreak-style': require('./lint-linebreak-style'),
diff --git a/lib/rules/lint-img-alt-attributes.js b/lib/rules/lint-img-alt-attributes.js
deleted file mode 100644
index 66c58bb5..00000000
--- a/lib/rules/lint-img-alt-attributes.js
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict';
-
-const AstNodeInfo = require('../helpers/ast-node-info');
-const Rule = require('./base');
-
-/**
- Disallow usage of `<img>` without an `alt` attribute.
-
- Good:
-
- ```
- <img alt="some stuff">
- ```
-
- Bad:
-
- ```
- <img>
- ```
-*/
-module.exports = class ImgAltAttributes extends Rule {
-  visitor() {
-    return {
-      ElementNode(node) {
-        let isImg = AstNodeInfo.isImgElement(node);
-        if (!isImg) {
-          return;
-        }
-
-        let ariaHidden = AstNodeInfo.hasAttribute(node, 'aria-hidden');
-        let splattributes = AstNodeInfo.hasAttribute(node, '...attributes');
-        let altPresent = isAltPresent(node);
-
-        if (!ariaHidden && !splattributes && !altPresent) {
-          this.log({
-            message: 'img tags must have an alt attribute',
-            line: node.loc && node.loc.start.line,
-            column: node.loc && node.loc.start.column,
-            source: this.sourceForNode(node),
-          });
-        }
-      },
-    };
-  }
-};
-
-function isAltPresent(node) {
-  let altAttribute = AstNodeInfo.findAttribute(node, 'alt');
-
-  return Boolean(altAttribute);
-}


Test patch:
diff --git a/test/unit/rules/lint-img-alt-attributes-test.js b/test/unit/rules/lint-img-alt-attributes-test.js
deleted file mode 100644
index 9dd5728c..00000000
--- a/test/unit/rules/lint-img-alt-attributes-test.js
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict';
-
-const generateRuleTests = require('../../helpers/rule-test-harness');
-
-generateRuleTests({
-  name: 'img-alt-attributes',
-
-  config: true,
-
-  good: [
-    '<img alt="hullo">',
-    '<img alt={{foo}}>',
-    '<img alt="blah {{derp}}">',
-    '<img aria-hidden="true">',
-    '<img alt="">',
-    '<img alt>',
-    '<img ...attributes>',
-  ],
-
-  bad: [
-    {
-      template: '<img>',
-
-      result: {
-        message: 'img tags must have an alt attribute',
-        moduleId: 'layout.hbs',
-        source: '<img>',
-        line: 1,
-        column: 0,
-      },
-    },
-  ],
-});