eslint vue

1、npx eslint src/main.ts
Error [ERR_REQUIRE_ESM]: require() of ES Module
package.json中"type": "module" 移除

.eslintrc.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename .eslintrc.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/**/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
.eslintrc.js => eslintrc.cjs
2、Cannot find module './App.vue' or its corresponding type declarations.ts

3、配置eslint vue项目无红色错误提示,可以安装volar, 安装之后出现红色提示
https://stackoverflow.com/questions/73322883/vite-vue3-new-project-cannot-find-module-app-vue-or-its-corresponding-ty
安装 volar ts版本
安装eslint-plugin-vue vue-eslint-parser
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser"
}

4、'module' is not defined.eslintno-undef
"env": {
"node": true
}

posted @ 2023-02-15 13:07  Running00  阅读(420)  评论(0编辑  收藏  举报