function getTextPositionsMap(sourceText, consideredRuleIds) {
	const textPositionsMap = new Map();
	const ast = ts.createSourceFile("", sourceText);

	for (const statement of ast.statements) {
		if (
			statement.kind === ts.SyntaxKind.InterfaceDeclaration &&
			extendsRulesRecord(statement)
		) {
			const { members } = statement;

			for (const member of members) {
				if (member.kind === ts.SyntaxKind.PropertySignature) {
					const ruleId = member.name.text;

					if (consideredRuleIds.has(ruleId)) {
						let textPositions;

						// Only the last TSDoc comment is regarded.
						const tsDoc = member.jsDoc?.at(-1);

						if (tsDoc) {
							textPositions = {
								tsDocStart: tsDoc.pos,
								tsDocEnd: tsDoc.end,
							};
						} else {
							const regExp = /\S/gu;

							regExp.lastIndex = member.pos;
							const { index } = regExp.exec(sourceText);

							textPositions = {
								tsDocStart: index,
								tsDocEnd: index,
							};
						}
						textPositions.typeEnd = member.end;
						textPositionsMap.set(ruleId, textPositions);
					}
				}
			}
		}
	}
	return textPositionsMap;
}
Returns the locations of the TSDoc header comments and the end of the type definition for each rule in a type declaration file.
If a rule has no header comment the location returned is the start position of the rule name.
@param {string} sourceText The source text of the type declaration file.
@param {Set<string>} consideredRuleIds The names of the rules to be considered for the current run.
@returns {Map<string, TextPositions>} A map of rule names to text positions.
The text positions indicate the locations of the TSDoc header comments and the end of the type definition in the source.