-
-
Notifications
You must be signed in to change notification settings - Fork 681
⭐️New: Add vue/match-component-file-name
rule
#668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⭐️New: Add vue/match-component-file-name
rule
#668
Conversation
vue/match-component-file-name
rule
Hi @armano2 I fixed my commit to pass the lint and I think as I force pushed to have just one commit github cannot show your review. If it is not related to fixing the linting problems, I would as you to please repost your review. Sorry for force pushing I wasn't expecting this to reviwed so quickly. I think we could add the "run |
Missing valid tests: export default {
name: componentName,
template: '<div />'
} // test.js(x)
export default {
name: `test`,
template: '<div />'
} // foo.js(x)
export default {
name: `test${foo}`,
template: '<div />'
} // foo.js(x)
export default {
name,
template: '<div />'
} There is also: Vue.component('test', {}) but this one is a little more tricky, component-definition-name-casing Last case is multiple components in same file. |
Still missing the test of multiple components in the same file... Working (struggling) on it |
I don't think that's possible without changing logic in hmm... |
what's about making variable and increase counter in and on |
Hi @armano2 , used |
Our style guide mentions kebab-case filenames because a mix of case-sensitive/insensitive file systems can cause a certain problem. I'd like to see how this rule handles kebab-case filenames. |
Hi @mysticatea , good question. The implementation only checks if the component's name property is equal to its file name. It doesn't do any case conversion. So if your file is names In the examples and testing I used only PascalCase examples for shortness but if you look into the rule's code you will see that nothing fancy is done when comparing the component's name property and its file name. See the comparison in the source EDIT - added link to the source file |
Thank you for the explanation. Does allowing kebab-case file names make sense? |
should it be casing.pascalCase(name) !== filename && casing.kebabCase(name) !== filename so it can accept any combination of cases?
|
Sounds good to me. |
Hi @armano2 thanks for approving the changes. Let me know if there’s anything else that is needed on this issue. And thanks a lot to you and to @mysticatea for the guidance. |
Co-Authored-By: rodrigopedra <[email protected]>
@rodrigopedra Thank you! |
@ota-meshi You are welcome. If you find anything else I could help, please let me know. |
This reverts commit c6bbd95.
Sorry guys, but since we're still in v5 beta and all new rules are on hold - to get everything in place for official release - I reverted this PR and will merge it back in the next few days (after 5.0.0 release). I hope this is fine |
This reverts commit f4eef78.
Reverted back to master. |
Described in issue #667
Discussed in the comments of PR #589 with @chrisvfritz