From 325191dd4cde7fef3c6c2db340e5acf78247a365 Mon Sep 17 00:00:00 2001
From: Takuya Noguchi <tak.noguchi.iridge@gmail.com>
Date: Sun, 9 Jul 2017 17:30:05 +0900
Subject: [PATCH] Enable UnnecessaryParentReference in scss-lint

---
 .scss-lint.yml                                                | 2 +-
 app/assets/stylesheets/framework/filters.scss                 | 4 ++--
 app/assets/stylesheets/framework/highlight.scss               | 2 +-
 app/assets/stylesheets/pages/merge_requests.scss              | 2 +-
 app/assets/stylesheets/pages/notes.scss                       | 2 +-
 app/assets/stylesheets/pages/pipeline_schedules.scss          | 4 ++--
 app/assets/stylesheets/pages/projects.scss                    | 4 ++--
 app/assets/stylesheets/pages/todos.scss                       | 2 +-
 app/assets/stylesheets/pages/wiki.scss                        | 4 ++--
 .../enable-scss-lint-unnecessary-parent-reference.yml         | 4 ++++
 10 files changed, 17 insertions(+), 13 deletions(-)
 create mode 100644 changelogs/unreleased/enable-scss-lint-unnecessary-parent-reference.yml

diff --git a/.scss-lint.yml b/.scss-lint.yml
index db234ad739c..da751bc1c58 100644
--- a/.scss-lint.yml
+++ b/.scss-lint.yml
@@ -240,7 +240,7 @@ linters:
   # Do not use parent selector references (&) when they would otherwise
   # be unnecessary.
   UnnecessaryParentReference:
-    enabled: false
+    enabled: true
 
   # URLs should be valid and not contain protocols or domain names.
   UrlFormat:
diff --git a/app/assets/stylesheets/framework/filters.scss b/app/assets/stylesheets/framework/filters.scss
index f05348ee4e3..7e4e5fd7f1c 100644
--- a/app/assets/stylesheets/framework/filters.scss
+++ b/app/assets/stylesheets/framework/filters.scss
@@ -368,7 +368,7 @@
     margin-right: 0.3em;
   }
 
-  & > .value {
+  > .value {
     font-weight: 600;
   }
 }
@@ -467,7 +467,7 @@
     -webkit-flex-direction: column;
     flex-direction: column;
 
-    &> span {
+    > span {
       white-space: normal;
       word-break: break-all;
     }
diff --git a/app/assets/stylesheets/framework/highlight.scss b/app/assets/stylesheets/framework/highlight.scss
index 6d27d7568cf..71d5949b023 100644
--- a/app/assets/stylesheets/framework/highlight.scss
+++ b/app/assets/stylesheets/framework/highlight.scss
@@ -61,7 +61,7 @@
       &:focus {
         outline: none;
 
-        & i {
+        i {
           visibility: visible;
         }
       }
diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss
index 7adf17dddb8..a8e72f13136 100644
--- a/app/assets/stylesheets/pages/merge_requests.scss
+++ b/app/assets/stylesheets/pages/merge_requests.scss
@@ -96,7 +96,7 @@
       overflow: visible;
     }
 
-    & > span {
+    > span {
       padding-right: 4px;
     }
 
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 303425041df..64a48e226bc 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -250,7 +250,7 @@ ul.notes {
       }
 
       .note-text {
-        & p:first-child {
+        p:first-child {
           display: none;
         }
 
diff --git a/app/assets/stylesheets/pages/pipeline_schedules.scss b/app/assets/stylesheets/pages/pipeline_schedules.scss
index dc719a6ba94..284b38ad370 100644
--- a/app/assets/stylesheets/pages/pipeline_schedules.scss
+++ b/app/assets/stylesheets/pages/pipeline_schedules.scss
@@ -96,12 +96,12 @@
   }
 
   &:last-child {
-    & .pipeline-variable-row-remove-button {
+    .pipeline-variable-row-remove-button {
       display: none;
     }
 
     @media (max-width: $screen-sm-max) {
-      & .pipeline-variable-value-input {
+      .pipeline-variable-value-input {
         margin-right: $pipeline-variable-remove-button-width;
       }
     }
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index 7d7c34115f9..46434eab8f3 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -26,7 +26,7 @@
       margin-bottom: 5px;
     }
 
-    & > .form-group {
+    > .form-group {
       padding-left: 0;
     }
 
@@ -83,7 +83,7 @@
       border: 1px solid $border-color;
     }
 
-    & + .select2 a {
+    + .select2 a {
       border-top-left-radius: 0;
       border-bottom-left-radius: 0;
     }
diff --git a/app/assets/stylesheets/pages/todos.scss b/app/assets/stylesheets/pages/todos.scss
index de652a79369..d7a9dda3770 100644
--- a/app/assets/stylesheets/pages/todos.scss
+++ b/app/assets/stylesheets/pages/todos.scss
@@ -81,7 +81,7 @@
   .todo-title {
     display: flex;
 
-    & > .title-item {
+    > .title-item {
       -webkit-flex: 0 0 auto;
       flex: 0 0 auto;
       margin: 0 2px;
diff --git a/app/assets/stylesheets/pages/wiki.scss b/app/assets/stylesheets/pages/wiki.scss
index 94d0a39f397..45c21c5d274 100644
--- a/app/assets/stylesheets/pages/wiki.scss
+++ b/app/assets/stylesheets/pages/wiki.scss
@@ -147,13 +147,13 @@
 }
 
 ul.wiki-pages-list.content-list {
-  & ul {
+  ul {
     list-style: none;
     margin-left: 0;
     padding-left: 15px;
   }
 
-  & ul li {
+  ul li {
     padding: 5px 0;
   }
 }
diff --git a/changelogs/unreleased/enable-scss-lint-unnecessary-parent-reference.yml b/changelogs/unreleased/enable-scss-lint-unnecessary-parent-reference.yml
new file mode 100644
index 00000000000..59d5df56525
--- /dev/null
+++ b/changelogs/unreleased/enable-scss-lint-unnecessary-parent-reference.yml
@@ -0,0 +1,4 @@
+---
+title: Enable UnnecessaryParentReference in scss-lint
+merge_request: 12738
+author: Takuya Noguchi
-- 
GitLab