Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update from 0.4.0 to 0.5.0: no-unused-vars returns TypeError: Cannot use 'in' operator to search for 'type' in undefined #472

Closed
TimGuendel opened this issue Aug 5, 2024 · 14 comments

Comments

@TimGuendel
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v20.14.0
  • Nuxt Version: 3.12.4
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.7
  • Package Manager: yarn@4.3.0
  • Builder: -
  • User Config: telemetry, experimental, components, nitro, imports, vite, css, devtools, debug, modules, pinia, postcss, cookieControl, runtimeConfig, compatibilityDate
  • Runtime Modules: @vueuse/nuxt@10.11.0, @pinia/nuxt@0.5.2, @pinia-plugin-persistedstate/nuxt@1.2.1, nuxt-jsonld@2.0.8, @nuxt/image@1.7.0, @zadigetvoltaire/nuxt-gtm@0.0.13, @dargmuesli/nuxt-cookie-control@8.4.6, @nuxt/test-utils/module@3.13.1, @nuxt/eslint@0.5.0, @vee-validate/nuxt@4.13.2

Package

@nuxt/eslint

Reproduction

N/A

Describe the bug

After updating from 0.4.0 to 0.5.0: no-unused-vars returns

TypeError: Cannot use 'in' operator to search for 'type' in undefined.

Line 133 is always the first line after <script setup lang="ts">

Additional context

No response

Logs

No response

@antfu
Copy link
Member

antfu commented Aug 19, 2024

We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info.
Please provide a minimal reproduction to reopen the issue.
Thanks.

Why reproduction is required

@antfu antfu closed this as completed Aug 19, 2024
@zigcccc
Copy link

zigcccc commented Aug 30, 2024

I'm seeing this as well:
image

It's not happening in all files, just some.

TS version: ~5.3.3
typescript-eslint: ^8.2.0
eslint-plugin-unused-imports: ^4.1.3

@TimGuendel
Copy link
Author

I too am stil getting this error. This is the whole message:

[info] Using yup with vee-validate
[success] Types generated in .nuxt

Oops! Something went wrong! :(

ESLint: [9](https://github.com/ecommercedb/frontend-web-2/actions/runs/10628890600/job/29464609458?pr=610#step:4:10).9.1

TypeError: Cannot use 'in' operator to search for 'type' in undefined
Occurred while linting /home/runner/work/frontend-web-2/frontend-web-2/components/charts/ChartContainer.vue:[13](https://github.com/ecommercedb/frontend-web-2/actions/runs/10628890600/job/29464609458?pr=610#step:4:14)3
Rule: "@typescript-eslint/no-unused-vars"
    at UnusedVarsVisitor.markVariableAsUsed (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@nuxt/eslint-config/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:92:22)
    at UnusedVarsVisitor.TSMappedType (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@nuxt/eslint-config/node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js:235:[14](https://github.com/ecommercedb/frontend-web-2/actions/runs/10628890600/job/29464609458?pr=610#step:4:15))
    at UnusedVarsVisitor.visit (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:59:21)
    at UnusedVarsVisitor.visitChildren (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:46:22)
    at UnusedVarsVisitor.visit (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:64:14)
    at UnusedVarsVisitor.visitChildren (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:46:22)
    at UnusedVarsVisitor.visit (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:64:14)
    at UnusedVarsVisitor.visitChildren (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:46:[22](https://github.com/ecommercedb/frontend-web-2/actions/runs/10628890600/job/29464609458?pr=610#step:4:23))
    at UnusedVarsVisitor.visit (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:64:14)
    at UnusedVarsVisitor.visitChildren (/home/runner/work/frontend-web-2/frontend-web-2/node_modules/@typescript-eslint/scope-manager/dist/referencer/VisitorBase.js:41:30)
Error: Process completed with exit code 2.

@TimGuendel
Copy link
Author

If it helps, this is the same error: typescript-eslint/typescript-eslint#9719
I am still getting it when updating from "@nuxt/eslint": "^0.4.0" to "@nuxt/eslint": "^0.5.6"

@hugotiburtino
Copy link

Same here

Reproduction steps:

  1. Clone serlo/api.serlo.org, go to the branch of this PR and run yarn
  2. Add "@typescript-eslint/no-duplicate-enum-values": "off", to .eslintrc.json (to avoid another very strange error)
  3. Run yarn list:eslint

@TimGuendel
Copy link
Author

TimGuendel commented Sep 12, 2024

We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. Please provide a minimal reproduction to reopen the issue. Thanks.

Why reproduction is required

So can this be reopened @antfu ? 🤔

@Marcin-XStudio
Copy link

Any updates on this? I"m getting the same error

@deim0707
Copy link

It's still relevant today.

@antfu
Copy link
Member

antfu commented Oct 28, 2024

This seems to be an upstream issue with ts-eslint, yet there doesn't seem to be a valid minimal reproduction here or even in typescript-eslint/typescript-eslint#9719

If you do find a minimal reproduction, please open a new issue.

@antfu antfu closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2024
@nwparker
Copy link

Try updating your @typescript-eslint/* dependencies, this helped for me

@vaynevayne
Copy link

Try updating your @typescript-eslint/* dependencies, this helped for me

newest is 8.14.0, issue is still exist

@TimGuendel
Copy link
Author

Same for me - just updated from 0.4.0 to 0.6.1.

@TimGuendel
Copy link
Author

@vaynevayne @deim0707 I think I found the culprit:

    languageOptions: {
        parserOptions: {
            // parser: '@typescript-eslint/parser',
        },
    },

When commenting out the parser line, the error disappears. I don't know why we had this in the config in the first place. If it helps... 👀

@pranavmappoli
Copy link

Any update on the issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants