function toValidInvalid(patterns, item) {
	const ecmaVersion =
		item.languageOptions && item.languageOptions.ecmaVersion
			? item.languageOptions.ecmaVersion
			: 6;

	const allowOptions = Array.isArray(item.allow) ? item.allow : [item.allow];

	// Valid Patterns
	patterns.valid.push(
		{
			code: item.code.replace("{}", "{ bar(); }"),
			languageOptions: { ecmaVersion },
		},
		{
			code: item.code.replace("{}", "{ /* empty */ }"),
			languageOptions: { ecmaVersion },
		},
		{
			code: item.code.replace("{}", "{\n    // empty\n}"),
			languageOptions: { ecmaVersion },
		},
		...allowOptions.map(allow => ({
			code: `${item.code} // allow: ${allow}`,
			options: [{ allow: [allow] }],
			languageOptions: { ecmaVersion },
		})),
	);

	const error = item.message || {
		messageId: item.messageId,
		data: item.data,
	};

	// Invalid Patterns.
	patterns.invalid.push({
		code: item.code,
		errors: [error],
		languageOptions: { ecmaVersion },
	});
	ALLOW_OPTIONS.filter(allow => !allowOptions.includes(allow)).forEach(
		allow => {
			// non related "allow" option has no effect.
			patterns.invalid.push({
				code: `${item.code} // allow: ${allow}`,
				errors: [error],
				options: [{ allow: [allow] }],
				languageOptions: { ecmaVersion },
			});
		},
	);

	return patterns;
}
Folds test items to `{valid: [], invalid: []}`.
One item would be converted to 4 valid patterns and 8 invalid patterns.
@param {{valid: Object[], invalid: Object[]}} patterns The result.
@param {{code: string, message: string, allow: string|string[]}} item A test item.
@returns {{valid: Object[], invalid: Object[]}} The result.