Skip to content

Commit 4d8a46a

Browse files
authored
Parser: Mention strict: false in OmittedClosingTagError message (#1189)
```diff - Element `<%s>` at (%u:%u) has its closing tag omitted. While valid HTML, consider adding an explicit `</%s>` closing tag at (%u:%u) for clarity. + Element `<%s>` at (%u:%u) has its closing tag omitted. While valid HTML, consider adding an explicit `</%s>` closing tag at (%u:%u) for clarity, or set `strict: false` to allow this. ```
1 parent 414d93e commit 4d8a46a

File tree

39 files changed

+82
-82
lines changed

39 files changed

+82
-82
lines changed

β€Žconfig.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ errors:
231231
232232
- name: OmittedClosingTagError
233233
message:
234-
template: "Element `<%s>` at (%u:%u) has its closing tag omitted. While valid HTML, consider adding an explicit `</%s>` closing tag at (%u:%u) for clarity."
234+
template: "Element `<%s>` at (%u:%u) has its closing tag omitted. While valid HTML, consider adding an explicit `</%s>` closing tag at (%u:%u) for clarity, or set `strict: false` to allow this."
235235
arguments:
236236
- opening_tag->value
237237
- opening_tag->location.start.line

β€Žjavascript/packages/linter/test/rules/parser-no-errors.test.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("ParserNoErrorsRule", () => {
2727
})
2828

2929
test("should report errors for unclosed elements", () => {
30-
expectError("Element `<p>` at (2:3) has its closing tag omitted. While valid HTML, consider adding an explicit `</p>` closing tag at (3:0) for clarity. (`OMITTED_CLOSING_TAG_ERROR`)")
30+
expectError("Element `<p>` at (2:3) has its closing tag omitted. While valid HTML, consider adding an explicit `</p>` closing tag at (3:0) for clarity, or set `strict: false` to allow this. (`OMITTED_CLOSING_TAG_ERROR`)")
3131

3232
assertOffenses(dedent`
3333
<div>
@@ -61,7 +61,7 @@ describe("ParserNoErrorsRule", () => {
6161

6262
test("should report multiple parser errors", () => {
6363
expectError("Opening tag `<h2>` at (1:1) doesn't have a matching closing tag `</h2>` in the same scope. (`MISSING_CLOSING_TAG_ERROR`)")
64-
expectError("Element `<p>` at (2:3) has its closing tag omitted. While valid HTML, consider adding an explicit `</p>` closing tag at (4:0) for clarity. (`OMITTED_CLOSING_TAG_ERROR`)")
64+
expectError("Element `<p>` at (2:3) has its closing tag omitted. While valid HTML, consider adding an explicit `</p>` closing tag at (4:0) for clarity, or set `strict: false` to allow this. (`OMITTED_CLOSING_TAG_ERROR`)")
6565
expectError("Found closing tag `</h3>` at (3:2) without a matching opening tag in the same scope. (`MISSING_OPENING_TAG_ERROR`)")
6666
expectError("Found closing tag `</div>` at (4:2) without a matching opening tag in the same scope. (`MISSING_OPENING_TAG_ERROR`)")
6767

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0001_li_elements_with_implicit_closing_-_followed_by_another_li_7149f80676885ca7acc65ca43aa14a59.txtβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0002_li_elements_with_implicit_closing_-_closed_by_parent_ff6e065993c9258e63ee145c02b79e63.txtβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0004_li_elements_mixed_explicit_and_implicit_closing_53705a837c9604af23433b4d2711076a.txtβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0005_nested_ul_with_implicit_li_closing_4c243bebe2fbd56431b4521f769cbfca.txtβ€Ž

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0006_ol_with_implicit_li_closing_554204d2abe9275ba8f549102487a9b5.txtβ€Ž

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0007_dt_elements_with_implicit_closing_-_followed_by_another_dt_319abaebd183c6a540902a26c80b4a2b.txtβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0008_dt_element_implicitly_closed_by_dd_a2e1bde153e30ee6b7df2ef7af87344b.txtβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žtest/snapshots/parser/optional_closing_tags_test/test_0009_dd_elements_with_implicit_closing_-_followed_by_another_dd_99513a9929561722e33cf60b9534cf8f.txtβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)