Skip to content

indexOf combined with the not equal to operator Exception #2779

Closed
@jevin98

Description

@jevin98

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 9.23.0
  • eslint-plugin-vue version: 10.0.0
  • Vue version: 3.3.13
  • Node version: 22.11.0
  • Operating System:

Please show your full configuration:

import antfu from "@antfu/eslint-config";

export default antfu(
  {
    vue: {
      overrides: {
        "vue/custom-event-name-casing": ["error", "kebab-case"],
      },
    },

    formatters: {
      markdown: "Prettier",
    },

    ignores: [
      "**/*.md",
      "docs/",
      "**/*.test.*",
      "**/*.d.ts",
    ],

    stylistic: {
      semi: true,
      quotes: "double",

    },

    rules: {
      "ts/no-unsafe-function-type": "off",
      "ts/prefer-literal-enum-member": "off"
    },
  },
);

What did you do?

<script setup lang="ts">

console.log([].indexOf(1) != -1);   
</script>

<template>
  <div></div>
</template>

What did you expect to happen?
In a normal js file, it will be linted as console.log([].includes(1));

What actually happened?

Repository to reproduce this issue

The vscode ide will freeze for a while, and then the final vue file will be linted as the following code

<script setup lang="ts">
console.log([].indexOf(1) != -1);   
</script>

<template>
  <div></div>
</template>.includes(1));
</script>

<template>
  <div/>
</template>.includes(1));
</script>

...

Please note The above code will generate more than 5000 lines repeatedly in the vue file.

<template>
  <div/>
</template>.includes(1));
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions