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

[Update] Make vue/prop-name-casing fixable #402

Merged
merged 20 commits into from
Mar 21, 2018

Conversation

ota-meshi
Copy link
Member

@ota-meshi ota-meshi commented Feb 22, 2018

This PR makes vue/prop-name-casing fixable.
This implements autofix of rules proposed in #252

michalsnik and others added 17 commits January 28, 2018 23:55
* [Update] Make `vue/max-attributes-per-line` fixable

* [fix] bug and style

* [fix] Switch indent calculation method with node and attribute

* [fix] don't handle indentation

* [add] autofix test max-attributes-per-line.js
* [Update] Make `vue/order-in-components` fixable

This Commit makes `vue/order-in-components` fixable.
In case of `The "A" property should be above the "B" property` error, autofix will move A before B

* [fix] fail test at [email protected]

* [fix] If there is a possibility of a side effect, don't autofix

* [fix] failed test at node v4

* [update] use Traverser

* [fix] failed test [email protected]

* [fix] I used `output: null` to specify "not fix"
},
fix: canFixPropertyName(item) ? fixer => {
return item.key.type === 'Literal'
? fixer.replaceText(item.key, item.key.raw.replace(item.key.value, convertedName))
Copy link
Member

Choose a reason for hiding this comment

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

If the original name is "🍻", what does it happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why!? It became "" !!!
Emoji is difficult...

@ota-meshi
Copy link
Member Author

Thanks for review!
I changed it. to auto-fix if only for ASCII printable characters.

output: null,
parserOptions,
errors: [{
// bug ?
Copy link
Member

Choose a reason for hiding this comment

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

I guess so, it shouldn't throw error in this case I think.

Copy link
Member

Choose a reason for hiding this comment

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

But we can deal with it in separate task.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your view
I wrote an issue #442

Copy link
Member

@michalsnik michalsnik 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 ✌️

@F3n67u
Copy link

F3n67u commented Dec 8, 2018

Make prop-name-casing fixable is very dangerous, because the fix code only fix the props name and leave the reference code same. I think the fix should leave to manual, we just show the alert and do nothing else.

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.

6 participants