-1

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

Adam
  • 113
  • 1
  • 8
  • 2
    Welcome to Stack Overflow. [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied, or even consumed by users of adaptive technologies like screen readers. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – ChrisGPT was on strike Apr 23 '22 at 12:44

1 Answers1

0

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