简体   繁体   中英

How do get HTML out of semicolons in prettierrc?

Use prettierrc and eslint

"semi" use false, But in the event section of HTML @update it is conjoined.

How can I ensure that this semicolon only works in JS?

module.exports = {

// tab
"tabWidth": 4,
// 超过100自动换行
"printWidth": 100,
// 使用tab缩进,默认false
"useTabs": false,
// 使用分号,默认true
"semi": false,
//使用单引号,默认false(在jsx中配置无效,默认都是双引号)
"singleQuote": false, // 行尾逗号,默认none,可选 noneles5|all
// es5 @es5+ R
// all 包括函数对象等所有可选
 "TrailingCooma": "none",
// 对象中的空格 默认true
// true: { foo: bar}
// false: {foo: bar}
"bracketSpacing": true, // JSX标签闭合位置 默认false
// false: <div
//className=""
//style={{}}
//>

<n-space justify="space-between">
<n-space>
<n-space align="center">
{{ $t("dataTable.listing.dateOfBirth" }}:
<n-date-picker
v-model: value="timeList"
type="daterange"
:shortcuts="rangeShortcuts"
:is-date-disabled="disablePreviousDate"
@update:value="
search.page = 1
getPigFileList()
actions="['confirm']"
/>

2个

I don't think I entirely understand your question, but it looks like you're using vue, in which case it's recommended to use eslint-plugin-prettier-vue ( https://www.npmjs.com/package/eslint-plugin-prettier-vue ), which might format the inline JavaScript in your HTML better.

Also, in your specific example, it looks like you have either an extra or missing " character; this code should format properly:

@update:value="
search.page = 1
getPigFileList()
actions=['confirm']" // not actions="['confirm']"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM