-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Dependencies: Use latest
version of vue-tsc
& sync versions of angular
#23011
Conversation
…ilenames are treated to override native html elements, causing types clashes.
…ned by filenames are treated to override native html elements, causing types clashes." This reverts commit ea7c392.
This seems related: Seems
https://github.com/vuejs/language-tools/blob/master/CHANGELOG.md I'll downgrade back to what they deem to be |
latest
version of vue-tsc
& sync versions of angular
New and updated dependency changes detected. Learn more about Socket for GitHub ↗︎
Footnotes |
@Sidnioulz here's a PR of us switching us to the "latest" release according to their CHANGELOG. Do you expect this will cause issues for storybook users? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is great, let's in an other PR also put vue-component-type-helpers
to 'latest' to fix the issues of @Sidnioulz
@ndelangen sorry, mail goes to my personal inbox and it takes time to process :( I don't expect any change or improvement with vue-component-type-helpers. In my limited Vue experience, the issue you describe is bound to happen because of single-component naming. It's a convention in Vue that component names must be multi-word. The Vue maintainers provide an ESLint rule to enforce that: https://eslint.vuejs.org/rules/multi-word-component-names.html. Without enforcing the rule, we've seen other linters in the past complain about Anyone struggling with this and wanting to keep their file named // Vue 3 composition API
defineOptions({
name: 'MyButton',
})
// Vue 3 options API, never used it but I guess it's that
export default {
name: 'MyButton',
...
}
// Vue 2 with property decorators / class components
@Component
export default class MyButton extends Vue { ... } |
Good to know @Sidnioulz, to the problem I faced, will come back to haunt us later.. And might be actually hunting users of storybook currently? We should perhaps setup this mentioned eslint rule on the vue part of our codebase. Any help would be appreciated @Sidnioulz if you have the time 🙏 |
Hi @ndelangen indeed Vue uses and recommends using PascalCase names because they are valid JavaScript identifiers so easy to register and import, and easy for IDE to auto-complete. it distinguishes the Vue component from a native or custom component (web component). However, Vue can resolve to kebab-case as well so both Nonetheless renaming Button.vue to MyButton.vue may not be the best thing to do, i think it is about the default export. |
It's possible. I think my first issue with this was SB's a11y linter throwing incorrect warnings.
I'm tempted to say yes, but if some engineers insist on using the single-word names in their codebases, it would cause significantly more annoyance to them. So, no opinion.
We used to have PascalCase and it was not enough. After all, HTML tag and attribute names are case insensitive.
This may work for components that are globally registered. If components aren't globally registered, but passed via the |
@Sidnioulz yeah right it is really upto the developers if they want to pay it save and clean, despite the tools and rules that help have a saint codebase you can always screw it up believe me.
Yes, but to be honest I don't do much code using options to define. the component name unless you really want to be explicit about the component name, this is most for Ui libraries. I could be a bit more specific and just change the import name import type { StoryObj, Meta } from '@storybook/vue3';
import SlotsComponent from './template-slots/component.vue';
const meta = {
component: SlotsComponent,
tags: ['autodocs'],
} satisfies Meta<typeof SlotsComponent>;
type Story = StoryObj<typeof meta>;
export default meta;
export const Default: Story = {
args: {
default: ({ num }) => `Default slot { num=${num} }`,
named: ({ str }) => `Named slot { str=${str} }`,
vbind: ({ num, str }) => `Named v-bind slot { num=${num}, str=${str} }`,
},
}; so my take is you can use generic name if the scope is local and not impacting any part of your codebase, the minute your component exposed to other part of the codebase you should be careful About The sematic and the format of your component name and follow the team / framework conventions |
some volar update caused vue to start vomitting ts-errors
It seems that when a file file filename
Button.vue
is used, it will define a componentbutton
.I'm not sure of this is a bug or a feature.
But if
Button.vue
uses<button>
(which would obviously refer toHTMLButtonElement
), volar gets "confused" and assumes thus button is the button being defined.But of course the API (props, events) of those 2 are different, thus it complains.
I renamed
Button.vue
toMyButton.vue
, this fixes it.I'm not really happy with this though.