‘defineProps‘ is not defined.eslint no-undef 问题解决

简介: ‘defineProps‘ is not defined.eslint no-undef 问题解决

问题描述

‘defineProps’ is not defined.eslint no-undef

‘defineEmits’ is not defined.eslint no-undef

微信图片_20230710093843.png



解决方案

Eslint 官方解决方案

微信图片_20230710093845.png



根据 ESLint 官方提供解决方案 解析器使用 vue-eslint-parser v9.0.0 + 版本


npm install -D vue-eslint-parser

1

微信图片_20230710093906.png


.eslintrc.js 关键配置如下,vue-eslint-parser v9.0.0 + 无需配置 vue/setup-compiler-macros 编译宏 :


 parser: 'vue-eslint-parser',

 extends: [

   'eslint:recommended',

// ...  

 ],


再看已无报错提示

微信图片_20230710093921.png



如果编译器还有报错提示尝试重启 VSCode 看

相关文章
|
9月前
npm WARN deprecated core-js@2.6.12 core-js@<3.3 is no longer maintained and not recommended for usa
npm WARN deprecated core-js@2.6.12 core-js@<3.3 is no longer maintained and not recommended for usa
166 0
|
8月前
|
XML JavaScript 编译器
TypeScript 里的 Reference Type 和 Triple-Slash Directives
TypeScript 里的 Reference Type 和 Triple-Slash Directives
39 0
|
5月前
报错You may use special comments to disable some warnings.vue-cli脚手架关闭eslint的步骤
报错You may use special comments to disable some warnings.vue-cli脚手架关闭eslint的步骤
|
5月前
|
JavaScript
解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法
解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法
|
5月前
又被ESLint 调戏了!!! ESLint:Newline required at end of file but not found. eslint(eol-last) [12, 22]
又被ESLint 调戏了!!! ESLint:Newline required at end of file but not found. eslint(eol-last) [12, 22]
|
5月前
|
JavaScript
Vue:You may use special comments to disable some warnings.
Vue:You may use special comments to disable some warnings.
|
9月前
|
JavaScript
vite无法使用require,require is not defined
vite无法使用require,require is not defined
372 0
|
11月前
|
JavaScript
Vue3报错:Parsing error: No Babel config file detected 解决
Vue3报错:Parsing error: No Babel config file detected 解决
181 0
npm install报错peerDependencies WARNING eslint-plugin-vue@^5.2.3 requires a peer of eslint@^5.0.0 but
npm install 报错,以为是npm问题,改成cnpm install,也还是报错,根据错误信息提示,推断是eslint版本不兼容。
571 0
SipStack.i:321: Error: Unknown SWIG preprocessor directive:
SipStack.i:321: Error: Unknown SWIG preprocessor directive:
57 0