1. Install the plug-in eslint-plugin-vue
npm i -g eslint-plugin-vue
2. Modify the files under the project and path: .eslint.js
Add vue Options
3. Add the eslint and vetur plug-ins and download them directly in the plug-in library
4. Modify the vscode header Option configuration
[Chinese version file>Preferences>setting to find the corresponding configuration file]
[English version file>preferences>setting to find the corresponding configuration file]
[Find the configuration file and add the following code]
"eslint.autoFixOnSave": true, "eslint.validate": [ "javascript",{ "language": "vue", "autoFix": true },"html", "vue" ],
5. After the configuration is completed, restart vscode, and the eslint error will be automatically repaired when saving.
Recommended Tutorial: vscode tutorial
The above is the detailed content of eslint reports error when vscode runs vue project. For more information, please follow other related articles on the PHP Chinese website!