-
Notifications
You must be signed in to change notification settings - Fork 300
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
<template>内に書くprop名をkebab-caseからcamelCaseに変えたい #1945
Comments
sevenc-nanashi
changed the title
<template>内に書くコンポーネント名をkebab-caseからcamelCaseに変えたい
<template>内に書くprop名をkebab-caseからcamelCaseに変えたい
Apr 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
内容
Vueのtemplate内で書かれているpropを、kebab-caseからcamelCaseにすると便利そうに思いました。
Vueのscript内に書くpropsはcamelCaseが推奨されています。
https://ja.vuejs.org/style-guide/rules-strongly-recommended#prop-name-casing
↑にも書いてますが、template内はkebab-caseでもcamelCaseでもどちらでも良いとのことです。
ただ、この2つを比べるとkebab-caseは面倒が増えていると感じます。
またVue3.4からは
v-bind:hoge=hoge
を:hoge
と省略できる記法が入っています。ケースをpropとtemplate内で揃えておけばより直感的な気がします。
Pros 良くなる点
煩わしさがちょっと減る
Cons 悪くなる点
template内で使われて内で使われてる普通のHTML要素の引数にも影響があるかも。
といってもニ単語以上になってるのはアクセシビリティ関連のプロパティくらい?
実現方法
そういう公式のESLintルールが有りそうなので適用すれば一発かも
https://eslint.vuejs.org/rules/camelcase
その他
これと似たタスクです
The text was updated successfully, but these errors were encountered: