gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.08k stars 155 forks source link

[check-param-names] Error: "Cannot destructure property 'lines' of 'sourceCode'" #1159

Closed simon-abbott closed 10 months ago

simon-abbott commented 10 months ago

Expected behavior

The rule should run properly.

Actual behavior

ESLint crashes with the error TypeError: Error while loading rule 'jsdoc/check-param-names': Cannot destructure property 'lines' of 'sourceCode' as it is undefined.

ESLint Config

{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "impliedStrict": true
    },
    "warnOnUnsupportedTypeScriptVersion": true,
    "requireConfigFile": false,
    "allowImportExportEverywhere": true,
    "babelOptions": {
      "presets": ["next/babel"],
      "caller": {
        "supportsTopLevelAwait": true
      }
    },
    "ecmaVersion": "latest",
    "project": "./tsconfig.json"
  },
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/check-param-names": ["error"]
  }
}

ESLint sample

const foo = "";

Environment

simon-abbott commented 10 months ago

I tested 46.7.0 as well, and that worked just fine. I suspect it's an issue with 8dbcb6f31d8e75b6a12dc0cfa19ace736ed0e9c6.

github-actions[bot] commented 10 months ago

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

The release is available on:

Your semantic-release bot :package::rocket:

brettz9 commented 10 months ago

The method getSourceCode was deprecated and can be avoided in more recent versions of ESLint, but apparently the replacement hasn't been around for very long.