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.

@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
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
3 participants