Skip to content

Add support for markdownlint-cli2 #1011

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pkuczynski
Copy link

@pkuczynski pkuczynski commented Mar 28, 2025

@webpro
Copy link
Member

webpro commented Mar 29, 2025

Thanks Piotr! Much appreciated. Please add a test with a fixture to clarify what the plugin does and to prevent future regressions. Each and every existing Knip plugin has this.

Also see https://knip.dev/guides/writing-a-plugin#create-a-new-plugin

@pkuczynski
Copy link
Author

Please add a test with a fixture to clarify what the plugin does and to prevent future regressions. Each and every existing Knip plugin has this.

Sure thing! Will try to do it by end of this week...

@pkuczynski
Copy link
Author

hey @webpro I made a first attempt to write a test, but does not seem to be working as expected. Can you maybe have a look an tell me what I am doing wrong?

  1. My intention was to check it there is a plugin mentioned in the config, but misisng in dependencies.
  2. Later on I would like to test exactly opposite case.
  3. Then maybe add a test to check if config file exists but no reference in package.json (however the tool can be installed via brew or gha and run without being mentioned in package.json - so not sure if such test makes sense?)

I pushed my changes in the PR. Looking forward to hear your feedback...

@webpro
Copy link
Member

webpro commented Apr 3, 2025

hey @webpro I made a first attempt to write a test, but does not seem to be working as expected. Can you maybe have a look an tell me what I am doing wrong?

Thank you for working on this, feel free to ask away!

  1. My intention was to check it there is a plugin mentioned in the config, but misisng in dependencies.

Everything looks good at the moment. So markdownlint-cli2 is the "lint:md" script in package.json. This should result in the lint issue "missing binary" which is in the issues object as expected.

The "markdownlint-rule-relative-links" specifier is not unresolved, because the plugin is not enabled/running at all. The plugin is configured to be enabled if the "markdownlint-cli2" is listed in either dependencies or devDependencies.

  1. Later on I would like to test exactly opposite case.

That should result in the lint issue "unused devDependency" which should be in issues.devDependencies.

By the way, you'd have to make a new fixture directory for this (e.g. markdownlint-cli2-2 😃)

  1. Then maybe add a test to check if config file exists but no reference in package.json (however the tool can be installed via brew or gha and run without being mentioned in package.json - so not sure if such test makes sense?)

If this situation happens, I'd expect the config file to be reported as unused (in issues.files)

I pushed my changes in the PR. Looking forward to hear your feedback...

One workflow I like, if you're using VS Code (I guess you could configure the same on others), run the debugger from a test file like markdownlint-cli2.test.ts. Press F5 and the "Debug Bun test" launch config will run and you can set breakpoints anywhere, output will go to the in-IDE terminal.

@webpro webpro force-pushed the main branch 3 times, most recently from e764138 to d4c7379 Compare April 25, 2025 11:19
@webpro webpro force-pushed the main branch 7 times, most recently from ea72d80 to 7787123 Compare May 8, 2025 05:47
@webpro
Copy link
Member

webpro commented Jun 9, 2025

Is there still interest in finishing this PR? No worries if not, but I'm going to clean things up a bit around here.

@pkuczynski
Copy link
Author

Is there still interest in finishing this PR? No worries if not, but I'm going to clean things up a bit around here.

There is! Let me have a look this week. If I won't make it, I will close it...

@webpro
Copy link
Member

webpro commented Jun 12, 2025

Sure, no hurries, just wanted to check if it's still interesting/relevant.

@webpro webpro force-pushed the main branch 4 times, most recently from 5a2d249 to 6bd250a Compare June 17, 2025 17:36
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.

2 participants