# san/data-name-casing
enforce data names always use "camel-case"
- ⚙️ This rule is included in all of
"plugin:san/essential"
,"plugin:san/strongly-recommended"
and"plugin:san/recommended"
.
# 📖 Rule Details
computed
、dataTypes
、initData
properties name must be camel-case , it will not work when the property name is snakeCase、kebabCase or PascalCase.
<script>
export default {
/* ✓ GOOD */
dataTypes: {
datatypeText: DataTypes.string
},
computed: {
aText() {
return this.data.get('text') + 'a';
}
},
initData() {
return {
text: 'text'
}
},
/* ✗ BAD */
dataTypes: {
'datatype-text': DataTypes.string
},
computed: {
/* PascalCase */
'AText'() {
return this.data.get('text_bad') + 'a';
},
/* snakeCase */
'b_text'() {
return this.data.get('text_bad') + 'b';
},
/* kebabCase */
'c-text'() {
return this.data.get('text_bad') + 'c';
}
},
initData() {
return {
text_bad: 'text'
}
},
}
</script>