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
Add new 'route-path-style' rule #369
Conversation
@bmish could you extract the changes to the existing rules to separate PRs? those changes make the review of the new rule quite a bit more complicated |
@Turbo87 good point, I removed the cleanup of other rules, which should dramatically simplify the PR diff. |
@bmish I'm wondering if we should make this rule a little more generic. this is definitely a styling rule where different developers may have different opinions and it would be bad to have a separate rule for every style. I was thinking that maybe we should rename this to I think @rwjblue was a bit skeptical about suggesting that everything should be kebab case but if we make it configurable we might persuade him that this can be a useful rule 😉 |
@Turbo87 Agreed about making the rule more generic if we are fine with allowing different styles. So I renamed the rule to |
category: 'Best Practices', | ||
recommended: false | ||
}, | ||
fixable: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be reasonably easy to fix, right? but I guess this is what you meant with "changing the behavior"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting a string to kebab case should be trivial, but yeah, I'd be worried that an autofixer for this rule would go against the following eslint principle, as it could break existing links/URLs:
Avoid any fixes that could change the runtime behavior of code and cause it to stop working.
@rwjblue I think this rule, in general, can be useful for some people so I'll go ahead and merge this. I don't think we should turn it on as a recommendation, but having it available for those people that would like to enforce this style (e.g. Square) seems reasonable to me. |
New rule:
route-path-style
Kebab-case looks like this URL: https://guides.emberjs.com/release/getting-started/core-concepts/
I'm assuming that kebab-case is the only route path format that we want to promote/enforce in Ember. This format seems to be a best practice / preference across the web, as even Google recommends it: