Skip to content

Bug: Parsing error: Cannot set property index of Error which has only a getter #7597

@zWingz

Description

@zWingz

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

parser

Playground Link

https://github.com/zWingz/test-vue-eslint

Repro Code

<template>
  <div>1</div>
</template>
<script lang="tsx">
import { defineComponent } from 'vue'
  const test = 1;
    const b = 2;
      const test = defineComponent({
        props: {
          test: String,
        },
        render() {
          return <div>test</div>
        }
      })
</script>

ESLint Config

module.exports = {
  extends: [
    // add more generic rulesets here, such as:
    'eslint:recommended',
  ],
  parser: 'vue-eslint-parser',
  parserOptions: {
    parser: '@typescript-eslint/parser',
    ecmaVersion: 6,
    extraFileExtensions: ['.vue'],
    ecmaFeatures: {
      jsx: true,
    },
    project: true, // will work if disable this line
  },
  plugins: ['@typescript-eslint'],
}

tsconfig

{
  "compilerOptions": {
    "baseUrl": ".",
    "target": "es6",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "lib": ["esnext", "dom"],
  },
  "include": [
    "."
  ],
  "exclude": ["node_modules"]
}

Expected Result

image

Actual Result

image

Additional Info

enable or disable the project: true

image image

Versions

package version
@typescript-eslint/eslint-plugin latest
@typescript-eslint/parser latest
@typescript-eslint/rule-tester latest
@typescript-eslint/scope-manager latest
@typescript-eslint/typescript-estree latest
@typescript-eslint/type-utils latest
@typescript-eslint/utils latest
TypeScript X.Y.Z
ESLint X.Y.Z
node X.Y.Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternalThis issue is with another package, not typescript-eslint itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions