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

fix(order-in-components): allow autofix with TypeScript PropType #1955

Merged

Conversation

acupofspirt
Copy link
Contributor

@acupofspirt acupofspirt commented Aug 31, 2022

In the following code vue/order-in-components rule can't be autofixed because of as PropType:

import { defineComponent, PropType } from 'vue'

export defineComponent({
  setup () {},

  props: {
    someProp: { 
      type: Array as PropType<string[]>
    }
  }
})

TSAsExpression node is considered as not side-effects free. This PR fixes it.

@ota-meshi
Copy link
Member

Thank you for this PR. Could you please add test cases?

@acupofspirt
Copy link
Contributor Author

ota-meshi tests done

tests/lib/autofix.js Outdated Show resolved Hide resolved
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@ota-meshi
Copy link
Member

ts-eslint-v4 error is fixed in #1956.

@FloEdelmann FloEdelmann changed the title fix(order-in-components): allow autofix with typescript PropType helper fix(order-in-components): allow autofix with TypeScript PropType Sep 2, 2022
@FloEdelmann FloEdelmann merged commit 2f55173 into vuejs:master Sep 2, 2022
@acupofspirt acupofspirt deleted the prop-types-for-order-in-components branch September 2, 2022 10:40
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

Successfully merging this pull request may close these issues.

None yet

3 participants