<commit_before>var utils = require('../utils')
  , selfClosing = require('void-elements')

module.exports = function () {}

module.exports.prototype =
  { name: 'validateSelfClosingTags'

  , configure: function (options) {

      utils.validateTrueOptions(this.name, options)

    }

  , lint: function (file, errors) {

      var isXml

      file.iterateTokensByType('doctype', function (token) {
        isXml = token.val === 'xml'
      })

      if (!isXml) {
        file.iterateTokensByType('tag', function (token) {
          if (token.selfClosing && selfClosing[token.val]) {
            errors.add('Unnecessary self closing tag', token.line)
          }
        })
      }

    }
  }<commit_msg>Refactor `validateSelfClosingTags` to handle new token structure<commit_after>var utils = require('../utils')
  , selfClosing = require('void-elements')

module.exports = function () {}

module.exports.prototype =
  { name: 'validateSelfClosingTags'

  , configure: function (options) {

      utils.validateTrueOptions(this.name, options)

    }

  , lint: function (file, errors) {

      var isXml

      file.iterateTokensByType('doctype', function (token) {
        isXml = token.val === 'xml'
      })

      if (!isXml) {
        file.iterateTokensByType('tag', function (token) {
          var nextToken = file.getToken(token._index + 1)

          if (nextToken.type === 'slash' && selfClosing[token.val]) {
            errors.add('Unnecessary self closing tag', token.line)
          }
        })
      }

    }
  }
{'fraction_non_alphanumeric': 0.1378184193337688, 'fraction_numerical': 0.0006531678641410843, 'mean_word_length': 2.562790697674419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7377442', 'n_tokens_mistral': 476, 'n_tokens_neox': 456, 'n_words': 91}