Skip to content

vue/valid-next-tick incorrect #1776

Closed
@zoy-l

Description

@zoy-l

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.7.0
  • **eslint-plugin-vue version:8.3.0
  • **Node version:16
  • **Operating System:macos

Please show your full configuration:

module.exports = {
  extends: [
    'plugin:vue/vue3-recommended',
    'airbnb-base',
    'plugin:@typescript-eslint/recommended',
    'prettier',
  ],

  parserOptions: {
    parser: '@typescript-eslint/parser',
    ecmaVersion: 2019,
    sourceType: 'module',
    extraFileExtensions: ['.vue'],
  },

  plugins: ['@typescript-eslint'],

  env: {
    es6: true,
    node: true,
    jest: true,
    browser: true,
  },

  rules: {
    'vue/no-v-html': 'off',
    'vue/attributes-order': 'off',
    'vue/require-v-for-key': 'off',
    'vue/require-default-prop': 'off',
    'vue/no-unused-components': 'off',
    'vue/return-in-computed-property': 'off',
  },

  overrides: [
    {
      files: ['*.vue'],
      parser: require.resolve('vue-eslint-parser'),
    },
  ],
};

What did you do?

import { defineComponent, nextTick, watch } from 'vue';

defineComponent({
  props: { value: String },
  setup(props) {
// `nextTick` is a function.eslintvue/valid-next-tick
// This should be no problem
    const tick = props.value ? nextTick : () => {};

    watch(
      () => props.value,
// Either await the Promise or pass a callback function to `nextTick`.eslintvue/valid-next-tick
// () => nextTick().then(()=>{}) ✅
// () => { nextTick() } ✅
      () => nextTick(() => {})
    );
  },
});

What did you expect to happen?

No errors

What actually happened?

nextTick is a function.eslintvue/valid-next-tick
Either await the Promise or pass a callback function to nextTick.eslintvue/valid-next-tick

Repository to reproduce this issue

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