Skip to content

[8.1.0] Cannot read properties of undefined (reading 'apiName') - component-api-style.js:289:23 #1720

Closed
@caugner

Description

@caugner

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 7.32.0
  • eslint-plugin-vue version: 8.1.0
  • Node version: 16.13.0
  • Operating System: Linux

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    'plugin:vue/recommended',
    '@vue/prettier/recommended',
    '@vue/prettier/@typescript-eslint',
    '@vue/typescript/recommended',
  ],
  rules: {
    'vue/block-lang': ['error', { script: { lang: 'ts' } }],
    'vue/component-api-style': ['error', ['composition']],
    'vue/component-name-in-template-casing': [
      'error',
      'PascalCase',
      { registeredComponentsOnly: false, ignores: ['i18n'] },
    ],
    'vue/match-component-file-name': [
      'error',
      {
        extensions: ['vue'],
        shouldMatchCase: true,
      },
    ],
    'vue/no-computed-properties-in-data': ['error'],
    'vue/no-deprecated-data-object-declaration': ['error'],
    'vue/no-deprecated-destroyed-lifecycle': ['error'],
    'vue/no-deprecated-events-api': ['error'],
    'vue/no-deprecated-filter': ['error'],
    'vue/no-deprecated-inline-template': ['error'],
    'vue/no-deprecated-props-default-this': ['error'],
    'vue/no-deprecated-router-link-tag-prop': ['error'],
    'vue/no-deprecated-scope-attribute': ['error'],
    'vue/no-deprecated-slot-attribute': ['error'],
    'vue/no-deprecated-v-bind-sync': ['error'],
    'vue/no-deprecated-v-on-number-modifiers': ['error'],
    'vue/no-deprecated-vue-config-keycodes': ['error'],
    'vue/no-empty-component-block': ['error'],
    'vue/multi-word-component-names': ['off'],
    'vue/no-template-target-blank': ['error'],
    'vue/no-unused-refs': ['error'],
    'vue/no-use-computed-property-like-method': ['error'],
    'vue/no-v-text': ['error'],
    'vue/padding-line-between-blocks': ['error', 'always'],
    'vue/require-explicit-emits': ['error'],
    'vue/v-for-delimiter-style': ['error', 'in'],
    'vue/valid-next-tick': ['error'],
    // Conflict with prettier
    'no-extra-semi': 'off',
    '@typescript-eslint/no-extra-semi': 'off',
  },
  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)',
      ],
      env: {
        jest: true,
      },
    },
  ],
}

What did you do?

<template>
  <div id="app">
    <header>
      <Navigation />
    </header>
    <main class="container-fluid mb-4" role="main">
      <RouterView />
    </main>
  </div>
</template>

<script lang="ts">
import { defineComponent } from '@vue/composition-api'

import Navigation from '@/components/app/nav/Navigation.vue'

export default defineComponent({
  name: 'App',
  components: {
    Navigation,
  },
})
</script>

What did you expect to happen?

What actually happened?

$ yarn run lint --max-warnings 0 --no-fix
yarn run v1.22.15
$ vue-cli-service lint --no-error-on-unmatched-pattern --max-warnings 0 --no-fix
 ERROR  TypeError: Cannot read properties of undefined (reading 'apiName')
Occurred while linting /builds/***/***/src/App.vue:25
TypeError: Cannot read properties of undefined (reading 'apiName')
Occurred while linting /builds/***/***/src/App.vue:25
    at Object.onVueObjectEnter (/builds/***/***/node_modules/eslint-plugin-vue/lib/rules/component-api-style.js:289:23)
    at callVisitor (/builds/***/***/node_modules/eslint-plugin-vue/lib/utils/index.js:1003:21)
    at vueVisitor.ObjectExpression (/builds/***/***/node_modules/eslint-plugin-vue/lib/utils/index.js:1045:9)
    at /builds/***/***/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/builds/***/***/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/builds/***/***/node_modules/eslint/lib/linter/node-event-generator.js:293:26)
    at NodeEventGenerator.applySelectors (/builds/***/***/node_modules/eslint/lib/linter/node-event-generator.js:322:22)
    at NodeEventGenerator.enterNode (/builds/***/***/node_modules/eslint/lib/linter/node-event-generator.js:336:14)
    at CodePathAnalyzer.enterNode (/builds/***/***/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
error Command failed with exit code 1.

Repository to reproduce this issue

(Proprietary.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions