Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

vue/no-undef-properties in v9.30 still emits error for Vuex mutation or getter #2600

Copy link
Copy link
Open
@tmcdos

Description

@tmcdos
Issue body actions

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: 8.57.1
  • eslint-plugin-vue version: 9.30.0
  • Vue version: 2.6.12
  • Node version: 18.19.1
  • Operating System: Windows 7 Professional x64 SP1

Please show your full configuration:

// https://eslint.org/docs/user-guide/configuring
const path = require('path');

module.exports = {
  root: true,
  parserOptions: {
    parser: '@babel/eslint-parser',
    ecmaVersion: 2020,
    requireConfigFile: false,
    babelOptions:
    {
      configFile: path.resolve(__dirname, './babel.config.js')
    }
  },
  env:
  {
    browser: true,
    node: true,
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/recommended',
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    '@vue/eslint-config-standard',
  ],
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    semi: ['error', 'always'],
    'brace-style': ['error', 'allman'],
    'space-before-function-paren': ['error', {
      anonymous: 'never',
      named: 'never',
      asyncArrow: 'always'
    }],
    'object-curly-newline': [
      'error',
      {
        ObjectExpression: {
          multiline: true,
          minProperties: 2,
          consistent: true
        },
        ObjectPattern: { multiline: true },
        ImportDeclaration: { multiline: true },
        ExportDeclaration: {
          multiline: true,
          minProperties: 3
        }
      }
    ],
    'object-property-newline': [
      'error',
      { allowAllPropertiesOnSameLine: false }
    ],
    'comma-dangle': [
      'error',
      {
        arrays: 'only-multiline',
        objects: 'only-multiline',
        imports: 'never',
        exports: 'never',
        functions: 'never'
      }
    ],
    quotes: [
      'error',
      'single',
      {
        avoidEscape: true,
        allowTemplateLiterals: true
      }
    ],
    'one-var': [
      'error',
      {
        uninitialized: 'always',
        initialized: 'never'
      }
    ],

    'block-scoped-var': "error",
    'default-param-last': ["error"],
    'func-names': ["error", "as-needed"],
    'func-style': ["error", "declaration", { "allowArrowFunctions": true }],
    'max-statements-per-line': ["error", { "max": 1 }],
    'no-confusing-arrow': "error",
    'no-constant-binary-expression': "error",
    'no-dupe-else-if': "error",
    'no-lonely-if': "error",
    'no-loop-func': "error",
    'nonblock-statement-body-position': ["error", "beside"],
    'no-negated-in-lhs': "error",
    'no-shadow': "error",
    'no-spaced-func': "error",
    'no-unsafe-optional-chaining': ["error", { "disallowArithmeticOperators": true }],
    'no-useless-concat': "error",
    'semi-style': ["error", "last"],
    'vars-on-top': "error",

    'vue/no-undef-properties': 'error',
  }
}

What did you do?

import Vue from 'vue';
import App from './App.vue';
import store from './store/store';
import { mapGetters, mapMutations } from 'vuex';

new Vue({
  name: 'RootVue',
  computed:
  {
    ...mapGetters(['getCountryMap']),
  },
  watch:
  {
    getCountryMap()
    {
      this.updatePrefix();
    },
  },
  created()
  {
    this.setCountries([]);
  },
  methods:
  {
    ...mapMutations(['setCountries']),
    updatePrefix()
    {
      //
    },
  },
  store,
  render: h => h(App)
}).$mount('#app');

What did you expect to happen?
I expect no linting error of type vue/no-undef-properties to be reported for lines 14:5 and 21:10

What actually happened?

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR in [eslint]
Z:\_\src\main.js
  14:5   error  'getCountryMap' is not defined  vue/no-undef-properties
  21:10  error  'setCountries' is not defined   vue/no-undef-properties

✖ 2 problems (2 errors, 0 warnings)


webpack compiled with 1 error

shot-1

Repository to reproduce this issue

https://codesandbox.io/p/devbox/gallant-swirles-ljp5n5

shot-2

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.