Skip to content

no-ref-as-operand fails to trigger depending on boolean operator order #2599

Closed as not planned
@tiagoroldao

Description

@tiagoroldao

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: 9.30.0
  • Vue version: 2.7.16
  • Node version: 18
  • Operating System: macos

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: ['plugin:vue/essential', '@vue/typescript', '@vue/prettier',],
  rules: {
    'no-console': 'warn',
    'no-debugger': 'warn',
    'no-unused-vars': 'off',
    '@typescript-eslint/no-unused-vars': [
      'warn',
      {
        argsIgnorePattern: '^_',
        caughtErrorsIgnorePattern: '^_',
        destructuredArrayIgnorePattern: '^_',
        varsIgnorePattern: '^_',
        ignoreRestSiblings: true,
      },
    ],
    'spaced-comment': ['warn', 'always'],
    'vue/valid-v-slot': [
      'error',
      {
        allowModifiers: true,
      },
    ],
    'vue/no-ref-as-operand': 'warn',
    'vue/component-name-in-template-casing': ['error', 'PascalCase', { registeredComponentsOnly: false }],
    'vue/custom-event-name-casing': ['error', 'kebab-case'],
    'vue/padding-line-between-blocks': ['error', 'always'],
  },
  parserOptions: {
    parser: '@typescript-eslint/parser',
  },
};

What did you do?

// `isUpdating` is a ComputedRef

function onValidationChanged() {
  config.value.steps.forEach((step, index) => {
    if (index <= stepIndex.value || isUpdating) {
      step.state = validations.value[index]?.$invalid ? 'invalid' : 'valid';
    }
  });
}

What did you expect to happen?
vue/no-ref-as-operand to be trigered on isUpdating

What actually happened?

No error is found. It is found if the order is reversed, though. Below are IDE snapshots for clarity, but this happens when running eslint via CLI on the file too:

Screenshot 2024-11-06 at 13 16 55
Screenshot 2024-11-06 at 13 16 40

Repository to reproduce this issue

Can provide one if requested.

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