問題1:expected indentation of 0 spaces but found 2 .
在通過 vue-cli創建vue項目時一股腦回車的後果。。選擇了usesEslint規範,從而導致不能隨意進行Formmat排版
因此會提示如下報錯:
expected indentation of 0 spaces but found 2 .
解決方案:
1.打開 /config/index.js
文件 ,找到:
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
// 將 true更改爲false即可
useEslint: false,
2.打開根目錄下的/.eslintrc.js
文件,找到:
// add your custom rules here
rules: {
// allow async-await
// 配置如下
'generator-star-spacing': 'off',
'indent': ['off', 0],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
問題2:Missing space before function parentheses
函數括號前缺少空格,例如通過自動排版生成的代碼
data(){}
會產生該警告。
解決方案:
打開根目錄下的/.eslintrc.js
文件,找到:
// add your custom rules here
rules: {
// allow async-await
// 配置如下
"space-before-function-paren": 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}