要去掉eslint在文本前后自动加的空格,可以在eslint配置文件中添加以下规则:
"rules": {
"no-multi-spaces": ["error", { "ignoreEOLComments": true }]
}
这个规则会禁止在代码中出现多余的空格,包括在行末的注释中。如果你想保留行末注释前的空格,可以设置ignoreEOLComments
为true
。
可以查找替换下,正则替换了解下。
{
"rules": {
"space-in-parens": ["error", "never"] // 禁止在文本前后加空格
}
}