![](/img/trans.png)
[英]what is the difference between babel.config.js and vue.config.js and can i combine the 2 files?
[英]babel.config.js babel eslint turn off / disable a rule
我想停用 babel eslint 規則no-unused-vars
。
如果使用 eslint(不是 babel-eslint),我會添加以下內容
.eslintrc.js
rules: {
'no-unused-vars': 'off'
}
所以我嘗試將相同的代碼添加到
babel.config.js
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
rules: {
'no-unused-vars': 'off'
}
}
但這會產生錯誤
ERROR ReferenceError: Unknown option: .rules. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
我找不到文檔中提到的規則。 我試過exclude
但在禁用規則時不起作用。
我能夠向我的 package.json 添加一個"eslintConfig"
部分,並且我的 linter 在每個構建中運行時都尊重它。
我可能會建議在那里添加您的規則。
您可能需要更改一些插件或其他配置,但我從代碼片段中刪除了它們以減少大小。
"eslintConfig": {
[... removed for brevity]
"parser": "@babel/eslint-parser"
"rules": {
"no-unused-vars": "off"
}
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.