eslint - eslint 不遵循 vue/* 的规则
问题描述
所以我有这个.eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 2020,
parser: 'babel-eslint',
},
extends: [
'@nuxtjs',
'@vue/airbnb',
'plugin:nuxt/recommended',
'plugin:vue/recommended',
],
// add your custom rules here
rules: {
'vue/script-indent': ['error', 4, {
baseIndent: 1,
switchCase: 0,
ignores: [],
}],
'vue/html-indent': ['error', 4, {
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: [],
}],
....
},
overrides: [
{
files: [
'./**/*.vue',
],
env: {
jest: true,
},
rules: {
indent: 'off',
'no-unused-expressions': 'off',
},
},
],
}
我package.json
有这个需要帮助
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix ."
},
所以我只是跑来npm run lint
修复讨厌的格式吗?但它并没有真正做好。我收到这些错误
2:1 error Expected indentation of 2 spaces but found 4 spaces vue/html-indent
所以看着我default.vue
的在线2
我明白了
<template>
<v-app dark> <! <-- this has 4 spaces, which is what I have im my .eslintrc.js for vue/html-indent -->
<v-navigation-drawer
v-model="drawer"
:mini-variant="miniVariant"
:clipped="clipped"
fixed
app
>
我错过了什么???
解决方案
推荐阅读
- azure - 我可以在一个程序中使用具有不同订阅的多个事件中心吗?
- spring - 未为 jsp 页面中的导入组件填充传递的 modelAttributes
- mysql - Node.js 与 express.js。如果用户发送帖子请求的速度足够快,他们可以使用相同的数据注册两次
- algolia - 什么是 $index 在 algolia 的方面计数?
- javascript - 为什么我可以等待此代码但不能使用 .then?
- ajax - 如何访问数据内的ajax响应数据
- javascript - Axios 无法从 NativeScript 中的 API 获取数据
- react-native - Stack Navigator 不显示屏幕
- docker - 从 docker 容器端口转发到我的本地桌面(容器 --> 远程主机 --> 本地桌面)
- docker - 在 docker 中构建 php 事件扩展失败:php_sockets_le_socket:找不到符号