-
-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
feat: typescriptneeds reproNeed a repository that can reproduce the problem, or a link to DEMO.Need a repository that can reproduce the problem, or a link to DEMO.
Description
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: 8.52.0
- eslint-plugin-vue version: 9.18.0
- Node version: 18
- Operating System: Apple
Please show your full configuration:
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution');
module.exports = {
root: true,
extends: [
'plugin:vue/vue3-recommended',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
overrides: [
{
files: ['cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'],
extends: ['plugin:cypress/recommended']
}
],
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' }
],
'vue/no-v-html': 'off',
'vue/multi-word-component-names': 'off',
'vue/no-setup-props-destructure': 'off'
},
parserOptions: {
ecmaVersion: 'latest'
}
};
What did you do?
<script setup lang="ts">
import { ref } from 'vue';
const test = ref(<{ param: string; param2: string }>{ param: 'test', param2: 'test2' });
</script>
The code above is wrong. In the original code the type definition and the object instantiation are mixed together within the ref function call.
-const test = ref(<{ param: string; param2: string }>{ param: 'test', param2: 'test2' });
+const test = ref<{ param: string; param2: string }>({ param: 'test', param2: 'test2' });
The error message is :
0:0 Parsing error: Cannot set property index of Error which has only a gettereslint
What did you expect to happen?
A better message, with the problematic line.
Or simply find this issue by doing a google search with this error message. To understand that there is a syntax error in the code.
What actually happened?
[{
"resource": "src/components/HelloWorld.vue",
"owner": "eslint",
"severity": 8,
"message": "Parsing error: Cannot set property index of Error which has only a getter",
"source": "eslint",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}]
Repository to reproduce this issue
❗ If you don't share it for a few days, we silently close this issue.
learnny
Metadata
Metadata
Assignees
Labels
feat: typescriptneeds reproNeed a repository that can reproduce the problem, or a link to DEMO.Need a repository that can reproduce the problem, or a link to DEMO.