-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
correct html closing tag (typo) #37217
Conversation
Preview URLs (comment last updated: 2024-12-16 08:32:16) |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kristy-hu hello there, and thank you for your contribution to MDN!
Your fix looks correct to me, but the linter is complaining and giving a totally nonsense error message.
I would try fixing up the edit for the <q>
element (to <q> ... </q>
, or maybe put the tags on separate lines to the content, whatever you think looks best) and then push that. If this still fails (I'm wondering if it was the linter that suggested that weird fix, it sometimes does weird things), then add -nolint
on to the opening code fence label, i.e. html-nolint
to get the linter to skip linting this code block.
The formatter is stable and predictable. The problem here is that because this PR fixes a syntax error, suddenly the formatter is able to run on a big chunk of code, but reviewdog cannot comment on unchanged lines. To fix errors like this, you would need to either paste this file into Prettier playground (https://prettier.io/playground) or format it locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Josh-Cena yes, it's stable and predictable, but some of its error messages are hard to decipher.
And, the edit to the HTML has still resulted in this weird breaking of tags across lines, which I think needs to be fixed. You'd use that style when you have a lot of attributes, putting each attribute on a separate line, but not in this case, where there are no attributes.
@chrisdavidmills Hi! I see now the |
That's because we treat HTML as whitespace-sensitive. Formatting it as <q>
foo
</q> Is pretty, but actually results in extra whitespace around the text. We have decided that correctness is more important than source code beauty. |
I agree that the error message is extremely hard to decipher though. @OnkarRuikar I've probably reported the same thing before, but Prettier errors are not surfaced as such in the log: Logs from markdownlint:
yarn run v1.22.22
$ /home/runner/work/content/content/node_modules/.bin/markdownlint-cli2 --fix files/en-us/web/html/element/summary/index.md
markdownlint-cli2 v0.16.0 (markdownlint v0.36.1)
Finding: files/en-us/web/html/element/summary/index.md !node_modules !.git !.github !tests
Linting: 1 file(s)
Summary: 0 error(s)
Done in 0.[29](https://github.com/mdn/content/actions/runs/12348529070/job/34457537052#step:12:30)s.
Logs from front-matter linter:
0 0
Please fix all the linting issues mentioned in above logs and in the review comments.
Error: Process completed with exit code 1. |
@Josh-Cena Yes, but
would avoid the ugly broken tags issue, AND fix the whitespace issue. Can we not do that instead? I know it's too late for this one, as you've merged it, but in future ... ? |
The formatter does not allow any subjective preferences for formatting, unfortunately. It ignores any line breaks and reformats everything. I do prefer tags to stay in one line but that's not the style chosen by Prettier and we would have to respect it. |
About the prettier diff was not suggested for the first commit, the workflow code does work fine. It could be a GitHub glitch. Was this Kristy's first PR submission? For investigation, how often have you seen Reviewdog not commenting on PR, but there are Prettier suggested changes?
Prettier doesn't throw errors in write mode. It just modifies files. Will dumping diff after the error message help? |
No, actually it was the second here on MDN XD. |
Why don't we run Prettier with
The would-be diff is physically unable to be commented on, because it's too far from the changed lines; I doubt reviewdog will be able to bypass GH limits. |
And most of the time the job is done fine. But in situations like this, where you end up with screwy markup formatting, I think it is OK to override it with |
Reviewdog doesn't come into the picture when contributors do commits from the local dev environment. The workflow is mainly for cases where a commit is made using GitHub. So, it is preferable to show the expected changes directly than to tell a file needs to be formatted. We could run |
Yes that sounds good |
* correct html closing tag * Update files/en-us/web/html/element/summary/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update files/en-us/web/html/element/summary/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update index.md --------- Co-authored-by: Joshua Chen <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chris Mills <[email protected]>
Correct a typo on
<summary>
page.Description
Motivation
Additional details
Related issues and pull requests