transform to camelCase, PascalCase and snake_case
See original GitHub issueWill prettier
consider a case transform feature?
example:
- variable names to camelCase or snake_case
- object keys names to camelCase or snake_case
- class names to PascalCase or snake_case
- class type function names to PascalCase or snake_case
I managed to toy with babylon parser’s AST to see if this was possible and had some success.
There is an eslint issue that was closed because transformations like these are unsafe.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Case Styles: Camel, Pascal, Snake, and Kebab Case
The commonly used strategies for combining words are: camel case, pascal case, snake case, and kebab case. We'll go over those here.
Read more >Convert String to Different Case Styles: Snake, Kebab, Camel ...
We will learn 4 different case styles which are: Snake case; Kebab case; Camel case; Pascal case. 1. Snake case.
Read more >Case Converter - Lower case, Upper Case, Camel ... - Fossbytes
Use this Case Converter tool to convert any written text into different letter cases like lower case, upper case, camel case, sentence case,...
Read more >Camel Case vs. Snake Case vs. Pascal Case - Khalil Stemmler
Camel case, pascal case, and snake case are the three most common naming conventions in modern programming languages.
Read more >blakeembrey/change-case: Convert strings between ... - GitHub
Convert strings between camelCase, PascalCase, Capital Case, snake_case and more ... Transform into upper case string with an underscore between words.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@j-f1 @lipis my use case was quite specific, I did not have conflicts. I used it in the process of transforming python code into javascript code (and pretty printed with prettier)
@bennyn Let me find the script for you. I don’t have one online.
Unfortunately, this is out of scope of Prettier. We are only pretty printing your code but we will never transform the AST because this would change the meaning of your code. You should probably write a codemod or something else if you want to have this functionality.