-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
new rule: space before (certain) keywords #1631
Comments
You're right, though might be better to have a single rule do both. |
agreed |
Just |
Config for this should look something like: "space-keywords" : [2, "before/after/both"] |
Seems like this is only related to keywords after a block statement. I think a rule like |
@gcochard The config should also accept |
While the |
@lo1tuma I'm not sold. Having space-keywords: [2, {
after: ["if"],
before: ["catch"]
} Seems like it would both make sense from a user perspective and be pretty easy to implement. |
@nzakas Your suggested configuration doesn’t work because you have to specify "space-keywords": [2, {
"after": {
"if": "always",
"else": "never"
},
"before": {
"if": "never",
"else": "always"
}
} I don’t like such complicated configurations. @michaelficarra: Thanks, good to know. Maybe |
I don't think always/never is necessary. The ones you list should have spaces and the ones you don't shouldn't. |
We have an edge case with the function keyword where the default should be "don’t care" instead of "always" or "never". |
Yeah, function is weird. I'm wondering if that should be handled by space-function-name instead, to encapsulate all spacing related to function. |
+1 on this |
Thanks, +1s don't actually change anything. This issue is marked as accepted, which means it will get done when someone claims it. |
If we want to remove |
Or we just add I'd say if someone wants to drive this starting now, fine, but if it sits, then it will be post 1.0.0 |
+1 |
@mmrko, would you like to make an attempt at a solution? If the rule is important to you, the best way to get it implemented is to jump in and try it out. :) |
Okay, I'll take a stab at this :) |
Related PR: #3576 |
New: `space-before-keywords` rule (fixes #1631)
There's a rule for
space-after-keywords
, but it seems to me it enforces just one half of the same styleguide, because it doesn't require space before keywords likeelse
,catch
, andfinally
.Therefore, we probably should have a rule like
space-before-keywords
.Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: