简体   繁体   English

HTML如何在prettierrc中去掉分号?

[英]How do get HTML out of semicolons in prettierrc?

Use prettierrc and eslint使用 prettierrc 和 eslint

"semi" use false, But in the event section of HTML @update it is conjoined. "semi" 使用 false,但是在 HTML @update的事件部分是连体的。

How can I ensure that this semicolon only works in JS?如何确保这个分号只在 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.我不认为我完全理解你的问题,但看起来你正在使用 vue,在这种情况下建议使用eslint-plugin-prettier-vue ( https://www.npmjs.com/package/eslint- plugin-prettier-vue ),这可能会更好地格式化 HTML 中的内联 JavaScript 。

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']"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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