-
-
Notifications
You must be signed in to change notification settings - Fork 167
feat(require-hyphen-before-param-description
): when always
is set, disallow hyphen at end of line
#1454
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances the require-hyphen-before-param-description
rule to handle a specific edge case where hyphens at the end of lines (before descriptions that start on the next line) cause display issues in Visual Studio Code. When the rule is configured to "always" require hyphens, it now disallows hyphens that appear at the end of a line without any description text following on the same line.
Key changes:
- Added logic to detect hyphens followed immediately by newlines and treat them as invalid even when "always" mode is enabled
- Updated the fixer to properly handle the removal of trailing hyphens
- Added comprehensive test cases covering the new behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/rules/requireHyphenBeforeParamDescription.js |
Core rule implementation with new logic to detect and handle trailing hyphens |
test/rules/assertions/requireHyphenBeforeParamDescription.js |
Test cases for the new trailing hyphen detection behavior |
docs/rules/require-hyphen-before-param-description.md |
Documentation updates explaining the new behavior and fixer functionality |
.README/rules/require-hyphen-before-param-description.md |
README template updates matching the documentation changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
a4d83cd
to
e4bd34b
Compare
I suggest to revise the error message. The current error message directly uses the error message when setting to |
e4bd34b
to
108d013
Compare
Good catch. I've updated the PR if you care to check. It should now say "There must be no hyphen followed by newline in a @param description." whether "always" or "never" is set. (Btw, am in China now where outside Internet is spotty these days, so that may explain my taking longer to get back to you.) |
It doesn’t matter, I’m in China too. |
The new message seems to imply that end of line with a hyphen in the description is invalid. For example: /**
* @param foo
* The quick brown fox jumps -
* over a lazy dog. ^
*/ but in fact this is not the case. |
108d013
to
f0f18f8
Compare
…, disallow hyphen at end of line; fixes gajus#1435
f0f18f8
to
931f093
Compare
Good point. I've amended to "There must be no hyphen followed by newline in the first line of a @param description." Does that work? |
feat(
require-hyphen-before-param-description
): whenalways
is set, disallow hyphen at end of line; fixes #1435