function validateRegExpFlags(flags, flagsToCheck, allFlags) {
			const duplicateFlags = [];

			if (typeof flagsToCheck === "string") {
				for (const flag of flagsToCheck) {
					if (allFlags.includes(flag)) {
						duplicateFlags.push(flag);
					}
				}
			}

			/*
			 * `regexpp` checks the combination of `u` and `v` flags when parsing `Pattern` according to `ecma262`,
			 * but this rule may check only the flag when the pattern is unidentifiable, so check it here.
			 * https://tc39.es/ecma262/multipage/text-processing.html#sec-parsepattern
			 */
			if (flags && flags.includes("u") && flags.includes("v")) {
				return "Regex 'u' and 'v' flags cannot be used together";
			}

			if (duplicateFlags.length > 0) {
				return `Duplicate flags ('${duplicateFlags.join("")}') supplied to RegExp constructor`;
			}

			if (!flagsToCheck) {
				return null;
			}

			return `Invalid flags supplied to RegExp constructor '${flagsToCheck}'`;
		}
Check syntax error in a given flags.
@param {string|null} flags The RegExp flags to validate.
@param {string|null} flagsToCheck The RegExp invalid flags.
@param {string} allFlags all valid and allowed flags.
@returns {string|null} The syntax error.