简体   繁体   中英

Expected an assignment or function call and instead saw an expression no-unused-expressions - how to fix this CI error?

Expected an assignment or function call and instead saw an expression no-unused-expressions, I need help on fixing this. Thanks

 export const setDecimalFormat = amount => { ['de', 'fr'].includes(getLocale())? amount.replace(/\./g, ','): amount; };

Try returning the value

If an arrow function is simply returning a single line of code, you can omit the statement brackets and the return keyword. This tells the arrow function to return the statement.

export const setDecimalFormat = amount => {
  return ['de' , 'fr'].includes(getLocale())
    ? amount.replace(/\./g, ',')
    : amount;
};

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