October 22, 2024
Chicago 12, Melborne City, USA
javascript

TypeError: Cannot read properties of undefined (reading 'type') after eslint update


I try to update my project to use the newest 9.12.0 eslint instead of 8.54.0 which I currently use. I did the necessary config migration from .eslintrc.json to eslint.config.mjs. When I run eslint src on my local machine with node version 22.9.0 and yarn 1.22.22 it works perfectly fine – howver when I run exactly the same code on gitlab runner using docker node:22.9.0-slim image I get

$ eslint src
Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
Oops! Something went wrong! :(
ESLint: 9.12.0
TypeError: Cannot read properties of undefined (reading 'type')
Occurred while linting /builds/xxx/voll/products/cc/simple/src/components/CampaignInfo.tsx:1
Rule: "@typescript-eslint/no-unused-vars"
    at isReadForItself (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:562:22)
    at /builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:583:27
    at Array.some (<anonymous>)
    at isUsedVariable (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:582:32)
    at UnusedVarsVisitor.collectUnusedVariables (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:124:21)
    at UnusedVarsVisitor.collectUnusedVariables (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:133:18)
    at UnusedVarsVisitor.collectUnusedVariables (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:50:36)
    at collectVariables (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:603:30)
    at collectUnusedVariables (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js:279:65)
    at Program:exit (/builds/xxx/voll/products/cc/simple/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js:423:36)
error Command failed with exit code 2.

I compared all the deps versions using yarn list and all of them are the same; I checked that node/yarn version are the same.

How is it possible that it’s working on my local machine but it doesn’t work when I run it using gitlab runner ?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video