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
Set up knip for dead code / dependency detection #225
Conversation
Codecov Report
@@ Coverage Diff @@
## main #225 +/- ##
==========================================
+ Coverage 72.54% 73.00% +0.45%
==========================================
Files 103 103
Lines 5150 5126 -24
Branches 407 407
==========================================
+ Hits 3736 3742 +6
+ Misses 1396 1366 -30
Partials 18 18
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 didn't know about this tool, it's really nice. Thanks for setting it up!
@@ -31,24 +29,7 @@ async function getBaseDir() { | |||
export async function getUploadsDir() { | |||
return join(await getBaseDir(), UPLOADS_DIR); | |||
} | |||
export async function ensureProjectFileStructure() { |
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'm a bit surprised we aren't using this anymore 🤔
@cguedes is this intentional?
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.
@sehyod no! I'm also a bit surprised. I think that this is a great gateway to have some (proper) initial/demo structure for RefStudio.
What do you think of calling this method from the settings to reset the editor data?
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 we have to call it on start, because we need to create the base directory for the app when the app starts for the first time: await createDir(baseDir, { recursive: true });
I'm not sure it would work as a reset function, because it wouldn't remove created and uploaded files
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.
Sure, we would need to improve that for the "initial/demo/reset" feature (in a new issue).
For now I will push a commit to use it in the app startup.
EDIT: I'm also updating the file names in that function to be .refstudio
instead of .tiptap
.
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.
We should agree on what to do with these two functions.
@@ -31,24 +29,7 @@ async function getBaseDir() { | |||
export async function getUploadsDir() { | |||
return join(await getBaseDir(), UPLOADS_DIR); | |||
} | |||
export async function ensureProjectFileStructure() { |
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.
@sehyod no! I'm also a bit surprised. I think that this is a great gateway to have some (proper) initial/demo structure for RefStudio.
What do you think of calling this method from the settings to reset the editor data?
Knip is a new tool I've been meaning to try out for detecting unused code and dependencies in JS/TS projects. It seems pretty low configuration and comes with a bunch of plugins for tracking dependencies around particular tools, e.g. vitest and prettier.
For an example of what a failure looks like, see https://github.com/refstudio/refstudio/actions/runs/5414908438/jobs/9842668221?pr=225