eslint 号稱程式設計路上的永遠的痛,即使頭秃也要把這道坎邁過去 [手動狗頭]~
配置檔案
配置檔案在項目根目錄裡,檔案名以 .eslintrc.js 為名。
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/vue3-essential',
'@vue/standard',
'@vue/typescript/recommended'
],
// 在這裡添加您的自定義規則
'rules': {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
// 關閉語句強制分号結尾
"semi": [0]
}
}
其中 rules 就是配置規則的,Eslint官網配置項
配置規則:
rules: {
"規則名": [規則值, 規則配置]
}
規則值:
"off"或者0 //關閉規則關閉
"warn"或者1 //在打開的規則作為警告(不影響退出代碼)
"error"或者2 //把規則作為一個錯誤(退出代碼觸發時為1)
常見規則項配置可參考:https://www.cnblogs.com/famensaodiseng/p/12087894.html
路漫漫其修遠兮,吾将上下而求索~