Closed danielphilipjohnson closed 1 year ago
Merging #62 (531ed15) into master (5e253e4) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #62 +/- ##
=======================================
Coverage 99.48% 99.48%
=======================================
Files 19 19
Lines 3084 3086 +2
Branches 160 160
=======================================
+ Hits 3068 3070 +2
Misses 16 16
Impacted Files | Coverage Δ | |
---|---|---|
src/components/SliceZone.ts | 99.64% <100.00%> (+<0.01%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
OK, I carried out some more research:
@description
isn't semantically valid for describing examples when considering JSDoc syntax so I'm really against it.@example
, by its definition, just highlights code coming after, not what we want@example
, is what we want, I'll try to make it work by the linter'sEdit: Well, looks like there's no way to disable the linter's behavior on these tags :[
@angeloashmore may I summon your consult on that one (and the attached issue) so we can adopt the same solution everywhere 🤔
While a bit funky, I think separating the example description as Daniel did might be the more readable mitigation.
Curious how are examples being displayed within Vim also 🤔
Vim/Neovim looks the same as VS Code, unfortunately. I assume the formatted content is sourced from the TypeScript service, which is why both editors suffer from the same issue.
As demonstrated in that function's example, any text after @example
not in a code fence breaks support for code fences.
Adding the example's name outside the @example
tags creates compatibility issues with the JSDoc Prettier plugin (prettier-plugin-jsdoc
) which, despite the issue it presents here, is generally useful. I think we could come up with an alternative that lets us continue using prettier-plugin-jsdoc
and @example
tags as intended.
One solution is to add example descriptions to the example's code block as a comment. I personally think this works better than separating the comment from the @example
block since it keep the comment close to the example.
/**
* @example
*
* ```javascript
* // Defining Slice components.
*
* import { defineSliceZoneComponents } from "@prismicio/vue";
*
* // rest of the example...
* ```
*/
export const defineSliceZoneComponents = // ...
It looks like this in Vim:
Any thoughts? We lose some semantic meaning of @example
comments, but they don't seem to be used anywhere anyway.
Types of changes
Description
jsdoc @example wasn't formatting the code snippet. Ive now moved the text on the end of the line that was preventing it from working.
I found it hard to understand the code snippet due to not formatting.
Resolves #61
Checklist: