xvector
xvector
  • 发布:2024-01-12 16:00
  • 更新:2024-01-12 16:42
  • 阅读:270

eslint-vue错误

分类:HBuilderX
[eslint-vue] 15:32:17.270 TypeError [ERR_INVALID_ARG_VALUE]: Failed to load plugin 'vue' declared in 'BaseConfig': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''  
[eslint-vue] 15:32:17.270 Referenced from: BaseConfig  
[eslint-vue] 15:32:17.270     at new NodeError (node:internal/errors:387:5)  
[eslint-vue] 15:32:17.270     at createRequire (node:internal/modules/cjs/loader:1241:13)  
[eslint-vue] 15:32:17.270     at Object.resolve (/Demo/node_modules/.pnpm/registry.npmmirror.com+@eslint+eslintrc@1.4.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2325:16)  
[eslint-vue] 15:32:17.270     at Object.ModuleResolver.resolve (/Demo/node_modules/.pnpm/registry.npmmirror.com+@rushstack+eslint-patch@1.1.4/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:201:44)  
[eslint-vue] 15:32:17.270     at ConfigArrayFactory._loadPlugin (/Demo/node_modules/.pnpm/registry.npmmirror.com+@eslint+eslintrc@1.4.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3392:33)  
[eslint-vue] 15:32:17.270     at ConfigArrayFactory._loadPlugin (/Demo/node_modules/.pnpm/registry.npmmirror.com+@rushstack+eslint-patch@1.1.4/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:203:43)  
[eslint-vue] 15:32:17.270     at ConfigArrayFactory._loadExtendedPluginConfig (/Demo/node_modules/.pnpm/registry.npmmirror.com+@eslint+eslintrc@1.4.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3212:29)  
[eslint-vue] 15:32:17.270     at ConfigArrayFactory._loadExtends (/Demo/node_modules/.pnpm/registry.npmmirror.com+@eslint+eslintrc@1.4.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3133:29)  
[eslint-vue] 15:32:17.270     at ConfigArrayFactory._normalizeObjectConfigDataBody (/Demo/node_modules/.pnpm/registry.npmmirror.com+@eslint+eslintrc@1.4.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3074:25)  
[eslint-vue] 15:32:17.270     at _normalizeObjectConfigDataBody.next (<anonymous>)

.eslintrc-auto-import.json

{  
  "globals": {  
    "Component": true,  
    "ComponentPublicInstance": true,  
    "ComputedRef": true,  
    "EffectScope": true,  
    "ExtractDefaultPropTypes": true,  
    "ExtractPropTypes": true,  
    "ExtractPublicPropTypes": true,  
    "InjectionKey": true,  
    "PropType": true,  
    "Ref": true,  
    "VNode": true,  
    "WritableComputedRef": true,  
    "acceptHMRUpdate": true,  
    "computed": true,  
    "createApp": true,  
    "createPinia": true,  
    "customRef": true,  
    "defineAsyncComponent": true,  
    "defineComponent": true,  
    "defineStore": true,  
    "effectScope": true,  
    "getActivePinia": true,  
    "getCurrentInstance": true,  
    "getCurrentScope": true,  
    "h": true,  
    "inject": true,  
    "isProxy": true,  
    "isReactive": true,  
    "isReadonly": true,  
    "isRef": true,  
    "mapActions": true,  
    "mapGetters": true,  
    "mapState": true,  
    "mapStores": true,  
    "mapWritableState": true,  
    "markRaw": true,  
    "nextTick": true,  
    "onActivated": true,  
    "onAddToFavorites": true,  
    "onBackPress": true,  
    "onBeforeMount": true,  
    "onBeforeUnmount": true,  
    "onBeforeUpdate": true,  
    "onDeactivated": true,  
    "onError": true,  
    "onErrorCaptured": true,  
    "onHide": true,  
    "onLaunch": true,  
    "onLoad": true,  
    "onMounted": true,  
    "onNavigationBarButtonTap": true,  
    "onNavigationBarSearchInputChanged": true,  
    "onNavigationBarSearchInputClicked": true,  
    "onNavigationBarSearchInputConfirmed": true,  
    "onNavigationBarSearchInputFocusChanged": true,  
    "onPageNotFound": true,  
    "onPageScroll": true,  
    "onPullDownRefresh": true,  
    "onReachBottom": true,  
    "onReady": true,  
    "onRenderTracked": true,  
    "onRenderTriggered": true,  
    "onResize": true,  
    "onScopeDispose": true,  
    "onServerPrefetch": true,  
    "onShareAppMessage": true,  
    "onShareTimeline": true,  
    "onShow": true,  
    "onTabItemTap": true,  
    "onThemeChange": true,  
    "onUnhandledRejection": true,  
    "onUnload": true,  
    "onUnmounted": true,  
    "onUpdated": true,  
    "provide": true,  
    "reactive": true,  
    "readonly": true,  
    "ref": true,  
    "resolveComponent": true,  
    "setActivePinia": true,  
    "setMapStoreSuffix": true,  
    "shallowReactive": true,  
    "shallowReadonly": true,  
    "shallowRef": true,  
    "storeToRefs": true,  
    "toRaw": true,  
    "toRef": true,  
    "toRefs": true,  
    "toValue": true,  
    "triggerRef": true,  
    "unref": true,  
    "useAttrs": true,  
    "useCssModule": true,  
    "useCssVars": true,  
    "useSlots": true,  
    "watch": true,  
    "watchEffect": true,  
    "watchPostEffect": true,  
    "watchSyncEffect": true  
  }  
}

.eslintrc.cjs

/* eslint-env node */  
require('@rushstack/eslint-patch/modern-module-resolution')  

module.exports = {  
  root: true,  
  extends: [  
    'plugin:vue/vue3-essential',  
    'eslint:recommended',  
    '@vue/eslint-config-typescript',  
    '@vue/eslint-config-prettier',  
    './.eslintrc-auto-import.json'  
  ],  
  // 小程序全局变量  
  globals: {  
    uni: true,  
    wx: true,  
    WechatMiniprogram: true,  
    getCurrentPages: true,  
    getApp: true,  
    UniApp: true,  
    UniHelper: true,  
    App: true,  
    Page: true,  
    Component: true,  
    AnyObject: true  
  },  
  parserOptions: {  
    ecmaVersion: 'latest'  
  },  
  rules: {  
    'prettier/prettier': [  
      'warn',  
      {  
        singleQuote: true,  
        semi: false,  
        printWidth: 120,  
        tabWidth: 2,  
        useTabs: false,  
        trailingComma: 'none',  
        endOfLine: 'auto',  
        stylelintIntegration: true,  
        eslintIntegration: true,  
        arrowParens: 'avoid'  
      }  
    ],  
    'vue/multi-word-component-names': ['off'],  
    'vue/no-setup-props-destructure': ['off'],  
    'vue/no-deprecated-html-element-is': ['off'],  
    '@typescript-eslint/no-unused-vars': ['off'],  
    'no-unused-vars': 'warn',  
    'max-len': ['warn', { code: 120 }],  
    'no-unreachable': 'warn',  
    'vue/no-v-model-argument': 0,  
    'no-undef': 'off',  
    eqeqeq: 'warn', // 要求使用 === 和 !==  
    semi: 'off', // 要求或禁止使用分号代替 ASI  
    quotes: ['error', 'single'], // 强制使用一致的反勾号、双引号或单引号  
    'arrow-spacing': 'error', // 强制箭头函数的箭头前后使用一致的空格  
    'space-before-function-paren': 'off'  
  }  
}  
2024-01-12 16:00 负责人:无 分享
已邀请:
HRK_01

HRK_01

看样子是你语法有问题,能贴一下简单的复现demo吗

  • xvector (作者)

    相关code补充如上

    2024-01-13 11:43

  • HRK_01

    回复 c***@xvector.ai: 你是在什么情况下报的这个错误?上面显示的是你filename这个参数传入了空值才导致报了这个错误

    2024-01-13 16:17

  • xvector (作者)

    回复 HRK_01: 就是修改了vue页面然后控制台就出了这么个错误

    2024-01-19 21:52

  • HRK_01

    回复 c***@xvector.ai: 能贴一下你修改前不报错的代码和报错之后的代码吗

    2024-01-20 14:49

要回复问题请先登录注册