eslint-plugin-jsdoc icon indicating copy to clipboard operation
eslint-plugin-jsdoc copied to clipboard

custom context iteration issue

Open brettz9 opened this issue 3 years ago • 0 comments
trafficstars

Expected behavior

The sample should fail require-param (due to a @param missing).

Actual behavior

The issue passes.

(The issue is apparently due to some caching of.comment nodes in trackedJsdocs; since the JS node differs and the rule uses the JS node, this can create problems for some rules which look at more than the comment node.)

ESLint Config

// Format JS (or JSON) code here

ESLint sample

{
      code: `
      /**
       * Helper function to warp to a custom stage/level.
       *
       * Custom stages/levels must first be defined in the "tsconfig.json" file. See the documentation for
       * more details: https://isaacscript.github.io/main/custom-stages/
       *
       * @param name The name of the custom stage, corresponding to what is in the "tsconfig.json" file.
       * @param firstFloor Optional. Whether to go to the first floor or the second floor. For example, if
       *                   you have a custom stage emulating Caves, then the first floor would be Caves 1,
       *                   and the second floor would be Caves 2. Default is true.
       */
       export function setCustomStage(
         name: string,
         firstFloor = true,
         verbose = false,
       ): void {}
       `,
      ignoreReadme: true,
      options: [
        {
          contexts: [
            'any',
          ],
        },
      ],
      parser: require.resolve('@typescript-eslint/parser'),
    },

Environment

  • Node version: 14.19.1
  • ESLint version 8.16.0
  • eslint-plugin-jsdoc version: 39.3.5

brettz9 avatar Aug 08 '22 21:08 brettz9