我已经为我的项目安装了 eslint 和 eslint-plugin-vue。当我在浏览器中加载项目时,我在控制台中收到以下警告:
http://eslint.org/docs/rules/indent 预期缩进 2 个空格,但发现 4 个
src\_nav.js:2:1
这是我的 _nav.js:
export default {
items: [{ /*this is line 2 - indented with 4 spaces*/
Run Code Online (Sandbox Code Playgroud)
我试图告诉 lint 我想使用 4 个空格,但我仍然收到警告。我对 .vue 文件有同样的问题。
这是我的 .eslintrc.js:
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
"indent": ["error", 4],
"vue/html-indent": ["error", 4],
"vue/script-indent": ["error", 4],
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7244 次 |
| 最近记录: |