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

chore: ran eslint-plugin-jsdoc/check-tag-names autofixer on fibjs #65315

Conversation

JoshuaKGoldberg
Copy link
Collaborator

Context: Part of part of #648, porting old TSLint rules to ESLint equivalents. Within migrating no-redundant-jsdoc2, this runs the auto-fixer from jsdoc/check-tag-names. This PR splits out specifically fibjs types from #65080, per #65080 (comment).

jsdoc/check-tag-names reports on JSDoc tags that are unnecessary. Here, we're using its { typed: true } option to look for JSDoc tags that are redundant in TypeScript.

I used a very permissive ESLint config to avoid flagging library-specific tags or switching tag names unnecessarily (e.g. @return to @returns)
{
    "root": true,
    "extends": [],
    "parser": "@typescript-eslint/parser",
    "plugins": ["@typescript-eslint", "jsdoc"],
    "rules": {
      "jsdoc/check-tag-names": [
        "error",
        {
          "definedTags": [
            "addVersion",
            "api",
            "author",
            "beta",
            "brief",
            "category",
            "cfg",
            "chainable",
            "check",
            "classDescription",
            "condparamprivilege",
            "constraint",
            "credits",
            "declaration",
            "defApiFeature",
            "defaultValue",
            "detail",
            "end",
            "eventproperty",
            "experimental",
            "export",
            "expose",
            "extendscript",
            "factory",
            "field",
            "final",
            "fixme",
            "fluent",
            "for",
            "governance",
            "header",
            "hidden-property",
            "hidden",
            "id",
            "label",
            "language",
            "link",
            "listen",
            "locus",
            "methodOf",
            "minVersion",
            "ngdoc",
            "nonstandard",
            "note",
            "npm",
            "observable",
            "option",
            "optionobject",
            "options",
            "packageDocumentation",
            "param",
            "parent",
            "platform",
            "plugin",
            "preserve",
            "privateRemarks",
            "privilegeLevel",
            "privilegeName",
            "proposed",
            "range",
            "readOnly",
            "related",
            "remark",
            "remarks",
            "required",
            "requires",
            "restriction",
            "returnType",
            "section",
            "see",
            "since",
            "const",
            "singleton",
            "source",
            "struct",
            "suppress",
            "targetfolder",
            "enum",
            "title",
            "record",
            "title",
            "TODO",
            "trigger",
            "triggers",
            "typeparam",
            "typeParam",
            "unsupported",
            "url",
            "usage",
            "warn",
            "warning",
            "version"
          ],
          "typed": true
        }
      ]
    },
    "settings": {
        "jsdoc": {
            "tagNamePreference": {
                "argument": "argument",
                "exception": "exception",
                "function": "function",
                "method": "method",
                "param": "param",
                "return": "return",
                "returns": "returns"
            }
        }
    }
  }

Starting off as a draft so we can discuss what changes might need to be made to check-tag-names. Each classification of change has a comment thread inline.

@typescript-bot typescript-bot added this to Needs Author Action in New Pull Request Status Board Apr 27, 2023
* @readonly
* @type Stream
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's generally no need to explicitly indicate @type of anything that's already given a type annotation in TypeScript. It's not generally picked up well by tooling, and is sometimes inaccurate. For example, the Stream type here is a human nickname for the actual Class_Stream type. And later on String is used instead of string.

* @readonly
* @type Integer
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the @type actually did add useful information (TypeScript doesn't have a way to represent numbers that are only ever integers). So I manually preserved the info as a @note.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review April 27, 2023 15:39
@typescript-bot
Copy link
Contributor

typescript-bot commented Apr 27, 2023

@JoshuaKGoldberg Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a huge PR, it can be merged once it's reviewed by a DT maintainer.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Only a DT maintainer can approve changes without tests

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.

Inactive

This PR has been inactive for 6 days.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 65315,
  "author": "JoshuaKGoldberg",
  "headCommitOid": "35e83d2f55140733daf324b4de5ba1aaec98daea",
  "mergeBaseOid": "6541af894623648445612b1247da6036fc974285",
  "lastPushDate": "2023-04-27T15:29:24.000Z",
  "lastActivityDate": "2023-05-05T11:15:44.000Z",
  "mergeOfferDate": "2023-04-28T19:40:55.000Z",
  "mergeRequestDate": "2023-05-05T11:15:44.000Z",
  "mergeRequestUser": "JoshuaKGoldberg",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": true,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "fibjs",
      "kind": "edit",
      "files": [
        {
          "path": "types/fibjs/declare/BufferedStream.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Cipher.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/DbConnection.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Digest.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/EventEmitter.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/EventInfo.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Fiber.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/File.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HeapGraphEdge.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HeapGraphNode.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpClient.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpCookie.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpHandler.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpMessage.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpRequest.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpResponse.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpServer.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpUploadData.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/HttpsServer.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Image.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Int64.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/LruCache.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Message.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/MySQL.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/PKey.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/SQLite.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/SandBox.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Service.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Smtp.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Socket.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/SslHandler.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/SslServer.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/SslSocket.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/Stat.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/StringDecoder.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/SubProcess.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/UrlObject.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/WebSocket.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/WebSocketMessage.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/X509Cert.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/X509Req.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlAttr.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlCharacterData.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlDocument.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlDocumentType.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlElement.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlNamedNodeMap.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlNode.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlNodeList.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/XmlProcessingInstruction.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/fibjs/declare/ZmqSocket.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "richardo2016"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "gabritto",
      "date": "2023-04-28T19:40:14.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 1525922360,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added Untested Change This PR does not touch tests Huge Change labels Apr 27, 2023
@typescript-bot
Copy link
Contributor

Hey @JoshuaKGoldberg,

😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module.

This can potentially save days of time for you!

@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board Apr 27, 2023
@typescript-bot
Copy link
Contributor

🔔 @richardo2016 — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Apr 28, 2023
@typescript-bot
Copy link
Contributor

@JoshuaKGoldberg: Everything looks good here. I am ready to merge this PR (at 35e83d2) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@richardo2016: you can do this too.)

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board Apr 28, 2023
@JoshuaKGoldberg
Copy link
Collaborator Author

I've set a reminder for a week from now to make the comment, to give @richardo2016 some time. Just in case 😄

@richardo2016
Copy link
Contributor

🔔 @richardo2016 — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

Hi, I'm sorry to deal with this PR so late.

On the other handle, I didn't see the Approve or Request Changes buttons on the web page, do you mean Approving this PR? If so, I have to say I have no permission to approve this PR. But I think it's OK to merge those changes in this PR. @JoshuaKGoldberg

@JoshuaKGoldberg
Copy link
Collaborator Author

No rush on my account, thanks!

@JoshuaKGoldberg
Copy link
Collaborator Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board May 5, 2023
@typescript-bot typescript-bot merged commit fc02883 into DefinitelyTyped:master May 5, 2023
2 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the eslint-prep-jsdoc-check-tag-names-fibjs branch May 5, 2023 11:33
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board May 5, 2023
Desplandis pushed a commit to Desplandis/DefinitelyTyped that referenced this pull request Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Huge Change Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner Untested Change This PR does not touch tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants