-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Pluralization is broken #4510
Comments
Don't try to switch to the fancy |
Not sure what really the solution is, if most of the popular libs get it wrong. But I agree, bypassing the transformation with a flag seems like a nice middle ground. Not in favor of a prompt. |
Or maybe some config in package.json or elsewhere:
This also introduces the possibility of letting devs choose their naming conventions. For example: I know it makes it more complex to implement, but it has its use cases. |
People can already change all scaffolding option https://docs.adonisjs.com/guides/scaffolding |
Oh, so I think the flag is the way to go. The CLI should either use defined (or default) naming conventions and do the autofix, or skip them and use the provided name if a flag is present. |
The best option would probably be, to impement and release a decent pluralization lib based on wordnet dataset, or else. Idk if I'll find the time to do that, but that's basically the only accurate solution. Grammar rules won't ever catch all the fish there is. It could be fun to optimize this by computing a xor checksum on the diff of the dataset that works well by grammar rule computation (optimization on-disk index size), and have a lookup table for all else words that fail. Re-building the lib automatically when a new mistake is reported, for maintainers to quickly include fixes from upstream. Would be fun.. and a nice example for my brotli compress lib xD |
Seems it was fix on pluralize github version not on the npm version according to this issue |
Package version
6.2.2
Describe the bug
When I want to create new models or controllers (and probably other things), the name formatter behaves wrongly in some cases.
For example, try:
This creates
cooky.ts
!This happens for many other words, including made-up words.
I investigated a bit, and seems like the problem comes from pluralize library which is used under the hood by poppinss/utils. Pluralize was last updated in 2019, and has many open pull requests.
So, 3 possible solutions come to my mind:
make:*
commands to prevent this auto fix.Do you want to change "CookiesCOntroLLer" to "cooky"? (Y/n)
Reproduction repo
No response
The text was updated successfully, but these errors were encountered: