message: refactor(docs-infra): refactors `addImageDimensionsImpl`
  This commit changes the `addImageDimensionsImpl` method to reduce
  nesting. It will exit early, if the conditions are not matched.
  PR Close
diff: @@ -15,12 +15,17 @@ module.exports = function addImageDimensions(getImageDimensions) {
  return (ast, file) => {
  visit(ast, node => {
  - if (is(node, 'img')) {
  + if (!is(node, 'img')) {
  + return;
  + }
  +
  const props = node.properties;
  const src = props.src;
  if (!src) {
  file.message('Missing src in image tag `' + source(node, file) + '`');
  - } else {
  + return;
  + }
  +
  try {
  const dimensions = getImageDimensions(addImageDimensionsImpl.basePath, src);
  if (props.width === undefined && props.height === undefined) {
  @@ -34,8 +39,6 @@ module.exports = function addImageDimensions(getImageDimensions) {
  file.fail(e.message);
  }
  }
  - }
  - }
  });
  };
  };
  