0

我想将 Prettier 配置为输出如下: 当前结果:

const onSubmit = data => {
if (isObjEmpty(errors)) {
  useJwt.login({email, password}).then(res => {
    const data = {
      ...res.data.userData,
      accessToken: res.data.accessToken,
      refreshToken: res.data.refreshToken
    }
  })
}

}

预期结果:

const onSubmit = data => {
if (isObjEmpty(errors)) {
  useJwt
    .login({email, password})
    .then(res => {
       const data = {...res.data.userData, accessToken: res.data.accessToken, refreshToken: res.data.refreshToken}
  })
}

}

我遇到的主要问题是线路

const data = {...res.data.userData, accessToken: res.data.accessToken, refreshToken: res.data.refreshToken}

该行应该是一行代码。

当前配置

.prettierrc file is:

{
  "printWidth": 120,
  "trailingComma": "none",
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true,
  "bracketSpacing": false,
  "jsxBracketSameLine": false,
  "arrowParens": "avoid",
  "endOfLine": "auto",
  "jsxSingleQuote": true,
  "proseWrap": "never",
  "quoteProps": "as-needed",
  "useTabs": false
}

问题不在于线的长度!

谢谢!

4

0 回答 0