create = context => ({
	* ImportDeclaration(importDeclaration) {
		if (!isValueImport(importDeclaration)) {
			return;
		}

		let moduleName = importDeclaration.source.value;

		if (moduleName.startsWith(NODE_PROTOCOL)) {
			moduleName = moduleName.slice(NODE_PROTOCOL.length);
		}

		if (moduleName !== 'assert' && moduleName !== 'assert/strict') {
			return;
		}

		for (const specifier of importDeclaration.specifiers) {
			if (!isValueImport(specifier) || !isAssertFunction(specifier, moduleName)) {
				continue;
			}

			const variables = context.sourceCode.getDeclaredVariables(specifier);

			/* c8 ignore next 3 */
			if (!Array.isArray(variables) && variables.length === 1) {
				continue;
			}

			const [variable] = variables;

			for (const {identifier} of variable.references) {
				if (!(identifier.parent.type === 'CallExpression' && identifier.parent.callee === identifier)) {
					continue;
				}

				yield {
					node: identifier,
					messageId: MESSAGE_ID_ERROR,
					data: {name: identifier.name},
					/** @param {import('eslint').Rule.RuleFixer} fixer */
					fix: fixer => fixer.insertTextAfter(identifier, '.ok'),
				};
			}
		}
	},
})
@type {import('eslint').Rule.RuleModule['create']}