【发布时间】:2021-10-04 16:11:30
【问题描述】:
我正在尝试格式化我的文件,但引号被添加到新行并将我的文件转换为字符串。 prettier / vscode 中是否有设置不将引号格式化到新行或忽略此引号将整个文件转换为字符串
例如:
@click="
createStudent();
$emit('hide-modal');
makeToast('success');
"
// anything below this quote on a new line will make the rest of the file appear as a string.
Eslint 文件:
module.exports = {
root: true,
extends: [
'plugin:vue/essential',
'plugin:prettier/recommended',
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
rules: {
quotes: [2, 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'prettier/prettier': [
'warn',
{
singleQuote: true,
semi: false
}
]
}
}
【问题讨论】: