Subscribe on changes!

eslint reports a no-undef error when defineProps is not explicitly imported, even though compiler-sfc warns against importing it.

avatar
Aug 27th 2021

Version

3.2.6

Reproduction link

https://github.com/chrisshroba/vue-next-issue-defineProps-eslint/blob/main/src/components/HelloWorld.vue#L34

Steps to reproduce

Method 1:

  1. Clone repo
  2. Run npm run serve

Method 2

  1. Create new Vue 3 project using vue create project_name
  2. Modify HelloWorld component to use <script setup>, and use defineProps without importing it.

What is expected?

defineProps is a compiler macro and should not be reported by eslint as an undefined variable.

What is actually happening?

The following error is issued.

/home/chrisshroba/dev/projects/eslint-issue/src/components/HelloWorld.vue
  34:1  error  'defineProps' is not defined  no-undef

✖ 1 problem (1 error, 0 warnings)

I could import defineProps, but then I sometimes get a warning against importing it, which is defined here in the Vue source.

avatar
Aug 27th 2021

seems not a vue core bug.

avatar
Aug 27th 2021

image