Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Mar 1, 2025

This updates the jsdoc/require-jsdoc rule to require documentation for:

  • Arrow functions.

    const myFunction = () => {
      // ...
    };
  • Class declarations.

    class MyClass {
      // ...
    }
  • TypeScript enum declarations.

    enum MyEnum {
      // ...
    };
  • Function expressions.

    const myFunction = function () {
      // ...
    };
  • TypeScript interface declarations.

    interface MyInterface {
      // ...
    };
  • Method definitions.

    const myObject = {
      myFunction() {
        // ...
      },
    };
  • TypeScript type alias declarations.

    type MyType = {
      // ...
    };
  • TypeScript property signatures.

    type MyType = {
      myProperty: string;
    };

Breaking changes

Each of the code blocks above was previously valid, but will now produce an error.

Closes #223.


Note

Expands jsdoc/require-jsdoc to require JSDoc on more JS/TS constructs and adds a brief doc comment to ConfigWithExtends.extends.

  • ESLint config (packages/base/src/index.mjs, packages/base/rules-snapshot.json):
    • Expand jsdoc/require-jsdoc from a simple enablement to a configured rule requiring docs for:
      • ArrowFunctionExpression, ClassDeclaration, FunctionDeclaration, FunctionExpression, MethodDefinition.
      • TS contexts: TSInterfaceDeclaration, TSTypeAliasDeclaration, TSEnumDeclaration, TSPropertySignature.
  • Types (packages/base/src/index.d.mts):
    • Add JSDoc for ConfigWithExtends.extends detailing supported shapes.

Written by Cursor Bugbot for commit e0efa13. This will update automatically on new commits. Configure here.

@Mrtenz Mrtenz requested review from a team as code owners March 1, 2025 11:29
@mcmire
Copy link
Contributor

mcmire commented Mar 21, 2025

Nice, I didn't realize it was this easy!

@Mrtenz Any place we've tried this out yet? If not I will try this out in core.

@Mrtenz
Copy link
Member Author

Mrtenz commented Mar 21, 2025

Nice, I didn't realize it was this easy!

@Mrtenz Any place we've tried this out yet? If not I will try this out in core.

@mcmire I've tried it in a small repo to make sure the rule works as expected, but I haven't tested it in core or snaps yet.

I expect there will be a lot of lint errors since this is quite strict, but that's something we can gradually tackle.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM! Maybe we should avoid merging this until after we cut a release for the non-breaking changes though

@Mrtenz Mrtenz marked this pull request as draft April 17, 2025 13:22
@Mrtenz Mrtenz force-pushed the mrtenz/update-jsdoc/require-jsdoc branch from fa9cd15 to e0efa13 Compare November 10, 2025 15:47
@Mrtenz Mrtenz marked this pull request as ready for review November 10, 2025 15:47
@Mrtenz Mrtenz requested a review from a team as a code owner November 10, 2025 15:47
@Mrtenz Mrtenz enabled auto-merge (squash) November 10, 2025 15:49
@Mrtenz Mrtenz merged commit c70a3ff into main Nov 10, 2025
26 checks passed
@Mrtenz Mrtenz deleted the mrtenz/update-jsdoc/require-jsdoc branch November 10, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify that type aliases and interfaces, as well as members for these, have documentation

4 participants