ReSharper 2026.3 Help

HTML 中的代码检查

在 HTML 中,ReSharper 2026.3 提供了两种代码检查:2 项 用于检测错误的检查 ,例如语法错误、未解析的符号、编译器错误等(这些检查无法配置或禁用),以及 41 项 专有代码检查 ,您可以 禁用或更改其 严重性级别。
These code inspections help you detect code issues at design time in all open files, and additionally they allow you to find code issues in specific scope.

可配置的 HTML 检查列在下方,并按其 类别分组。

代码通知(2 项检查)

此类别将严重性级别较低的代码检查分组。

检查
ID
EditorConfig 属性

默认严重性

忽略的路径
Web.IgnoredPath
resharper_web_ignored_path_highlighting

已禁用

映射路径
Web.MappedPath
resharper_web_mapped_path_highlighting

提示

常见实践和代码改进(9 项检查)

此类别分组的检查主要查找中等严重性的问题,这些问题主要影响代码的可读性。

检查
ID
EditorConfig 属性

默认严重性

重要标签或属性缺失(<img> 应指定替代文本)
MissingAltAttributeInImgTag
resharper_missing_alt_attribute_in_img_tag_highlighting

提示

重要标签或属性缺失(空的 <title>)
EmptyTitleTag
resharper_empty_title_tag_highlighting

提示

重要标签或属性缺失(缺少 <body>)
MissingBodyTag
resharper_missing_body_tag_highlighting

警告

重要标签或属性缺失(缺少 <head> 和 <body>)
MissingHeadAndBodyTags
resharper_missing_head_and_body_tags_highlighting

警告

重要标签或属性缺失(缺少 <head>)
MissingHeadTag
resharper_missing_head_tag_highlighting

警告

重要标签或属性缺失(缺少 <title>)
MissingTitleTag
resharper_missing_title_tag_highlighting

提示

过时的标签和属性(<center> 已过时)
CenterTagIsObsolete
resharper_center_tag_is_obsolete_highlighting

警告

过时的标签和属性(属性 'clear' 已过时)
ClearAttributeIsObsolete.All
resharper_clear_attribute_is_obsolete_all_highlighting

警告

过时的标签和属性(属性 'clear' 已过时)
ClearAttributeIsObsolete
resharper_clear_attribute_is_obsolete_highlighting

警告

语法问题(4 项检查)

此类别中的检查报告字符串字面量和文档注释中的 语法问题。

检查
ID
EditorConfig 属性

默认严重性

注释中的语法错误
GrammarMistakeInComment
resharper_grammar_mistake_in_comment_highlighting

建议

标记属性值中的语法错误
GrammarMistakeInMarkupAttribute
resharper_grammar_mistake_in_markup_attribute_highlighting

建议

标记文本中的语法错误
GrammarMistakeInMarkupText
resharper_grammar_mistake_in_markup_text_highlighting

建议

字符串字面量中的语法错误
GrammarMistakeInStringLiteral
resharper_grammar_mistake_in_string_literal_highlighting

已禁用

潜在的代码质量问题(24 项检查)

此类别包括检测关键问题(代码异味)的检查,主要具有 错误 或 警告 级别。 此类别还包括 确保本地化支持的检查。

检查
ID
EditorConfig 属性

默认严重性

上下文中不允许的元素(<dl> 包含 <dt> 或 <dd> 以外的元素,或未闭合)
DlTagContainsNonDtOrDdElements
resharper_dl_tag_contains_non_dt_or_dd_elements_highlighting

提示

上下文中不允许的元素(<ol> 包含 <li> 以外的元素,或 <li> 未闭合)
OlTagContainsNonLiElements
resharper_ol_tag_contains_non_li_elements_highlighting

提示

上下文中不允许的元素(<ul> 包含 <li> 以外的元素,或 <li> 未闭合)
UlTagContainsNonLiElements
resharper_ul_tag_contains_non_li_elements_highlighting

提示

HTML 无效代码
Html.DeadCode
resharper_html_dead_code_highlighting

警告

HTML 警告
Html.Warning
resharper_html_warning_highlighting

警告

ID 重复
Html.IdDuplication
resharper_html_id_duplication_highlighting

警告

过时或非标准元素
Html.Obsolete
resharper_html_obsolete_highlighting

警告

路径错误
Html.PathError
resharper_html_path_error_highlighting

警告

脚本标签错误(<script> 同时包含 src 和内容)
ScriptTagHasBothSrcAndContentAttributes
resharper_script_tag_has_both_src_and_content_attributes_highlighting

错误

脚本标签错误(<script> 在包含的 <script> 之前有内容)
ScriptTagWithContentBeforeIncludes
resharper_script_tag_with_content_before_includes_highlighting

提示

脚本标签错误(<script> 内的其他标签 - 可能未闭合的 <script>)
OtherTagsInsideScript1
resharper_other_tags_inside_script1_highlighting

错误

脚本标签错误(<script> 内的其他标签 - 可能未闭合的 <script>)
OtherTagsInsideScript2
resharper_other_tags_inside_script2_highlighting

错误

脚本标签错误(未闭合的 <script>,且包含其他标签)
OtherTagsInsideUnclosedScript
resharper_other_tags_inside_unclosed_script_highlighting

错误

脚本标签错误(未闭合的 <script>)
UnclosedScript
resharper_unclosed_script_highlighting

错误

未闭合的标签
Html.TagNotClosed
resharper_html_tag_not_closed_highlighting

错误

未知属性
Html.AttributeNotResolved
resharper_html_attribute_not_resolved_highlighting

警告

未知属性值
Html.AttributeValueNotResolved
resharper_html_attribute_value_not_resolved_highlighting

警告

未知事件
Html.EventNotResolved
resharper_html_event_not_resolved_highlighting

警告

未知 HTML 实体
Asp.Entity
resharper_asp_entity_highlighting

警告

未知 ID
Html.IdNotResolved
resharper_html_id_not_resolved_highlighting

警告

未知标签
Html.TagNotResolved
resharper_html_tag_not_resolved_highlighting

警告

错误的属性引号
Html.AttributesQuotes
resharper_html_attributes_quotes_highlighting

提示

错误的闭合标签
Html.TagShouldBeSelfClosed
resharper_html_tag_should_be_self_closed_highlighting

警告

错误的自闭合标签
Html.TagShouldNotBeSelfClosed
resharper_html_tag_should_not_be_self_closed_highlighting

警告

拼写问题(2 项检查)

这些检查 检测各种上下文中的拼写错误。

检查
ID
EditorConfig 属性

默认严重性

标记属性值中的拼写错误
MarkupAttributeTypo
resharper_markup_attribute_typo_highlighting

建议

标记文本中的拼写错误
MarkupTextTypo
resharper_markup_text_typo_highlighting

建议

2026年 11月 6日