function group(ancestors, nodes) {
      /** @type {Map<string, DefinitionContent>} */
      const map = new Map()
      /** @type {Array<string>} */
      const current = []

      for (const node of nodes) {
        current.push(node.identifier)
        map.set(node.identifier, node)
      }

      // Intentional that they are made unique with `Set`.
      const actual = [...new Set(current)]
      const expected = [...actual].sort()

      for (const name of actual) {
        const actualIndex = actual.indexOf(name)
        const expectedIndex = expected.indexOf(name)
        const node = map.get(name)
        assert(node) // Always defined.
        if (actualIndex !== expectedIndex && node.position) {
          file.message(
            'Unexpected' +
              (node.type === 'footnoteDefinition' ? ' footnote' : '') +
              ' definition `' +
              name +
              '` in ' +
              ordinal(actualIndex + 1) +
              ' place, expected alphabetically sorted definitions, move it to ' +
              ordinal(expectedIndex + 1) +
              ' place',
            {ancestors: [...ancestors, node], place: node.position}
          )
        }
      }
    }
@param {Array<Parents>} ancestors
@param {Array<DefinitionContent>} nodes
@returns {undefined}