Skip to content

vue/object-curly-spacing throws an error for certain objectsInObjects values #1514

Closed
@r-thomson

Description

@r-thomson

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.28.0
  • eslint-plugin-vue version: 7.11.0
  • Node version: 16.2.0
  • Operating System: macOS 10.15.7

Please show your full configuration:

{
  extends: [
    'plugin:vue/base'
  ],
  rules: {
    'vue/object-curly-spacing': ['error', 'always', {
      objectsInObjects: false
    }]
  }
}

This issue also occurs with this version of the rule as well:

'vue/object-curly-spacing': ['error', 'never', {
  objectsInObjects: true
}]

What did you do?

<template>
  <div v-bind="{ foo: { bar: 'baz' }}">
    Hello World
  </div>
</template>

What did you expect to happen?

The linter should not crash, and no code errors should be reported

What actually happened?

Oops! Something went wrong! :(

ESLint: 7.28.0

TypeError: Cannot read property 'type' of null
Occurred while linting ./Component.vue:1
    at validateBraceSpacing (./node_modules/eslint/lib/rules/object-curly-spacing.js:187:119)
    at checkForObject (./node_modules/eslint/lib/rules/object-curly-spacing.js:237:13)
    at EventEmitter.handlers.<computed> (./node_modules/eslint-plugin-vue/lib/utils/index.js:297:15)
    at EventEmitter.emit (node:events:365:28)
    at NodeEventGenerator.applySelector (./node_modules/vue-eslint-parser/index.js:3577:26)
    at NodeEventGenerator.applySelectors (./node_modules/vue-eslint-parser/index.js:3591:22)
    at NodeEventGenerator.enterNode (./node_modules/vue-eslint-parser/index.js:3599:14)
    at traverse (./node_modules/vue-eslint-parser/index.js:115:13)
    at traverse (./node_modules/vue-eslint-parser/index.js:127:13)
    at traverse (./node_modules/vue-eslint-parser/index.js:127:13)

Repository to reproduce this issue

https://github.com/r-thomson/eslint-plugin-vue-object-curly-spacing-demo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions