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

Spacing convention between element name and equal sign (div= versus div =) #81

Closed
mmzoo opened this issue Jul 16, 2018 · 3 comments
Closed

Comments

@mmzoo
Copy link
Contributor

mmzoo commented Jul 16, 2018

I noticed inconsistency when my colleagues, who are used to Haml, transision to Slim:

Notice the space before the = sign:

/ Good
div = 'This is what the official slim documentation uses consistently'

/ Bad
div= 'This works, but it should probably not be encouraged.'

/ Not affected
a href="This is still fine though, because it is an attribute"

I also noticed that my syntax highlighter (TextMate) doesn't properly recognize the non-spacing version:

screen shot 2018-07-16 at 10 14 47

Would this cop be something worth implementing?

(I tried twice to bugfix some rubocop internals and failed miserably somewhere in the AST 😂, so I cannot promise a PR, but I will try if you think this cop makes sense :)

@mmzoo mmzoo changed the title Spacing convention between element name and equal sign (div= versus div =) Spacing convention between element name and equal sign (div= versus div =) Jul 16, 2018
@sds
Copy link
Owner

sds commented Jul 17, 2018

Hey @mmzoo, happy to merge a pull request adding support for this. Thanks!

@mmzoo
Copy link
Contributor Author

mmzoo commented Jul 18, 2018

Ok, I gave it a try :) #82

sds pushed a commit that referenced this issue Jul 24, 2018
* Added control statement spacing linter #81

* More readable variable names

* Typo

* No need to match against -
@sds
Copy link
Owner

sds commented Jul 24, 2018

Implemented in #82.

@sds sds closed this as completed Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants