gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.1k stars 160 forks source link

jsdoc/require-jsdoc do not recgonize the export typr #1319

Closed IsaacIsrael closed 2 months ago

IsaacIsrael commented 2 months ago

Expected behavior


type Props = {
  readyonly variant:  string
}

export type { Props as ComponentProps };

Actual behavior


// Do not recognize as error to pe enter the documentation
type Props = {
  readyonly variant:  string
}

export type { Props as ComponentProps };

ESLint Config

{
"jsdoc/require-throws": "error",
      "jsdoc/check-indentation": "warn",
      "jsdoc/no-blank-blocks": "warn",
      "jsdoc/require-asterisk-prefix": "warn",
      "jsdoc/require-description": "warn",
      "jsdoc/sort-tags": "warn",
      "jsdoc/check-syntax": "warn",
      "jsdoc/tag-lines": ["warn", "never", { startLines: 1 }],
      "jsdoc/require-param": ["warn", { checkDestructuredRoots: false }],
      "jsdoc/require-jsdoc": [
        "warn",
        {
          publicOnly: { ancestorsOnly: false},
          require: {
            FunctionDeclaration: true,
            FunctionExpression: true,
            ArrowFunctionExpression: true,
            ClassDeclaration: true,
            ClassExpression: true,
            MethodDefinition: true,
          },
          contexts: [
            "VariableDeclaration",
            "TSTypeAliasDeclaration",
            // Encourage documenting React prop types
            "TSPropertySignature",
            "TSInterfaceDeclaration",
            "TSMethodSignature",
            "TSEnumDeclaration"
          ],
          enableFixer: true,
        },
      ],
      // tsdoc checks this syntax instead
      "jsdoc/require-hyphen-before-param-description": "off",
      "jsdoc/require-returns": "off",
}

Environment

brettz9 commented 2 months ago

You have ancestorsOnly set, so it wouldn't find it anyways (that is an optimization to only find if the node is directly nested inside an export). Setting it instead to esm: true should in theory work, but it indeed does look like that is a bug. #1320 will hopefully address.

IsaacIsrael commented 2 months ago

he @brettz9 thank for the feedback but this did not worked for me :(

brettz9 commented 2 months ago

There was a bug and I provided a fix, but the release did not successfully go through. @gajus ?

github-actions[bot] commented 2 months ago

:tada: This issue has been resolved in version 50.2.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

gajus commented 2 months ago

Looks like releases broke in this commit/PR

https://github.com/gajus/eslint-plugin-jsdoc/commit/239d69aafff5462852a4c73c2ea4ab0a2e84a35c

Reverted and it works