0

我試圖在Visual Studio代碼中禁用來自CoffeLint的警告消息。 我已經改變了coffeelint.json在我的用戶文件夾中有以下幾點:CoffeeLint:禁用警告消息:行超出了允許的最大長度

"max_line_length": { 
    "name": "max_line_length", 
    "level": "ignore" 
}, 

但是,這並沒有任何影響,仍然顯示錯誤消息。任何人都可以建議什麼是錯的?

+0

你的「用戶文件夾」是什麼意思?我相信代碼coffeelint擴展從您打開的工作區的根目錄讀取coffeelint.json。這是你添加這些行的文件嗎? – Llewey

回答

1

解決方案:

要配置的CoffeeScript一旦安裝會有在C默認coffeelint.json:\ Users \ [用戶名] \ .vscode \擴展文件夾。這是無用的,改變配置在這裏沒有任何作用(至少在我的情況下)。

要解決此問題,請在項目的根目錄中創建一個新的coffeelint.json,或者在您的package.json中添加一個coffeelintConfig部分。無論哪種方式,配置都完全相同。如果CoffeeLint沒有爲當前項目找到任何配置,它將檢查要使用的$ HOME/coffeelint.json。

在此之後的示例配置低於:

的package.json

{ 
    "name": "your-project", 
    "version": "0.0.0", 
    "coffeelintConfig": { 
    "indentation" : { 
     "level" : "error", 
     "value" : 4 
    }, 
    "line_endings" : { 
     "value" : "unix", 
     "level" : "error" 
    } 
    } 
} 

coffeelint.json

{ 
    "indentation" : { 
    "level" : "error", 
    "value" : 4 
    }, 
    "line_endings" : { 
    "value" : "unix", 
    "level" : "error" 
    } 
} 

現在,您可以編輯這個配置皮棉你的CoffeeScript :)

相關問題