Rule proposal: `require-component-name`
See original GitHub issuePlease describe what the rule should do:
This rule warns you if the component’s name
property is undefined
What category of rule is this?
[x] Enforces code style [ ] Warns about a potential error [ ] Suggests an alternate way of doing something [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
// bad
export default {
render(){
return <div />
}
}
// good
export default {
name: 'div-component',
render(){
return <div />
}
}
Why should this rule be included
Naming components is a good practice. It makes it easier to debug your code with Vue Devtools, and helps you to keep your code organized. So much so that at least 2 rules on the Style Guide address the issue of how to name your components - one of them is a essential rule.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:26 (17 by maintainers)
Top Results From Across the Web
A different RequireComponent - Unity Forum
Hey guys, I made a simple script that adds a useful functionality for component fields in inspector, instead of the "RequireComponent...
Read more >Scripting API: RequireComponent - Unity - Manual
The RequireComponent attribute automatically adds required components as dependencies. When you add a script which uses RequireComponent to a GameObject, the ...
Read more >Conditions and Requirements for Relying on Component Part ...
Proposed § 1105.5(a)(1) would state that finished product certifiers may rely on testing of a component part of a consumer product only where ......
Read more >vue/no-unsupported-features
This rule reports unsupported Vue.js syntax on the specified version. Options #. json { " ...
Read more >Food and Drug Regulations ( CRC , c. 870) - Laws.justice.gc.ca
(10) Subsection (2) does not apply to the following common names if the common name appears on the principal display panel in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The name is necessary when rendering a component recursively.
Hmm, I would probably leave this out of the style guide and keep it in the uncategorized section here, because a
name
option is not actually useful in the vast majority of cases. For example:.vue
component to be used in a render function, as a name will be derived from the__file
property that’s added to the default export.So now that I think about it actually, and especially since functional components can now be written in
.vue
files, I can’t think of a real use case where a component needs thename
option to be specified. Did I miss any common (or even uncommon) scenarios?