Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue 3.3 require-default-prop doesn't scan for extended prop type #2169

Closed
2 tasks done
VividLemon opened this issue May 13, 2023 · 3 comments
Closed
2 tasks done

Vue 3.3 require-default-prop doesn't scan for extended prop type #2169

VividLemon opened this issue May 13, 2023 · 3 comments

Comments

@VividLemon
Copy link

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.40.0
  • eslint-plugin-vue version: ^9.12.0",
  • Node version: 18
  • Operating System: Linux

Please show your full configuration:

/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

const {defineConfig} = require('eslint-define-config')

module.exports = defineConfig({
  root: true,
  extends: [
    'eslint:recommended',
    'plugin:vue/vue3-recommended',
    '@vue/eslint-config-typescript/recommended',
    '@vue/eslint-config-prettier',
  ],
  parserOptions: {
    ecmaVersion: 11,
  },
  rules: {
    'prettier/prettier': [
      'warn',
      {
        endOfLine: 'auto',
      },
    ],
    'no-alert': 'warn',
    'no-console': 'warn',
    'no-debugger': 'warn',
    'arrow-body-style': 'warn',
    'arrow-parens': 'warn',
    'eqeqeq': 'error',
    'generator-star-spacing': 'warn',
    'grouped-accessor-pairs': 'warn',
    'no-caller': 'error',
    'no-duplicate-imports': 'error',
    'no-else-return': 'warn',
    'no-eval': 'error',
    'no-extra-bind': 'warn',
    'no-implied-eval': 'error',
    'no-labels': 'warn',
    'no-lone-blocks': 'warn',
    'no-new-func': 'error',
    'no-new-wrappers': 'error',
    'no-return-await': 'warn',
    'no-template-curly-in-string': 'warn',
    'no-throw-literal': 'error',
    'no-undef-init': 'warn',
    'no-useless-call': 'warn',
    'no-useless-constructor': 'warn',
    'no-useless-rename': 'warn',
    'no-useless-return': 'warn',
    'no-var': 'error',
    'object-shorthand': 'warn',
    'prefer-const': 'warn',
    'prefer-destructuring': 'warn',
    'prefer-numeric-literals': 'warn',
    'prefer-rest-params': 'warn',
    'prefer-spread': 'warn',
    'prefer-template': 'warn',
    'require-atomic-updates': 'warn',
    'rest-spread-spacing': 'warn',
    'sort-imports': [
      'warn',
      {
        ignoreCase: true,
        ignoreDeclarationSort: true,
      },
    ],
    'template-curly-spacing': 'warn',
    'yield-star-spacing': 'warn',
    'yoda': 'warn',
    'vue/html-self-closing': [
      'error',
      {
        html: {
          void: 'always',
          normal: 'always',
          component: 'always',
        },
        svg: 'always',
        math: 'always',
      },
    ],
    'vue/eqeqeq': 'error',
  },
})

What did you do?

export interface BFormProps {
  id?: string
  floating?: Booleanish
  novalidate?: Booleanish
  validated?: Booleanish
}
//
interface Props extends BFormProps {
  role?: string
}
const props = withDefaults(defineProps<Props>(), {
  id: undefined,
})

What did you expect to happen?
To give out a warning as id, floating, novalidate, validated do not have default values

What actually happened?

No warn

Repository to reproduce this issue

A full repository is a bit overkill, as you can just reproduce the issue with:

const props = withDefaults(defineProps<{id?: string} & {role?: string}>(), {
  role: undefined,
})
@VividLemon
Copy link
Author

Or following the Vue 3.3 announcement:

<script setup lang="ts">
import type { Props } from './foo'

// imported + intersection type
defineProps<Props & { extraProp?: string }>()
</script>

https://blog.vuejs.org/posts/vue-3-3#imported-and-complex-types-support-in-macros

@VividLemon
Copy link
Author

I'm not 100% sure if #2134 covers this issue.

@ota-meshi
Copy link
Member

Duplicate of #2127

@ota-meshi ota-meshi marked this as a duplicate of #2127 May 13, 2023
@ota-meshi ota-meshi closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants