function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper, language) {
	const disableDirectives = [];
	const problems = [];

	if (sourceCode.getDisableDirectives) {
		const { directives: directivesSources, problems: directivesProblems } =
			sourceCode.getDisableDirectives();

		problems.push(
			...directivesProblems.map(directiveProblem =>
				createLintingProblem({
					...directiveProblem,
					language,
				}),
			),
		);

		directivesSources.forEach(directive => {
			const { directives, directiveProblems } = createDisableDirectives(
				directive,
				ruleMapper,
				language,
				sourceCode,
			);

			disableDirectives.push(...directives);
			problems.push(...directiveProblems);
		});
	}

	return {
		problems,
		disableDirectives,
	};
}
Parses comments in file to extract disable directives.
@param {SourceCode} sourceCode The SourceCode object to get comments from.
@param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
@param {Language} language The language to use to adjust the location information
@returns {{problems: LintMessage[], disableDirectives: DisableDirective[]}}
A collection of the directive comments that were found, along with any problems that occurred when parsing