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

[Bug] v-btn text prop wrongly converted to variant="text" #59

Open
mtdvlpr opened this issue May 5, 2023 · 9 comments
Open

[Bug] v-btn text prop wrongly converted to variant="text" #59

mtdvlpr opened this issue May 5, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@mtdvlpr
Copy link
Contributor

mtdvlpr commented May 5, 2023

When I try to use the new text prop of v-btn (<v-btn text="Click me!" />) it gets converted to <v-btn variant="text" />.

The conversion should only occur for <v-btn text /> or <v-btn :text="true" />.

@KaelWD
Copy link
Member

KaelWD commented May 5, 2023

This plugin is only really intended to be used for migration from v2-v3, not for existing v3 projects.

@mtdvlpr
Copy link
Contributor Author

mtdvlpr commented May 5, 2023

Well, I find it useful to keep using it, so I can prevent accidentally using my old knowledge of Vuetify 2.

@mtdvlpr
Copy link
Contributor Author

mtdvlpr commented May 5, 2023

Suppose you started converting your code from v2 to v3 manually and only later discovered this plugin. You wouldn't want the plugin to suddenly remove your button texts.

@KaelWD
Copy link
Member

KaelWD commented May 5, 2023

:text="variable" is replaced with :variant="variable && 'text'" so it isn't really possible to have a rule that works for both

@mtdvlpr
Copy link
Contributor Author

mtdvlpr commented May 5, 2023

No easy way to distinguish boolean variables from string variables? If not, I'll figure something out. It's not a biggie.

@KaelWD
Copy link
Member

KaelWD commented May 5, 2023

Not variables. Static strings is possible, the way rules are defined internally though is just text: { name: 'variant', value: 'text' } which is also shared with other props so probably not easy to add an override just for this.

I could add a config like 'vuetify/no-deprecated-props': ['error', { ignore: { VBtn: ['text'] } }]

@mtdvlpr
Copy link
Contributor Author

mtdvlpr commented May 5, 2023

@KaelWD the ignore config would be great!

@KaelWD KaelWD added the enhancement New feature or request label May 5, 2023
@KaelWD KaelWD self-assigned this May 5, 2023
@abea
Copy link

abea commented May 25, 2023

One solution would be to make this a special case at the warn level. The rule description could highlight that the prop has changed and direct people to manually switch to the variant prop instead. As a separate rule it could be disabled individually once the project has made the conversions. I would guess there aren't too many cases like this where a v2 prop is deprecated but there's a new v3 prop that does a totally different thing.

The ignore config would also be helpful.

@KaelWD
Copy link
Member

KaelWD commented May 25, 2023

Another option would be something like settings.vuetify.migrationMode = false
https://eslint.org/docs/latest/use/configure/configuration-files#adding-shared-settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants