RangerMing 2021-03-02 15:46 采纳率: 100%
浏览 7657
已采纳

vue文件提示: No Babel config file detected

使用`vue-cli`创建的项目中,vue文件第一行有波浪线提示,虽然项目能正常运行,但看着难受,希望能获取到解决办法。

不要那种忽略 Eslint 提示的答案

提示内容:

Parsing error: No Babel config file detected for C:\Users\XXXX\About.vue. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.eslint

vue-cli 版本:@vue/cli 5.0.0-alpha.5

vue 版本:vue@3.0.6

node 版本:v15.3.0

babel.config.js

module.exports = {
    presets: ["@vue/cli-plugin-babel/preset"],
};

.editorconfig


# EditorConfig is awesome: http://EditorConfig.org
 
# 是否是顶级配置文件,设置为true的时候才会停止搜索.editorconfig文件
root = true
 
# Unix-style newlines with a newline ending every file
[*]
# 换行符类型格式,一般用lf
end_of_line = lf
# 末尾行后加多一行空行
insert_final_newline = true
 
# 4 space indentation
[*.vue]
# 缩进类型
indent_style = tab
# 缩进数量
# indent_size = 4
 
# Tab indentation (no size specified)
[*.js]
indent_style = tab

[*.scss]
indent_style = tab
 
# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = tab
 
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = tab

package.json

{
	"name": "hellovue",
	"version": "0.1.0",
	"private": true,
	"scripts": {
		"serve": "vue-cli-service serve",
		"build": "vue-cli-service build",
		"lint": "vue-cli-service lint"
	},
	"dependencies": {
		"core-js": "^3.8.3",
		"vue": "^2.6.11",
		"vue-router": "^3.5.1",
		"vuex": "^3.6.2"
	},
	"devDependencies": {
		"@babel/core": "^7.12.16",
		"@babel/eslint-parser": "^7.12.16",
		"@vue/cli-plugin-babel": "~5.0.0-alpha.5",
		"@vue/cli-plugin-eslint": "~5.0.0-alpha.5",
		"@vue/cli-plugin-router": "~5.0.0-alpha.5",
		"@vue/cli-plugin-vuex": "~5.0.0-alpha.5",
		"@vue/cli-service": "~5.0.0-alpha.5",
		"@vue/eslint-config-prettier": "^6.0.0",
		"eslint": "^7.20.0",
		"eslint-plugin-prettier": "^3.3.1",
		"eslint-plugin-vue": "^7.6.0",
		"prettier": "^2.2.1",
		"sass": "^1.32.7",
		"sass-loader": "^11.0.1",
		"vue-template-compiler": "^2.6.11"
	},
	"eslintConfig": {
		"root": true,
		"env": {
			"node": true
		},
		"extends": [
			"plugin:vue/essential",
			"eslint:recommended",
			"@vue/prettier"
		],
		"parserOptions": {
			"parser": "@babel/eslint-parser"
		},
		"rules": {}
	},
	"browserslist": [
		"> 1%",
		"last 2 versions",
		"not dead"
	]
}
  • 写回答

4条回答 默认 最新

  • Nacl.Zz 2021-03-03 10:05
    关注

    尝试在.eslintrc中添加

    "parser": "@babel/eslint-parser", 
    "parserOptions": { "requireConfigFile" : "false" }
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!