-
-
Notifications
You must be signed in to change notification settings - Fork 799
Add new rule: no-generic-link-name
#1459
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
Conversation
I'm not sure how to interpret this failure:
I'd appreciate pointers! |
Great! I'll make a first pass review later tonight. Regarding the test failure you ask about, I think it is due to the trailing commas added to the new configuration comment at the bottom of test/long-lines-long-reference-definitions.md. JSON does not allow trailing commas. In general, I think this would be the first built-in rule which only works in a single language (English) in its default configuration. I'm not sure how I feel about that... Certainly, all the documentation is in English because that's all I know and it's fairly common as a default language in the industry for documentation and code. However, to have the linting tool itself start to "favor" one language over another feels a little weird? I'm open to counter-arguments or examples of another built-in rule that behaves like this. At the same time, having this rule default to an empty list would make it less useful. (Though there is precedent for that, see MD044/proper-names.) I do not think I want to start maintaining multiple translations for the phrase list because there are a lot of languages out there and I can only validate English for correctness. |
I was curious how a similar-ish project handled this situation: get-alex/alex#202 Ugh, that is not really a road I went to start down. My current thinking is to do something similar to MD044/proper-names and default this rule to an empty list. I'm still open to feedback, though! |
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.
Okay, it may look like a lot, but most of the changes are pretty small. :) Thanks for starting this out - let's continue the conversation around naming and default value in the body of the PR.
…d simplify slightly.
Bumps [eslint](https://github.com/eslint/eslint) from 9.17.0 to 9.18.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v9.17.0...v9.18.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.12.1 to 2.13.0. - [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases) - [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.13.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@stylistic/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [json-schema-to-typescript](https://github.com/bcherny/json-schema-to-typescript) from 15.0.3 to 15.0.4. - [Changelog](https://github.com/bcherny/json-schema-to-typescript/blob/master/CHANGELOG.md) - [Commits](https://github.com/bcherny/json-schema-to-typescript/commits) --- updated-dependencies: - dependency-name: json-schema-to-typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
…ate and export resolveModule helper from markdownlint-cli2.
addErrorContext( | ||
onError, | ||
labelText.startLine, | ||
text, |
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.
- errorContext: `[click␍␊
+ errorContext: `[click␊
here]`,
I can't figure out why Windows behaves differently and returns a different text
for the link test case with a line break. Curious if you might have any ideas @DavidAnson.
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.
This looks like a \r\n vs. \n line ending difference. If you're getting this error, it's reporting an error that spans multiple lines. I left a comment about preventing that by checking startLine and endLine of the span. (See my comment on the main chat before spending time on this.)
Hey @DavidAnson! I believe I've addressed all your comments now. I have one remaining issue I'd appreciate your eyes on - #1459 (comment). |
Thank you! I replied to that open issue above. (FYI, I may not get back to this for a couple of days.) At this stage in the process, I'll make another/final pass over the entire change. It's likely I'll have more nitpicks. Are you okay with me applying them to your PR here? What I typically do is squash the author's comments into one (attributed to then) with a following commit by me titled something like "final tweaks for previous commit". Unless you enjoy my nitpicking, this is probably the most efficient option. :) One thing I'll do is review every new violation in test-repos. Skimming that now, it looks like the vast majority are "here" and "link" which is expected (plus a couple of "more"s). However, there are about 20 like this in mdn which deserve better understanding. If you beat me to that, please reply here with your thoughts:
|
Hey @DavidAnson! Sorry for the delay here!
Yep, I'm totally fine with you applying changes here! I haven't addressed the failing test yet - let me know if you'd like me to follow-up there, or with anything else.
It looks like the linter is flagging link texts with Right now, we're stripping all non-alphanumeric characters in order with the intent to flag texts like |
no-generic-link-name
no-generic-link-name
In the mdn scenario, it's |
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.
Accepting PR into a dedicated branch for final review.
this addresses errors observed by dependabot when upgrading to the latest version of `markdownlint`. there is a new lint, added in DavidAnson/markdownlint#1459, that introduces forbidden link text to discourage generic `here` text in links. this fixes sentences that included a link labeled "here". * #3918 * https://github.com/linkerd/linkerd2-proxy/actions/runs/15043224730/job/42279610780?pr=3918 * https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md * DavidAnson/markdownlint#1459 * DavidAnson/markdownlint#681 ``` Summary: 3 error(s) Error: docs/FUZZING.md:17:13 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: docs/FUZZING.md:100:2 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: README.md:90:2 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: Failed with exit code: 1 ``` Signed-off-by: katelyn martin <[email protected]>
this addresses errors observed by dependabot when upgrading to the latest version of `markdownlint`. there is a new lint, added in DavidAnson/markdownlint#1459, that introduces forbidden link text to discourage generic `here` text in links. this fixes sentences that included a link labeled "here". * #3918 * https://github.com/linkerd/linkerd2-proxy/actions/runs/15043224730/job/42279610780?pr=3918 * https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md * DavidAnson/markdownlint#1459 * DavidAnson/markdownlint#681 ``` Summary: 3 error(s) Error: docs/FUZZING.md:17:13 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: docs/FUZZING.md:100:2 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: README.md:90:2 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: Failed with exit code: 1 ``` Signed-off-by: katelyn martin <[email protected]>
* chore(docs): address `no-generic-link-test` lint (#3923) this addresses errors observed by dependabot when upgrading to the latest version of `markdownlint`. there is a new lint, added in DavidAnson/markdownlint#1459, that introduces forbidden link text to discourage generic `here` text in links. this fixes sentences that included a link labeled "here". * #3918 * https://github.com/linkerd/linkerd2-proxy/actions/runs/15043224730/job/42279610780?pr=3918 * https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md * DavidAnson/markdownlint#1459 * DavidAnson/markdownlint#681 ``` Summary: 3 error(s) Error: docs/FUZZING.md:17:13 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: docs/FUZZING.md:100:2 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: README.md:90:2 MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md Error: Failed with exit code: 1 ``` Signed-off-by: katelyn martin <[email protected]> * build(deps): bump DavidAnson/markdownlint-cli2-action (#3923) Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 19.1.0 to 20.0.0. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](DavidAnson/markdownlint-cli2-action@05f3221...992badc) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: 20.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> --------- Signed-off-by: katelyn martin <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
||
Parameters: | ||
|
||
- `link_texts`: List of restricted link texts (`string[]`, default `[]`) |
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.
The default is documented as []
here, but the defaultBannedText
array contains entries.
What's the intended behavior? Default or no default?
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.
Sorry, this is an error in the documentation, I'll fix it soon.
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.
Actually, this is correct as implemented in the current release - you were maybe looking at an early version.
https://github.com/DavidAnson/markdownlint/blob/main/doc/md059.md
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.
oh perfect. sorry for the false alert!
Closes: #681
This PR introduces a new lint rule to discourage generic, unhelpful link names. More context in linked issue!
While this rule has a default set of "banned names", consumers have the option to override the default and set their own banned words through the
link_texts
config if they'd like.