简体   繁体   中英

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. 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
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.

There's no whitelist of comments that should stay on the lines they're originally written on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM