diff --git a/mypy/config_parser.py b/mypy/config_parser.py index a84f3594a0d22..7748c3b259663 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -434,11 +434,26 @@ def parse_section( """ results: dict[str, object] = {} report_dirs: dict[str, str] = {} + + # Because these fields exist on Options, without proactive checking, we would accept them + # and crash later + invalid_options = { + "enabled_error_codes": "enable_error_code", + "disabled_error_codes": "disable_error_code", + } + for key in section: invert = False options_key = key if key in config_types: ct = config_types[key] + elif key in invalid_options: + print( + f"{prefix}Unrecognized option: {key} = {section[key]}" + f" (did you mean {invalid_options[key]}?)", + file=stderr, + ) + continue else: dv = None # We have to keep new_semantic_analyzer in Options