2021-10-18 Module Error (from ./node_modules/eslint-loader/index.js):解决vue项目中eslint检测格式问题

Module Error (from ./node_modules/eslint-loader/index.js):解决办法

vue启动项目报如下错误:

E:\workVue\vue-gdonlinepay-h5\src\views\payConfirm\index.vue 105:19 error Missing space before opening brace space-before-blocks 106:7 error Expected space(s) after "if" keyword-spacing 106:22 error Missing space before opening brace space-before-blocks


当vue渲染html为原生标签时出这个错误,需要修改配置项。

优化如下:

第一步:初始化并重新安装eslint

npm init -y

npm install eslint --save-dev

第二步:进入node_modules下的bin目录,并初始化eslint

cd ./node_modules/.bin/

.\eslint --init

第三步:设置配置选项,除选择vue.js外,其他都选择默认项或者y或者Y,如下仅仅到选择vue.js步骤

? How would you like to use ESLint? To check syntax and find problems

? What type of modules does your project use? JavaScript modules (import/export)

? Which framework does your project use? Vue.js

? Does your project use TypeScript? No

? Where does your code run? Browser

? What format do you want your config file to be in? JavaScript

第四步:最重要的一步,将node_modules目录下的bin目录里面的.eslintrc.js文件拷贝到项目根目录下

第五步:启动服务

npm run serve


结束!

你可能感兴趣的:(2021-10-18 Module Error (from ./node_modules/eslint-loader/index.js):解决vue项目中eslint检测格式问题)