Hide icon and rating when there is no rating entered

Simply check that the rating is not empty before printing the markup you wish to make conditional:

<?php 
$rating = get_average_listing_rating( $post->ID, 1 );
if ( ! empty( $rating ) ) { ?>
    <span class="js-average-rating"><i class="star"></i> <?php echo $rating; ?></span>
<?php } ?>

Without seeing this in context, it’s possible you need the outer span to maintain alignment or something else. If so, just move what you need outside of the condition test.