Skip to content

chore(jsdoc): document @stencil/sass#225

Merged
rwaskiewicz merged 2 commits intomainfrom
rwaskiewicz/doc-pkg
Feb 15, 2023
Merged

chore(jsdoc): document @stencil/sass#225
rwaskiewicz merged 2 commits intomainfrom
rwaskiewicz/doc-pkg

Conversation

@rwaskiewicz
Copy link
Copy Markdown
Member

@rwaskiewicz rwaskiewicz commented Feb 13, 2023

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Tests (npm test) were run locally and passed
  • Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

This package is largely undocumented

GitHub Issue Number: N/A

What is the new behavior?

this commit adds jsdoc to the @stencil/sass package to help with transferring knowledge about the package/making it easier to pick up to work on. this is being done prior to the upgrade to sass 1.58.0, which will lead to type changes within the project. this commit is the result of the exercise of the author refamiliarizing themself with the project a bit, rather than a direct dependency of the aforementioned update.

Does this introduce a breaking change?

  • Yes
  • No

Testing

The formatter & type checker should continue to pass (only "functional" changes were explicit types added)

if (errorLineIndex > -1) {
try {
const sourceText = context.fs.readFileSync(diagnostic.absFilePath) as string;
const sourceText = context.fs.readFileSync(diagnostic.absFilePath);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readFileSync returns a string, this assertion is unneeded

* @param input the numeric error code to convert
* @returns the stringified error code
*/
function formatCode(input: number): string {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this shouldn't happen per the type system, I left the nullish check in here since this was largely a documentation effort

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we don't have "strict": true in this project input could be called with undefined and TypeScript wouldn't let us know, so the check might be wise. Although to be fair, just inlining String(num ?? "") would accomplish the same thing as this function anyway

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah...true

@rwaskiewicz rwaskiewicz marked this pull request as ready for review February 13, 2023 18:30
@rwaskiewicz rwaskiewicz requested a review from a team as a code owner February 13, 2023 18:30
Copy link
Copy Markdown
Contributor

@alicewriteswrongs alicewriteswrongs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just had one suggestion really

* @param input the numeric error code to convert
* @returns the stringified error code
*/
function formatCode(input: number): string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we don't have "strict": true in this project input could be called with undefined and TypeScript wouldn't let us know, so the check might be wise. Although to be fair, just inlining String(num ?? "") would accomplish the same thing as this function anyway

* @param opts options to configure the plugin
* @return the configured plugin
*/
export function sass(opts: d.PluginOptions = {}): d.Plugin {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right that this is the function people will import into their Stencil config if they want to use sass? If that's right, it might be good to adorn this jsdoc with just a few more helpful things, like maybe just a link to the README (https://github.com/ionic-team/stencil-sass) and possibly to the plugin documentation (https://stenciljs.com/docs/plugins) although the latter is a bit spare at the moment. I'm just thinking that that way when you hover over the symbol in your editor you get some sort of a friendly message in the JSDoc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done in 2f22174

Copy link
Copy Markdown
Contributor

@alicewriteswrongs alicewriteswrongs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@rwaskiewicz rwaskiewicz enabled auto-merge (squash) February 15, 2023 15:32
this commit adds jsdoc to the @stencil/sass package to help with
transferring knowledge about the package/making it easier to pick up to
work on. this is being done prior to the upgrade to sass 1.58.0, which
will lead to type changes within the project. this commit is the result
of the exercise of the author refamiliarizing themself with the project
a bit, rather than a direct dependency of the aforementioned update.
@rwaskiewicz rwaskiewicz merged commit 9e5519a into main Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants