col*_*mer 17 javascript reactjs react-native visual-studio-code prettier
我在 React Native 项目的 VS Code 中使用 Prettier,它删除了混合运算符中或用括号声明 var 时的括号。如何防止 Prettier 这样做?
示例1:
 const foo = (a && b) || c;
Run Code Online (Sandbox Code Playgroud)
后:
const foo = a && b || c;
Run Code Online (Sandbox Code Playgroud)
示例2:
const c = (a.toString()).toUpperCase();
Run Code Online (Sandbox Code Playgroud)
后:
const c = a.toString().toUpperCase();
Run Code Online (Sandbox Code Playgroud)
我知道在大多数情况下它不会改变逻辑,但我想禁用此功能。
小智 7
您可以使用 \xe2\x80\x9cprettier-ignore\xe2\x80\x9d 注释来忽略部分文件。\n例如 // prettier-ignore
\n这里有文档链接: https: //prettier.io/docs/en/ignore.html
\n|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           9622 次  |  
        
|   最近记录:  |