function checkAndReport(
	context,
	node,
	modules,
	declarationType,
	includeExports,
) {
	const module = getModule(node);

	if (modules.has(module)) {
		const previousNodes = modules.get(module);
		const messagesIds = [];
		const importNodes = getNodesByDeclarationType(previousNodes, "import");
		let exportNodes;

		if (includeExports) {
			exportNodes = getNodesByDeclarationType(previousNodes, "export");
		}
		if (declarationType === "import") {
			if (shouldReportImportExport(node, importNodes)) {
				messagesIds.push("import");
			}
			if (includeExports) {
				if (shouldReportImportExport(node, exportNodes)) {
					messagesIds.push("importAs");
				}
			}
		} else if (declarationType === "export") {
			if (shouldReportImportExport(node, exportNodes)) {
				messagesIds.push("export");
			}
			if (shouldReportImportExport(node, importNodes)) {
				messagesIds.push("exportAs");
			}
		}
		messagesIds.forEach(messageId =>
			context.report({
				node,
				messageId,
				data: {
					module,
				},
			}),
		);
	}
}
Checks if the (import|export) can be merged with at least one import or one export, and reports if so.
@param {RuleContext} context The ESLint rule context object.
@param {ASTNode} node A node to get.
@param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
@param {string} declarationType A declaration type can be an import or export.
@param {boolean} includeExports Whether or not to check for exports in addition to imports.
@returns {void} No return value.