Closed
Description
See reproduction at: https://github.com/IAmRGroot/reproduction-vue. I'm using Vue 2 with Composition API + Script Setup.
Steps:
- Add JSON usage to a template:
<template>
<div>
{{ JSON.stringify({ test: 'test'}) }}
</div>
</template>
- Run eslint with 'no-obj-calls' rule
npm run lint
Error:
Oops! Something went wrong! :(
ESLint: 8.15.0
TypeError: Cannot read properties of undefined (reading 'parent')
Occurred while linting /app/src/App.vue:9
Rule: "no-obj-calls"
at isPassThrough (/app/node_modules/eslint-utils/index.js:1461:25)
at ReferenceTracker._iteratePropertyReferences (/app/node_modules/eslint-utils/index.js:1676:16)
at _iteratePropertyReferences.next (<anonymous>)
at ReferenceTracker._iterateVariableReferences (/app/node_modules/eslint-utils/index.js:1659:29)
at _iterateVariableReferences.next (<anonymous>)
at ReferenceTracker.iterateGlobalReferences (/app/node_modules/eslint-utils/index.js:1517:25)
at iterateGlobalReferences.next (<anonymous>)
at Program (/app/node_modules/eslint/lib/rules/no-obj-calls.js:74:41)
at ruleErrorHandler (/app/node_modules/eslint/lib/linter/linter.js:1114:28)
at /app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
Reverting to vue-eslint-parser@^8 or moving the JSON call to the script prevents the error:
<template>
<div>
{{ json }}
</div>
</template>
<script lang="ts" setup>
import { computed } from '@vue/composition-api';
const json = computed(() => JSON.stringify({ test: 'test'}))
</script>
Metadata
Metadata
Assignees
Labels
No labels