Skip to content
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

Add component-name-in-template-casing: 'PascalCaseNamespaced' #2405

Open
aleksey-hoffman opened this issue Feb 14, 2024 · 3 comments
Open

Add component-name-in-template-casing: 'PascalCaseNamespaced' #2405

aleksey-hoffman opened this issue Feb 14, 2024 · 3 comments

Comments

@aleksey-hoffman
Copy link

aleksey-hoffman commented Feb 14, 2024

What rule do you want to change?
vue/component-name-in-template-casing

Does this change cause the rule to produce more or fewer warnings?
More

How will the change be implemented? (New option, new default behavior, etc.)?
New option

Please provide some example code that this change will affect:

Vue added support for Namespaced Components:

https://vuejs.org/api/sfc-script-setup.html#namespaced-components

<script setup>
import * as Form from './form-components'
</script>

<template>
  <Form.Input>
    <Form.Label>label</Form.Label>
  </Form.Input>
</template>

What does the rule currently do for this code?
Breaks

What will the rule do after it's changed?
Allow to specify PascalCaseOrNamespaced option so you could use both PascalCase and PascalCaseOrNamespaced names

'vue/component-name-in-template-casing': ['error', 'PascalCaseOrNamespaced'],

Additional context

@aleksey-hoffman
Copy link
Author

aleksey-hoffman commented Feb 14, 2024

This regex workaround would work but it won't autofix the name

'vue/component-name-in-template-casing': ['error', 'PascalCase', {
  ignores: ['/^[A-Z][a-zA-Z]*(\\.[A-Z][a-zA-Z]*)*$/']
},

@waynzh
Copy link
Contributor

waynzh commented Feb 27, 2024

Vue added support for Namespaced Components

But for the Namespaced Component like * as Form, Form.Item is indeed not treated as a Registered Component.
Maybe we can improve this, by treating Form.xxx also as a Registered Component and supporting aufofix? I'd love to hear from maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants