Skip to content

vue/valid-define-props ​

强制使用有效的 defineProps 编译器宏

  • ⚙️ 此规则包含在 "plugin:vue/essential"、*.configs["flat/essential"]、"plugin:vue/vue2-essential"、*.configs["flat/vue2-essential"]、"plugin:vue/strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/vue2-strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/recommended"、*.configs["flat/recommended"]、"plugin:vue/vue2-recommended" 和 *.configs["flat/vue2-recommended"] 中。

此规则检查 defineProps 编译器宏是否有效。

¥This rule checks whether defineProps compiler macro is valid.

📖 规则详情 ​

此规则在以下情况下报告 defineProps 编译器宏:

¥This rule reports defineProps compiler macros in the following cases:

  • defineProps 引用本地声明的变量。

    ¥defineProps is referencing locally declared variables.

  • defineProps 同时具有字面量类型和参数。例如 defineProps<{/*props*/}>({/*props*/})

    ¥defineProps has both a literal type and an argument. e.g. defineProps<{/*props*/}>({/*props*/})

  • defineProps 已被多次调用。

    ¥defineProps has been called multiple times.

  • Props 在 defineProps 和 export default {} 中均有定义。

    ¥Props are defined in both defineProps and export default {}.

  • Props 未在 defineProps 或 export default {} 中定义。

    ¥Props are not defined in either defineProps or export default {}.

Now loading...
Now loading...
Now loading...
Now loading...
Now loading...
Now loading...
Now loading...
Now loading...
Now loading...

🔧选项 ​

¥🔧 Options

无。

¥Nothing.

👫相关规则 ​

¥👫 Related Rules

🚀版本 ​

¥🚀 Version

此规则在 eslint-plugin-vue v7.13.0 中引入

¥This rule was introduced in eslint-plugin-vue v7.13.0

🔍代码实现 ​

¥🔍 Implementation

eslint-plugin-vue v10.4 中文网 - 粤ICP备13048890号