简体   繁体   中英

Prettier adds multiple empty lines after JavaScript blocks wrongely

My prettier is adding extra empty lines after blocks in JavaScript. It is OK after first save and empty line is just one, but after second save it add another line, and after third save it add one more. It not adds more with further saves.

Example:

    function calcTempAmplitude(array1, array2) {

    for (temp of array2) 
        array1.push(temp);
    


    let max = array1[0];
    let min = array1[0];
    for (temp of array1) {
        if (typeof temp !== 'number') 
            continue;
        


        if (temp > max) 
            max = temp;
        


        if (temp < min) 
            min = temp;
        


    }
    // return(min <= 0) ? max + min : max - min;
    return max - min;
}
console.log(calcTempAmplitude(tempetures1, tempetures2));

how to solve this buggy behavior?

它通过重新安装 Prettier 扩展来修复!

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