vue/match-component-file-name
require component name property to match its file name
- 💡 Some problems reported by this rule are manually fixable by editor suggestions.
This rule reports if a component name
property does not match its file name.
You can define an array of file extensions this rule should verify for the component's name.
📖 Rule Details
This rule has some options.
json
{
"vue/match-component-file-name": ["error", {
"extensions": ["jsx"],
"shouldMatchCase": false
}]
}
By default this rule will only verify components in a file with a .jsx
extension.
You can use any combination of ".js"
, ".jsx"
, ".ts"
, ".tsx"
, and ".vue"
extensions.
You can also enforce same case between the component's name and its file name.
If you are defining multiple components within the same file, this rule will be ignored.
🔧 Options
json
{
"vue/match-component-file-name": ["error", {
"extensions": ["jsx"],
"shouldMatchCase": false
}]
}
"extensions": []
... array of file extensions to be verified. Default is set to["jsx"]
."shouldMatchCase": false
... boolean indicating if component's name should also match its file name case. Default is set tofalse
.
{extensions: ["vue"]}
{extensions: ["js"]}
{shouldMatchCase: true}
📚 Further Reading
🚀 Version
This rule was introduced in eslint-plugin-vue v5.2.0