yuschick/stylelint-plugin-defensive-css

`hover-media` false positive

Closed this issue · 3 comments

Describe the bug
With the following code, Stylelint throws a false positive on the hover-media rule:

web-component-name {

	&:defined {

		@media ( hover: hover ) {

			details:not( [open] ) {
				position: relative;
				z-index: 1;

				&::before {
					content: '';
					position: absolute;
					top: 0;
					left: 0;
					z-index: -1;
					width: 100%;
					height: 100%;
					background-color: #EFEFF0;
					transition: opacity 0.2s;
					opacity: 0;
				}

				&:hover::before {
					opacity: 1;
				}

			}

		}

	}

}

To Reproduce
Steps to reproduce the behavior:

  1. Add above code to an SCSS file
  2. Run Stylelint on SCSS files

Expected behavior
No warning.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS 14.3.1

Thanks for sharing the code sample. I will take a look 👍

I just published a new version, 1.0.4, which has this fixed. Sorry for the delay on this, but thanks again for reporting.

Confirmed; thanks!