Skip to content

Conversation

lsdsjy
Copy link
Contributor

@lsdsjy lsdsjy commented Sep 26, 2022

Currently the component-name-in-template-casing can't check globally registered components. This PR adds an option to explicitly list global components to check.

Copy link
Member

@FloEdelmann FloEdelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option looks good to me. But I have a few requests.

lsdsjy and others added 2 commits September 26, 2022 19:30
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR! The rule implementation looks good! Could you please add a example code to the docs where we can try out the new option?

@ota-meshi ota-meshi marked this pull request as draft October 4, 2022 04:40
@lsdsjy
Copy link
Contributor Author

lsdsjy commented Oct 10, 2022

Could you please add a example code to the docs where we can try out the new option?

Done.

@ota-meshi ota-meshi marked this pull request as ready for review October 10, 2022 15:26
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lsdsjy
Copy link
Contributor Author

lsdsjy commented Oct 11, 2022

When registering a component with kebab-case, can it be used with PascalCase?

I've thought a little more about this problem. Consider this:

// main.js Vue.component('SomeComp', ...) // App.js export default { components: { 'some-comp': ... }, template: '<SomeComp />' }

It works fine in that <SomeComp /> would resolve to the globally registered component, though there is a locally registered component some-comp and we would think it's a mistake at first glance. So if the options is kebab-case and registeredComponentsOnly is:

  • true, then <SomeComp /> is OK because currently we cannot determine whether it is a "(locally) registered component";
  • false, then <SomeComp /> would be an lint error as expected.

So the current logic is fine.

@FloEdelmann FloEdelmann changed the title feat: add globals option to component-name-in-template-casing Add globals option to component-name-in-template-casing Oct 11, 2022
@FloEdelmann FloEdelmann merged commit abcb642 into vuejs:master Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants