code: function removeDuplicateComments(ast) {
      // Some comments are duplicated as both the leadingComment for one node,
      // and the trailing comment for another. Every comment's range is unique,
      // so two comments with the same range are talking about the same comment.
      // So we'll just remove all trailing comments which are also a leading
      // comment somewhere.
      //eslint-disable-next-line no-undef
      const rangesInLeadingComments = new Set();
      estreeWalker.walk(ast, {
          enter: (node) => {
              for (let leadingComment of node.leadingComments || []) {
                  rangesInLeadingComments.add(leadingComment.range.join(','));
              }
          }
      });
      estreeWalker.walk(ast, {
          enter: (node) => {
              if (!node.trailingComments) {
                  return;
              }
              node.trailingComments = node.trailingComments.filter((comment) => {
                  return !rangesInLeadingComments.has(comment.range.join(','));
              });
          }
      });
  }
docs: https://github.com/estools/escodegen/issues/239