Skip to content

Commit

Permalink
Add hint about using --init-rule-docs when rule doc missing (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Oct 29, 2023
1 parent c41f34f commit 988e466
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ export async function generate(path: string, options?: GenerateOptions) {
if (!existsSync(pathToDoc)) {
if (!initRuleDocs) {
throw new Error(
`Could not find rule doc: ${relative(getPluginRoot(path), pathToDoc)}`
`Could not find rule doc (run with --init-rule-docs to create): ${relative(
getPluginRoot(path),
pathToDoc
)}`
);
}

Expand Down
6 changes: 5 additions & 1 deletion test/lib/generate/file-paths-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ describe('generate (file paths)', function () {
it('throws an error', async function () {
// Use join to handle both Windows and Unix paths.
await expect(generate('.')).rejects.toThrow(
`Could not find rule doc: ${join('docs', 'rules', 'no-bar.md')}`
`Could not find rule doc (run with --init-rule-docs to create): ${join(
'docs',
'rules',
'no-bar.md'
)}`
);
});
});
Expand Down

0 comments on commit 988e466

Please sign in to comment.