Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Fix #3409 - Sass Linting Errors #3751

Closed
wants to merge 7 commits into from
Closed

Fix #3409 - Sass Linting Errors #3751

wants to merge 7 commits into from

Conversation

seanprashad
Copy link
Contributor

@seanprashad seanprashad commented Oct 22, 2017

Resolves #3409 - Sass linting was raising multiple issues (96 issues - 22 errors & 74 warnings).

To resolve this bug, I performed the following steps:

  • Installed sass-lint globally via npm
    • Utilized the built-in CLI debugging to diagnose and fix each issue via the following command:
      sass-lint -c .sass-lint.yml 'system-addon/content-src/**/*.scss' -v -q
      (Note: the -v argument specifies verbose output)
  • Ran npm run startmc in order to build copies of my changes to mozilla-central locally
  • Referred to the sass-lint documentation (/docs/rules) to identify solutions with respect to each error
  • After all errors & warnings were resolved, I ran npm run testmc which produced the following output:
    runningunittests

@@ -18,39 +18,39 @@
}

&.icon-bookmark-added {
background-image: url('chrome://browser/skin/bookmark.svg');
background-image: url('chrome://browser/skin/bookmark.svg');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these close braces } need to be indented 1 more space to match the opening brace line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes updated in c882ccf

&:hover, &:focus, &.active {
&:hover,
&:focus,
&.active {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should switch these types of selectors to something like &:-moz-any(.active, :focus, :hover) {. The generated css before/after:

-    .top-sites-list .top-site-outer:hover .tile, .top-sites-list .top-site-outer:focus .tile, .top-sites-list .top-site-outer.active .tile {
+    .top-sites-list .top-site-outer:-moz-any(.active, :hover, :focus) .tile {
-    .top-sites-list .top-site-outer:hover .edit-menu, .top-sites-list .top-site-outer:focus .edit-menu, .top-sites-list .top-site-outer.active .edit-menu {
+    .top-sites-list .top-site-outer:-moz-any(.active, :hover, :focus) .edit-menu {
-    .top-sites-list .top-site-outer:hover .context-menu-button, .top-sites-list .top-site-outer:focus .context-menu-button, .top-sites-list .top-site-outer.active .context-menu-button {
+    .top-sites-list .top-site-outer:-moz-any(.active, :hover, :focus) .context-menu-button {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increased brevity is always a plus - let me know if you'd like for the changes to be implemented and I'll get on it!

fill: $fill-primary;
}

&[aria-expanded='true'] + .info-option {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the refactoring above, this should be able to be nested in the above section &[aria-expanded='true'] { as + .info-option {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved with commit ff5b0da!

@@ -59,7 +62,7 @@
&::after {
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
bottom: 0;
content: " ";
content: ' ';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea if having content: '' vs content: ' ' makes any differences in the places we're touching here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question - I'm now wondering that myself.

I assume an empty set of single quotes would render no characters at all and for the latter, a single white space (ASCII value of 32).

Question that needs to be asked now is if we need that single white space and what purpose does it serve?

Edit: Food for thought - would content: none be more appropriate? (MDN docs)

@@ -75,7 +75,7 @@

&.icon-trending {
background-image: url('#{$image-path}glyph-trending-16.svg');
transform: translateY(2px); /* trending bolt is visually top heavy */
transform: translateY(2px); // trending bolt is visually top heavy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose to be explicit, the // quotes are removed from the generated file whereas /* */ comments remain. Just making sure that's desired. @k88hudson ?

@@ -47,7 +47,7 @@
fill: $fill-primary;
}

&[aria-expanded='true'] + .info-option {
.info-option {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two are not the same before/after. Note the +.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with commit cb06173

@Mardak
Copy link
Member

Mardak commented Oct 23, 2017

On that note of the previous commit, how have you been testing these changes to make sure they don't regress look and functionality?

@seanprashad
Copy link
Contributor Author

@Mardak I had npm run startmc running in the background during earlier commits and built activity stream after making changes via npm run buildmc. I then built and ran my local version of Firefox and opened a new tab to see if anything had broken. I didn't for the previous commit but will make sure to test changes for each commit in the future.

@Mardak
Copy link
Member

Mardak commented Nov 21, 2017

@seanprashad thanks for the work here. I rebased your commits in #3871 as the sass-lint dependency was out of date and there were some recent additions. I'll squash the changes into your first commit that you authored.

@Mardak Mardak closed this Nov 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix sass linting
2 participants