Problem/Motivation

fix css lint issues:
Line Column Message
53 1 Heading (h1) has already been defined.
57 1 Heading (h2) has already been defined.
61 1 Heading (h3) has already been defined.
65 1 Heading (h4) has already been defined.
69 1 Heading (h5) has already been defined.
73 1 Heading (h6) has already been defined.
undefined undefined You have 2 h1s, 2 h2s, 2 h3s, 2 h4s, 2 h5s, 2 h6s defined in this stylesheet.

Proposed resolution

rewrite the h1-h6 selectors

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
csslint-elements-css-seven.diff981 bytesmortendk

Comments

joelpittet’s picture

Status: Needs review » Needs work

Same as #2422381: elements.css css lint fix bartik

This seems a bit wasteful to me... maybe don't believe all csslint's recommendations? Judgement call on this one needed.

With the duplicate properties, there is more chance of inconsistencies.

joelpittet’s picture

Status: Needs work » Reviewed & tested by the community

Change of heart here too:

  • It helps be consistent with CSS lint
  • The margin should probably be not based on the font-size anyways, so that should change for better Vertical Rhythem later, so they will or could be different.
  • And the inherit change is just one property so feels a bit wasteful at that point.
tim.plunkett’s picture

Reading #2222049: Add a .csslintrc file that's in line with our CSS standards, the issue summary says duplicate-properties - true .
However, @sqndr changed that to false in his patch, and never updated the issue summary.

We should switch that back to true, and close this issue.

joelpittet’s picture

Assigned: Unassigned » lewisnyman

@LewisNyman, can you confirm and close? And is that true for your "lint trap" site?
http://lewisnyman.co.uk/drupalcore-frontend-toolkit/

lewisnyman’s picture

Assigned: lewisnyman » Unassigned

In the #2222049: Add a .csslintrc file that's in line with our CSS standards, the original suggestion was always intended to be the beginning of a discussion. I think that we should reassess which CSSLint rules we follow and which ones we don't as we refactor the code.

I don't want to be bound by previous decisions, especially when the original issue was very quiet. We've discussed the intentions of this csslint rule in detail and I think it fits with the intentions of our CSS standards. I think we should keep the rule in place and commit this issue.

And is that true for your "lint trap" site?

The linting workflow pulls the configuration in the .csslintrc file in HEAD, see: https://github.com/lewisnyman/drupalcore-frontend-toolkit/blob/master/gu...

tim.plunkett’s picture

We've discussed the intentions of this csslint rule in detail

Where is this discussion posted? I could not find any links to it on the issue that added the .csslintrc file.

lewisnyman’s picture

Ah yeah sorry, we discussed the same changes in this issue: #2422381: elements.css css lint fix bartik

tim.plunkett’s picture

I think blindly following some of these upstream rules without wide community discussion is wrong, and defeats the purpose of having a community CSS standard.

But that's apparently just my opinion.

mortendk’s picture

I wouldn't call it blindly. afaik there's a wide acceptance in the Frontend world that hardcore ccslint is rough but will force better & cleaner CSS.

I'm a fan even that It makes me cry

lewisnyman’s picture

I think blindly following some of these upstream rules without wide community discussion is wrong, and defeats the purpose of having a community CSS standard.

Do you mean wide discussion in #2222049: Add a .csslintrc file that's in line with our CSS standards? I agree, that's why it's good that we question/discuss these rules in issues like #2422381: elements.css css lint fix bartik.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

The issues Tim's raising have been raised in multiple other issues. However, consensus in other issues has been to go ahead with csslint. I'm intending to commit these patches to get them out of the way, so we can then take a broader look and see where we're at. If it turns out this is causing more harm than good, we can adjust. I do know jslint has been really helpful, especially considering most Drupal people are not JS people (nor are they CSS people).

Committed and pushed to 8.0.x. Thanks!

  • webchick committed bfcf67e on 8.0.x
    Issue #2422377 by mortendk: elements.css css lint fix
    
lewisnyman’s picture

However, consensus in other issues has been to go ahead with csslint.

Ah maybe I understand the concerns a little better today, the aim is not to follow csslint blindly, only to use csslint as a tool to help contributors follow our agreed CSS standards. That was the intention behind #2222049: Add a .csslintrc file that's in line with our CSS standards and something we can continue to refine as we move forward in these issues. A good example might be the !important rule, which sounds good in theory but there are actually some parts of the SMACSS methodology that allow !important:

Since the state will likely need to override the style of a more complex rule set, the use of !important is allowed and, dare I say, recommended. (I used to say that !important was never needed but on complex systems, it is often a necessity.) You won’t normally have two states applied to the same module or two states that tend to affect the same set of styles, so specificity conflicts from using !important should be few and far between.

With that said, be cautious. Leave !important off until you actually and truly need it (and you will see why in this next example). Remember, the use of !important should be avoided for all other rule types. Only states should have it.

If we follow CSSlint without questioning it, we would be acting against our agreed CSS standards, so in this situation that best thing to do would be to modify the .csslintrc file to remove this rule.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.