Appearance
vue/no-potential-component-option-typo
禁止在组件属性中出现潜在的拼写错误
- 💡 此规则报告的某些问题可由编辑器 suggestions 手动修复。
📖 规则详情
此规则禁止组件选项中出现潜在的拼写错误
¥This rule disallow a potential typo in your component options
这是配置
¥Here is the config
json
{
"vue/no-potential-component-option-typo": ["error", {
"presets": ["all"],
"custom": ["test"]
}]
}
我们使用编辑距离来比较两个字符串的相似性,阈值是控制要报告的编辑距离上限的选项
¥we use edit distance to compare two string similarity, threshold is an option to control upper bound of edit distance to report
这是关于配置选项 threshold
的另一个示例
¥Here is the another example about config option threshold
json
{
"vue/no-potential-component-option-typo": ["error", {
"presets": ["vue", "nuxt"],
"threshold": 5
}]
}
🔧选项
¥🔧 Options
json
{
"vue/no-potential-component-option-typo": ["error", {
"presets": ["vue"],
"custom": [],
"threshold": 1
}]
}
presets
...enum type
,包含几个常见的 vue 组件选项集,["all"]
与["vue", "vue-router", "nuxt"]
相同。默认["vue"]
¥
presets
...enum type
, contains several common vue component option set,["all"]
is the same as["vue", "vue-router", "nuxt"]
. default["vue"]
custom
...array type
,存储你想要检测的自定义组件选项的列表。默认[]
¥
custom
...array type
, a list store your custom component option want to detect. default[]
threshold
...number type
,用于控制报告的编辑距离的上限的数字,我们建议不要更改此配置选项,即使它是必需的,也不要大于2
。默认1
¥
threshold
...number type
, a number used to control the upper limit of the reported editing distance, we recommend don't change this config option, even if it is required, not bigger than2
. default1
🚀建议
¥🚀 Suggestion
我们提供所有可能的组件选项,这些选项的编辑距离大于 0 且小于阈值
¥We provide all the possible component option that edit distance between your vue component option and configuration options is greater than 0 and less equal than threshold
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
🔍代码实现
¥🔍 Implementation