From f73a00dceecc56a101a00d854eebb8fe60c45e4c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 22 Jun 2021 14:23:12 +0200 Subject: [PATCH] [stylelint] disable role 'no-descending-specificity' This patch disables role 'no-descending-specificity'. IMO it is better to have this rule active (see below [1]), but it is hard to rewrite the less files to pass this rule, so for the first I chose to disable this rule. --- Source order is important in CSS, and when two selectors have the same specificity, the one that occurs last will take priority. However, the situation is different when one of the selectors has a higher specificity. In that case, source order does not matter: the selector with higher specificity will win out even if it comes first. The clashes of these two mechanisms for prioritization, source order and specificity, can cause some confusion when reading stylesheets. If a selector with higher specificity comes before the selector it overrides, we have to think harder to understand it, because it violates the source order expectation. Stylesheets are most legible when overriding selectors always come after the selectors they override. That way both mechanisms, source order and specificity, work together nicely. This rule enforces that practice as best it can, reporting fewer errors than it should. It cannot catch every actual overriding selector, but it can catch certain common mistakes. [1] https://stylelint.io/user-guide/rules/list/no-descending-specificity/ Signed-off-by: Markus Heiser --- searx/static/themes/simple/src/less/code.less | 1 + searx/static/themes/simple/src/less/style.less | 2 ++ searx/static/themes/simple/src/less/toolkit.less | 3 +++ 3 files changed, 6 insertions(+) diff --git a/searx/static/themes/simple/src/less/code.less b/searx/static/themes/simple/src/less/code.less index 37467b0a2..f4e6735ba 100644 --- a/searx/static/themes/simple/src/less/code.less +++ b/searx/static/themes/simple/src/less/code.less @@ -5,4 +5,5 @@ border: inherit; } +// stylelint-disable no-invalid-position-at-import-rule @import "../generated/pygments.less"; diff --git a/searx/static/themes/simple/src/less/style.less b/searx/static/themes/simple/src/less/style.less index 2f91d36c0..49e81acbd 100644 --- a/searx/static/themes/simple/src/less/style.less +++ b/searx/static/themes/simple/src/less/style.less @@ -4,6 +4,8 @@ * To convert "style.less" to "style.css" run: $make styles */ +// stylelint-disable no-descending-specificity + @stacked-bar-chart: rgb(0, 0, 0); @import "../../__common__/less/new_issue.less"; diff --git a/searx/static/themes/simple/src/less/toolkit.less b/searx/static/themes/simple/src/less/toolkit.less index 5f5ee2dfc..8a5a7ef38 100644 --- a/searx/static/themes/simple/src/less/toolkit.less +++ b/searx/static/themes/simple/src/less/toolkit.less @@ -1,4 +1,7 @@ // other solution : http://stackoverflow.com/questions/1577598/how-to-hide-parts-of-html-when-javascript-is-disabled/13857783#13857783 + +// stylelint-disable no-descending-specificity + html.no-js .hide_if_nojs { display: none; }