-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(lint): check for docblock in public API exports #106
base: main
Are you sure you want to change the base?
Conversation
c96f37d
to
eec16e4
Compare
7cc34ac
to
7c43fb5
Compare
package.json
Outdated
@@ -25,6 +25,7 @@ | |||
"indexer": "turbo index", | |||
"license": "pnpm zx scripts/license.mjs", | |||
"lint": "turbo lint", | |||
"postlint": "pnpm zx scripts/docblock.mjs", |
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.
Can probably just make this part of the lint command so that turbo can cache it.
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.
Does turbo not execute post*
script automatically?
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.
By natural of it running package commands, it might. But I don't think that it will cache the output which is needed to allow it to "skip" processes that don't need to run again.
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.
How do we test it to see?
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.
I moved it into lint
.
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.
Yea, doing && command
still won't cache it in turbo. Need to do something like Adding tasks and then in the actual lint
script do something like running multiple. i.e.
"lint": "turbo run lint:code lint:comments",
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.
I added the task to the turbo config - https://github.com/gohypergiant/standard-toolkit/pull/106/files#diff-f8de965273949793edc0fbfe249bb458c0becde39b2e141db087bcbf5d4ad5e3R10-R13.
scripts/docblock.mjs
Outdated
if (node.type === 'ExportDeclaration') { | ||
if (node.declaration.identifier) { | ||
acc.push(node.declaration.identifier.value); | ||
} else if (node.declaration.declarations) { | ||
for (const inner of node.declaration.declarations) { | ||
acc.push(inner.id.value); | ||
} | ||
} | ||
} |
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.
Type exports are also declaration.id.value
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.
For the context - docblock - does it matter? Do we want to expect docblock for type alias'?
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.
Yea. Still a part of the public facing API. And, depending on how the type is constructed, intellisense won't help. Unless you "goto definition" several times.
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.
I think I got this fixed. Let me knwo.
230825d
to
8507a5b
Compare
8507a5b
to
20a705f
Compare
7712de1
to
8fe201f
Compare
Additionally, @brandonjpierce, I'm assuming we want this to be per package like normal? For caching reasons. |
Since it is relevant, this doesn't check for "correctness" does it? It's purely "do I have at least a |
I thought that was what we talked about? Checking for "correctness" is a deeper rabbit hole; one I am happy to go down if that is what we want. |
Ok, then let me spin up a new ticket as this doesn't directly address the one linked in the description. As for the second part of your comment, personally I think "probably". I don't know the usefulness of simply checking if there is any comment since I'm assuming |
The ticket doesn't detail what it is looking for. What defines "correctness"? |
Added #113. Updated this description for link. Clarified in original #103. To add to that, most of the issues that me and Brandon created were done in like 30min and were aimed towards us. So if there is additional clarity needed for you, please just pop a comment in them. Since you aren't knee deep in the internal project that most of them came from. |
8fe201f
to
cc61a9a
Compare
If we are just looking for the docblock to have those elements - description and example - then that is easy enough. But executing the examples to check that level of correctness would be more involved. |
cc61a9a
to
94d4fd9
Compare
94d4fd9
to
d9b256a
Compare
Closes #113
✅ Pull Request Checklist:
📝 Test Instructions:
❓ Does this PR introduce a breaking change?
💬 Other information
issue #113