weathermen/soundstorm

View on GitHub
docs/css/gfm.css

Summary

Maintainability
Test Coverage

Unexpected duplicate "line-height" (declaration-block-no-duplicate-properties)
Open

  line-height: 1.5;
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ".markdown-body ol" to come before selector ".markdown-body ul ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 input", first used at line 231 (no-duplicate-selectors)
Open

.markdown-body input {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body .pl-5", first used at line 473 (no-duplicate-selectors)
Open

.markdown-body .pl-5 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ol ol" to come before selector ".markdown-body ol ol ol" (no-descending-specificity)
Open

.markdown-body ol ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol ol" to come before selector ".markdown-body ul ol ol" (no-descending-specificity)
Open

.markdown-body ol ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ul ol" to come before selector ".markdown-body ul ol ol" (no-descending-specificity)
Open

.markdown-body ul ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 .pl-0", first used at line 438 (no-duplicate-selectors)
Open

.markdown-body .pl-0 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ol" to come before selector ".markdown-body ul ol ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ul ol" to come before selector ".markdown-body ol ul ol" (no-descending-specificity)
Open

.markdown-body ul ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 hr", first used at line 225 (no-duplicate-selectors)
Open

.markdown-body hr {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body table", first used at line 288 (no-duplicate-selectors)
Open

.markdown-body table {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body .pl-6", first used at line 477 (no-duplicate-selectors)
Open

.markdown-body .pl-6 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ul ol" to come before selector ".markdown-body ul ul ol" (no-descending-specificity)
Open

.markdown-body ul ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 input", first used at line 231 (no-duplicate-selectors)
Open

.markdown-body input {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body a", first used at line 195 (no-duplicate-selectors)
Open

.markdown-body a {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body pre", first used at line 389 (no-duplicate-selectors)
Open

.markdown-body pre {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6", first used at line 302 (no-duplicate-selectors)
Open

.markdown-body h1,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body .pl-1", first used at line 447 (no-duplicate-selectors)
Open

.markdown-body .pl-1 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body strong", first used at line 204 (no-duplicate-selectors)
Open

.markdown-body strong {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body h2", first used at line 321 (no-duplicate-selectors)
Open

.markdown-body h2 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body a" to come before selector ".markdown-body a:active" (no-descending-specificity)
Open

.markdown-body a {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol" to come before selector ".markdown-body ol ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol" to come before selector ".markdown-body ol ul ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 h5", first used at line 338 (no-duplicate-selectors)
Open

.markdown-body h5 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body hr", first used at line 225 (no-duplicate-selectors)
Open

.markdown-body hr {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body .pl-v" to come before selector ".markdown-body .pl-s .pl-v" (no-descending-specificity)
Open

.markdown-body .pl-v {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol" to come before selector ".markdown-body ol ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol" to come before selector ".markdown-body ul ul ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol, .markdown-body ul", first used at line 360 (no-duplicate-selectors)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body kbd", first used at line 550 (no-duplicate-selectors)
Open

.markdown-body kbd {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body .pl-4", first used at line 469 (no-duplicate-selectors)
Open

.markdown-body .pl-4 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ol" to come before selector ".markdown-body ul ul ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ul ol" to come before selector ".markdown-body ol ol ol" (no-descending-specificity)
Open

.markdown-body ul ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 hr", first used at line 225 (no-duplicate-selectors)
Open

.markdown-body hr {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body h1, .markdown-body h2", first used at line 316 (no-duplicate-selectors)
Open

.markdown-body h1,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body img", first used at line 214 (no-duplicate-selectors)
Open

.markdown-body img {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body a" to come before selector ".markdown-body a:hover" (no-descending-specificity)
Open

.markdown-body a {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol" to come before selector ".markdown-body ul ol ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 blockquote", first used at line 356 (no-duplicate-selectors)
Open

.markdown-body blockquote {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body h3", first used at line 325 (no-duplicate-selectors)
Open

.markdown-body h3 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body .pl-2", first used at line 451 (no-duplicate-selectors)
Open

.markdown-body .pl-2 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ol ol" to come before selector ".markdown-body ul ul ol" (no-descending-specificity)
Open

.markdown-body ol ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 h1", first used at line 209 (no-duplicate-selectors)
Open

.markdown-body h1 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 selector ".markdown-body h6", first used at line 347 (no-duplicate-selectors)
Open

.markdown-body h6 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 name monospace (font-family-no-duplicate-names)
Open

  font-family: monospace,monospace;
Severity: Minor
Found in docs/css/gfm.css by stylelint

font-family-no-duplicate-names

Disallow duplicate font family names.

<!-- prettier-ignore -->
a { font-family: serif, serif; }
/**              ↑      ↑
 * These font family names */

This rule checks the font and font-family properties.

This rule ignores $sass, @less, and var(--custom-property) variable syntaxes.

Caveat: This rule will stumble on unquoted multi-word font names and unquoted font names containing escape sequences. Wrap these font names in quotation marks, and everything should be fine.

Expected selector ".markdown-body ol" to come before selector ".markdown-body ol ol ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 h1", first used at line 209 (no-duplicate-selectors)
Open

.markdown-body h1 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ol" to come before selector ".markdown-body ol ul ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol" to come before selector ".markdown-body ol ol ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 ol ol" to come before selector ".markdown-body ol ul ol" (no-descending-specificity)
Open

.markdown-body ol ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 h4", first used at line 334 (no-duplicate-selectors)
Open

.markdown-body h4 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

Expected selector ".markdown-body ol" to come before selector ".markdown-body ul ol" (no-descending-specificity)
Open

.markdown-body ol,
Severity: Minor
Found in docs/css/gfm.css by stylelint

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 {
Severity: Minor
Found in docs/css/gfm.css by stylelint

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.

There are no issues that match your filters.

Category
Status