Showing 5,697 of 5,698 total issues
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child,
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap p#colophon a" to come before selector ".swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover" (no-descending-specificity) Open
.swagger-ui-wrap p#colophon a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap p#colophon a" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a" (no-descending-specificity) Open
.swagger-ui-wrap p#colophon a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap p#colophon a" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a" (no-descending-specificity) Open
.swagger-ui-wrap p#colophon a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap p#colophon a" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a" (no-descending-specificity) Open
.swagger-ui-wrap p#colophon a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap form.form_box p a" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a" (no-descending-specificity) Open
.swagger-ui-wrap form.form_box p a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".markdown-body pre" to come before selector ".markdown-body .highlight pre" (no-descending-specificity) Open
.markdown-body pre {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Unexpected duplicate selector ".markdown-body strong", first used at line 204 (no-duplicate-selectors) Open
.markdown-body strong {
- Read upRead up
- Exclude checks
no-duplicate-selectors
Disallow duplicate selectors within a stylesheet.
<!-- prettier-ignore -->.foo {} .bar {} .foo {}
/** ↑ ↑
* These duplicates */
This rule checks for two types of duplication:
- Duplication of a single selector with a rule's selector list, e.g.
a, b, a {}
. - Duplication of a selector list within a stylesheet, e.g.
a, b {} a, b {}
. Duplicates are found even if the selectors come in different orders or have different spacing, e.g.a d, b > c {} b>c, a d {}
.
The same selector is allowed to repeat in the following circumstances:
- It is used in different selector lists, e.g.
a {} a, b {}
. - The duplicates are determined to originate in different stylesheets, e.g. you have concatenated or compiled files in a way that produces sourcemaps for PostCSS to read, e.g. postcss-import.
- The duplicates are in rules with different parent nodes, e.g. inside and outside of a media query.
This rule resolves nested selectors. So a b {} a { & b {} }
counts as a violation, because the resolved selectors end up with a duplicate.
Unexpected duplicate "line-height" (declaration-block-no-duplicate-properties) Open
line-height: 1.5;
- Read upRead up
- Exclude checks
declaration-block-no-duplicate-properties
Disallow duplicate properties within declaration blocks.
<!-- prettier-ignore -->a { color: pink; color: orange; }
/** ↑ ↑
* These duplicated properties */
This rule ignores variables ($sass
, @less
, --custom-property
).
Expected selector ".header a" to come before selector ".navigation a:active" (no-descending-specificity) Open
a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Unexpected unknown type selector "---" (selector-type-no-unknown) Open
---
- Read upRead up
- Exclude checks
selector-type-no-unknown
Disallow unknown type selectors.
<!-- prettier-ignore -->unknown {}
/** ↑
* This type selector */
This rule considers tags defined in the HTML, SVG, and MathML specifications to be known.
Expected selector ".swagger-ui-wrap h2 span.sub a" to come before selector ".swagger-ui-wrap .model-signature .signature-nav a:hover" (no-descending-specificity) Open
.swagger-ui-wrap h2 span.sub a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource div.heading h2 a" to come before selector ".swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource div.heading h2 a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover" to come before selector ".swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a {
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover,
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.
Expected selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active" to come before selector ".swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover" (no-descending-specificity) Open
.swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,
- Read upRead up
- Exclude checks
no-descending-specificity
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
<!-- prettier-ignore -->#container a { top: 10px; } a { top: 0; }
/** ↑ ↑
* The order of these selectors represents descending specificity */
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.
How it works
This rule looks at the last compound selector in every full selector, and then compares it with other selectors in the stylesheet that end in the same way.
So .foo .bar
(whose last compound selector is .bar
) will be compared to .bar
and #baz .bar
, but not to #baz .foo
or .bar .foo
.
And a > li#wag.pit
(whose last compound selector is li#wag.pit
) will be compared to div li#wag.pit
and a > b > li + li#wag.pit
, but not to li
or li #wag
, etc.
Selectors targeting pseudo-elements are not considered comparable to similar selectors without the pseudo-element, because they target other elements on the rendered page. For example, a::before {}
will not be compared to a:hover {}
, because a::before
targets a pseudo-element whereas a:hover
targets the actual <a>
.
This rule only compares rules that are within the same media context. So a {} @media print { #baz a {} }
is fine.
This rule resolves nested selectors before calculating the specificity of the selectors.
DOM Limitations
The linter can only check the CSS to check for specificity order. It does not have access to the HTML or DOM in order to interpret the use of the CSS.
This can lead to valid linting errors appearing to be invalid at first glance.
For example the following will cause an error:
<!-- prettier-ignore -->.component1 a {}
.component1 a:hover {}
.component2 a {}
This is a correct error because the a:hover
on line 2 has a higher specificity than the a
on line 3.
This may lead to confusion because "the two selectors will never match the same a
in the DOM". However, since the linter does not have access to the DOM it can not evaluate this, and therefore correctly reports the error about descending specificity.
It may be possible to restructure your CSS to remove the error, otherwise it is recommended that you disable the rule for that line and leave a comment saying why the error should be ignored. Note that disabling the rule will cause additional valid errors from being reported.