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

Option to create rule docs if they don't exist? #236

Closed
JoshuaKGoldberg opened this issue Nov 17, 2022 · 2 comments
Closed

Option to create rule docs if they don't exist? #236

JoshuaKGoldberg opened this issue Nov 17, 2022 · 2 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Nov 17, 2022

I'm onboarding an existing repo, https://github.com/veritem/eslint-plugin-vitest/tree/097eb2649afac54039c4891971079434a55f0662, onto eslint-doc-generator. After pnpm add eslint-plugin-vitest npm-run-all --save-dev:

$ pnpm run update:eslint-docs

> [email protected] update:eslint-docs /Users/josh/repos/eslint-plugin-vitest
> eslint-doc-generator

file:///Users/josh/repos/eslint-plugin-vitest/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint-doc-generator/dist/lib/generator.js:110
            throw new Error(`Could not find rule doc: ${relative(getPluginRoot(path), pathToDoc)}`);
                  ^

Error: Could not find rule doc: docs/rules/no-skipped-tests.md
    at generate (file:///Users/josh/repos/eslint-plugin-vitest/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint-doc-generator/dist/lib/generator.js:110:19)
    at async Command.<anonymous> (file:///Users/josh/repos/eslint-plugin-vitest/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint-doc-generator/dist/lib/cli.js:114:9)
    at async Command.parseAsync (/Users/josh/repos/eslint-plugin-vitest/node_modules/.pnpm/[email protected]/node_modules/commander/lib/command.js:916:5)
    at async run (file:///Users/josh/repos/eslint-plugin-vitest/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint-doc-generator/dist/lib/cli.js:89:5)

Node.js v18.7.0
 ELIFECYCLE  Command failed with exit code 1.

It'd be nice if there was a flag like, say, eslint-doc-generator --init that could initialize rule docs for me. Bonus points if it also adjusts the contents of the file to avoid the <rule> rule doc should have included one of these headers: Options, Config lint complaint.

I'd be happy to send a PR!

@bmish
Copy link
Owner

bmish commented Nov 18, 2022

Hey, thanks for trying this out!

  1. While plugins that are missing rule docs entirely are hopefully rare, I do have an existing issue to add an option to create the missing rule docs: Add option to create missing rule docs #79. I could implement this pretty quickly this morning unless you want to work on it first.
  2. The options section check can be disabled if needed with --rule-doc-section-options false, although it's usually pretty quick to add the missing sections manually. I haven't bothered trying to automatically create an options section because it would need so much manual attention anyway (where to place it, the full list of options to mention, the explanation for each option). But it could we worth trying to generate at least a barebones options section so I have filed an issue to consider this: Automatically generate missing options sections in rule docs #237.

@JoshuaKGoldberg
Copy link
Contributor Author

JoshuaKGoldberg commented Nov 18, 2022

Oh shoot 🤦 sorry I swear I did search for duplicates! I'd love to work on #79 and #237, will take a look today. Thank you!

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

No branches or pull requests

2 participants