question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: 'this.libOptions.parse is not a function' error after upgrading to ESLint 8.23.0

See original GitHub issue

Environment

Node version: 16.17.0 npm version: 8.18.0 Local ESLint version: 8.23.0 Global ESLint version: none Operating System: Windows 10 x64 21H2

What parser are you using?

Default (Espree)

What did you do?

Configuration
{
  "parserOptions": {
    "sourceType": "module",
    "ecmaVersion": 2020
  },
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "rules": {
    "linebreak-style": ["error", "windows"]
  }
}
console.log('Hello!');

What did you expect to happen?

The ESLint error should not be displayed in Jetbrain IDE(IntelliJ Webstorm), and the grammar check should proceed properly.

What actually happened?

image

Reproduce GitHub repo: https://github.com/jooy2/eslint-liboptions-parse-is-not-a-function

I don’t know if this is only happening in the IntelliJ Webstorm IDE, but it worked fine in the old environment and I haven’t modified any other settings in the recent IDE.

After upgrading ESLint to 8.23.0, the check fails with the following error in the IDE:

TypeError: this.libOptions.parse is not a function
    at ESLint8Plugin.<anonymous> (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:139:64)
    at step (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:44:23)
    at Object.next (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:25:53)
    at C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:15:12)
    at ESLint8Plugin.invokeESLint (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:133:16)
    at ESLint8Plugin.<anonymous> (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:120:44)
    at step (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:44:23)
    at Object.next (C:\Program Files\JetBrains\WebStorm 2020.2.2\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:25:53)
Process finished with exit code -1

Even with only the eslint package installed, the problem occurs whether the .eslintrc file exists or not.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:28
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

40reactions
mdjermanoviccommented, Aug 27, 2022

Thanks for all the details!

WebStorm Plugin Source

https://gist.github.com/prescience-data/fa82f9b26e00cd74be8ea262b3048f08#file-eslint8-plugin-ts-L21

Per this line of code, it seems that the plugin is reaching into the eslint package to load an internal module. ESLint’s public API is defined in package.exports. Since the lib/options.js module isn’t public, its API can change in non-major versions, as it did in the latest version v8.23.0.

I think this problem should be fixed on the plugin’s side, and there’s already a raised issue in the JetBrains’ issue tracker:

https://youtrack.jetbrains.com/issue/WEB-57089/ESLint823-TypeError-thislibOptionsparse-is-not-a-function

10reactions
prescience-datacommented, Aug 27, 2022

Also just received this after upgrading:

Error Message

TypeError: this.libOptions.parse is not a function

TypeError: this.libOptions.parse is not a function
    at ESLint8Plugin.<anonymous> (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:139:64)
    at step (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:44:23)
    at Object.next (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:25:53)
    at C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:15:12)
    at ESLint8Plugin.invokeESLint (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:133:16)
    at ESLint8Plugin.<anonymous> (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:120:44)
    at step (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:44:23)
    at Object.next (C:\Users\****\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.3739.57\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint8-plugin.js:25:53)
Process finished with exit code -1

Error Root

WebStorm Plugin Source

https://gist.github.com/prescience-data/fa82f9b26e00cd74be8ea262b3048f08#file-eslint8-plugin-ts-L21

Recent Commit

https://github.com/eslint/eslint/commit/3e5839ecae96aecfbc1ac9526e88e0105e671032#diff-358c9491edc00f0db6f2f3c317df9aa932135803481b86c9289bd56bf8af0622L66

Context

  • Node: 16.17.0
  • OS: Windows 11
  • Local ESLint: ^8.23.0
  • Global ESLint: none
  • IDE: WebStorm 2022.2.1

ESLint Plugins

{
    "@rushstack/eslint-config": "^3.0.0",
    "@typescript-eslint/eslint-plugin": "^5.35.1",
    "@typescript-eslint/parser": "^5.35.1",
    "eslint": "^8.23.0",
    "eslint-plugin-prefer-arrow": "^1.2.3",
    "eslint-plugin-simple-import-sort": "^7.0.0",
    "eslint-plugin-tsdoc": "^0.2.16"
}

Config

module.exports = {
  env: {
    node: true
  },
  ignorePatterns: [
    "**/*.d.ts",
    "build.ts",
    "bin",
    "dist",
    "lib",
    "test",
    "vite",
    "tsup.config.ts"
  ],
  parserOptions: {
    parser: "@typescript-eslint/parser"
  },
  plugins: ["simple-import-sort", "prefer-arrow", "eslint-plugin-tsdoc"],
  rules: {
    "@rushstack/no-new-null": "off",
    "@typescript-eslint/member-ordering": "error",
    "@typescript-eslint/naming-convention": ["warn", tsNamingConvention],
    "@typescript-eslint/no-floating-promises": when("test"),
    "@typescript-eslint/no-non-null-assertion": "warn",
    "@typescript-eslint/no-unused-vars": ["error"],
    "@typescript-eslint/typedef": "off",
    "arrow-body-style": ["error", "as-needed"],
    "block-spacing": "error",
    "import/order": "off",
    "lines-around-comment": ["error", linesAroundComment],
    "no-console": when("production"),
    "no-debugger": when("production"),
    "no-return-await": "error",
    "no-unused-vars": "off",
    "object-curly-spacing": ["error", "always"],
    "prefer-arrow/prefer-arrow-functions": ["error", preferArrowFunctions],
    "simple-import-sort/exports": "error",
    "simple-import-sort/imports": ["error", simpleImportSort],
    "tsdoc/syntax": "error"
  },
  // Pattern specific overrides.
  overrides: [
    {
      files: ["**/*.ts"],
      parserOptions: {
        project: ["./tsconfig.json"]
      },
      rules: {
        "@typescript-eslint/consistent-type-imports": ["error", {}],
        "@typescript-eslint/consistent-type-exports": [
          "error",
          { fixMixedExportsWithInlineTypeSpecifier: true }
        ]
      }
    },
    {
      files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
      parser: "espree",
      parserOptions: {
        ecmaVersion:  6
      },
      rules: {
        "@typescript-eslint/naming-convention": "off",
        "tsdoc/syntax": "off"
      }
    },
    {
      files: ["*.md", "**/*.md"],
      parser: "markdown-eslint-parser"
    }
  ]
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint@8.23: TypeError: this.libOptions.parse is not a function
1. Updated ESLint to 8.23.0 2. Upon lint a file, ESLint failed with the following error: this.libOptions.parse is not a function
Read more >
ESLint: TypeError: this.libOptions.parse is not a function
I created a new Next.js project with TypeScript enabled, and that's all. The error is shown below: TypeError: this.libOptions.parse is not a ......
Read more >
ESLint: TypeError: this.libOptions.parse is not a function | by ...
After that update your project to get back to 8.22 instead of 8.23, i.e.. remove node_modules folder; clean package-lock.json (by removing it too);...
Read more >
typeerror: this.liboptions.parse is not a function - You.com
Solution 1: Downgrade eslint to eslint@8.22.0 When I was Researching about this error I found that eslint 's latest version 8.23 is the...
Read more >
@typescript-eslint/parser - npm
See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found