Skip to content
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

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

Merged
merged 2 commits into from
Feb 15, 2023
Merged

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

merged 2 commits into from
Feb 15, 2023

Conversation

rwaskiewicz
Copy link
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)

@@ -35,7 +46,7 @@ export function loadDiagnostic(context: d.PluginCtx, sassError: SassException, f

if (errorLineIndex > -1) {
try {
const sourceText = context.fs.readFileSync(diagnostic.absFilePath) as string;
const sourceText = context.fs.readFileSync(diagnostic.absFilePath);
Copy link
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
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
Member

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
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

Copy link
Member

@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
Member

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
Member

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
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
Member

@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.
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.

None yet

3 participants