-
Notifications
You must be signed in to change notification settings - Fork 8
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
unintended_html_in_doc_comment
- add to recommended set
#826
Comments
Does it have exceptions? (Fx The name is "unintended...". It's there intended uses? If so, what are they? Is there a way to opt out? Can I do /// If _X_<sub>2</sub> If not, can I do |
Just the allowlist, I suppose.
Nothing beyond the standard recommended way (with
Yes. |
Ack. The documentation should probably at least mention that there is an allowlist, preferably include the list. May also want to say why
is considered "good" and that it's not parsed as HTML, counter to what the first sentence says. You are allowed to use custom tags in Commonmark, but I don't see any use for that in dartdoc, so there is probably no need for ignores. 👍 if the docs are updated. |
From an off-line discussion:
resolution: OK to include in |
The lint is still listed as experimental. We'll want to graduate it. (I treat the documentation of lints as their specification, since there is no other place to find a specification. The documentation should be good enough to be used as a specification.) |
Thanks, make sense. I opened dart-lang/sdk#59501 for the doc work on the lint. |
Oh yeah, thanks for looking at it @lrhn. I'll update it and send it out. |
Docs should be updated now. |
We're trying on the lint in package:dart_flutter_team_lints; it looks like there are some false positives - relatively infrequent html entites that are actually used in dartdoc comments - things we don't want escaped. Srujan hit this in package:web and opened dart-lang/sdk#56450 to track. |
We also ran into issues with this lint in flutter: dart-lang/sdk#59516 |
I'm satisfied with docs and implementation. If there are any remaining edge cases, we can try to fix them too. |
From additional discussion, we think the false positive on generics ( |
What would the desired solution be? Ignore any Which means matching Basically, treat That might have false positives for: Help with [C<up>14</up>] dating.
[C<up>14</up>]: http://example.com/carbon-dating where I miswrote If you do in DartDoc, then just ignoring a stand-alone |
Hmm, I'm not sure we'll run across those usages in practice, whereas we have run into false positives for linked generics.
Yes, I think that's reasonable; for this lint we would assume that any angle brackets in there are used for generics and not as html. Separately, the analyzer could itself warn if those references couldn't resolve. |
I'm not sure we are handling the embedded HTML correctly, or at least consistently. If I write
That is, the analysis server is serving HTML that interprets a The DartDoc tool, as run by This is probably a bug in the analyzer's DartDoc interpretation, not a reason to not adapt the lint. (It's also why |
With the fix in https://dart-review.googlesource.com/c/sdk/+/384840 I think the last blocker for adding this lint has been addressed. |
Describe the rule you'd like to see added and to what rule set
https://dart.dev/tools/linter-rules/unintended_html_in_doc_comment
Additional context
It's almost ALWAYS helpful. Trouble imagining false negatives.
Need to wait until Dart 3.5 is stable, though.
The text was updated successfully, but these errors were encountered: