Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Rule request: informative-docs #457

Closed
JoshuaKGoldberg opened this issue Jul 15, 2018 · 1 comment
Closed

Rule request: informative-docs #457

JoshuaKGoldberg opened this issue Jul 15, 2018 · 1 comment
Assignees
Labels
Difficulty: Medium People with non-trivial experience in TSLint should be able to send a pull request for this issue. Microsoft Internal Issues related to closed source Microsoft code. Type: Rule Suggestion Adding a new rule that doesn't yet exist here or in TSLint core.
Milestone

Comments

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Jul 15, 2018

TypeScript code being linted

/**
 * Request metadata.
 */
interface IRequestMetadata {
    /**
     * The user id
     */
    userId: string;
}

with tslint.json configuration:

{
    "rules": {
        "completed-docs": true
    }
}

Actual behavior

Many teams require all things be documented, such as with TSLint core's completed-docs. The idea of requiring code be well-documented is nice, but you end up with the above useless comments.

Expected behavior

It'd be nice to have a rule that requires the documentation for something not be equivalent to just the thing's name. If we strip out non-alphabet characters, common words such as "the" or "a", and lowercase everything, they shouldn't be the same.

Posting here instead of TSLint core, as I expect this is too opinionated for the core ruleset.

@JoshuaKGoldberg JoshuaKGoldberg added Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Type: Rule Suggestion Adding a new rule that doesn't yet exist here or in TSLint core. labels Jul 15, 2018
@JoshuaKGoldberg JoshuaKGoldberg changed the title Rule request: completed-docs Rule request: informative-docs Jul 15, 2018
@JoshuaKGoldberg JoshuaKGoldberg added Difficulty: Medium People with non-trivial experience in TSLint should be able to send a pull request for this issue. and removed Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! labels Jul 30, 2018
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Oct 8, 2018
@JoshuaKGoldberg JoshuaKGoldberg added Microsoft Internal Issues related to closed source Microsoft code. and removed Status: Accepting PRs labels Oct 8, 2018
@JoshuaKGoldberg
Copy link
Author

I have a working version of this internally and will post it here soon.

JoshuaKGoldberg pushed a commit that referenced this issue Oct 14, 2018
For any JSDoc comment on something with a name, if the comment only rephrases the name, this complains. Takes in configurable word aliases and a list of "useless" words that don't add to comments. I expect we'll slowly find more words to add to those defaults.

Fixes #457.
JoshuaKGoldberg pushed a commit that referenced this issue Oct 23, 2018
* Added an InformativeDocsRule

For any JSDoc comment on something with a name, if the comment only rephrases the name, this complains. Takes in configurable word aliases and a list of "useless" words that don't add to comments. I expect we'll slowly find more words to add to those defaults.

Fixes #457.

* Merge branch 'master'

* Fixed a couple of lint complaints

* Added README.md comments

* Correctly added metadata for rule

* Added auto-generated tslint-warnings.csv
@JoshuaKGoldberg JoshuaKGoldberg added this to the 6.0.0-beta0 milestone Nov 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Medium People with non-trivial experience in TSLint should be able to send a pull request for this issue. Microsoft Internal Issues related to closed source Microsoft code. Type: Rule Suggestion Adding a new rule that doesn't yet exist here or in TSLint core.
Projects
None yet
Development

No branches or pull requests

1 participant