[英]How to use NOSONAR at the end of the line having ESLINT and Prettier configured?
Having editor.formatOnSave = true
in VS code, when trying to ignore some rules and suppress the error using //NOSONAR at the end of the line.在 VS 代码中使用
editor.formatOnSave = true
,当试图忽略一些规则并在行尾使用 //NOSONAR 抑制错误时。 The line comment is going down.行评论正在下降。 How and where these rules can be configured?
如何以及在何处配置这些规则?
export const overviewReducer = (state = initialState, action) => { //NOSONAR
coming to the next line like:来到下一行,例如:
export const overviewReducer = (state = initialState, action) => {
//NOSONAR
I've just had the same issue.我刚刚遇到了同样的问题。
Using prettier-ignore
worked for me:使用
prettier-ignore
对我有用:
// prettier-ignore
export const overviewReducer = (state = initialState, action) => { //NOSONAR
Not the best solution, but at least it solves the problem.不是最好的解决方案,但至少它解决了问题。
According to this issue I found googling "Prettier Nosonar" , there's no workaround at this point – if Prettier decides a comment should move, it will damn well move it.根据这个问题,我在谷歌上搜索了“Prettier Nosonar” ,目前没有解决方法——如果 Prettier 决定应该移动一条评论,它会很好地移动它。
There's no whitelist of comments that should stay on the lines they're originally written on.没有评论的白名单应该保留在他们最初写的行上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.