From 56a4446bf616cb8d2ec83af250e2529e198b27a8 Mon Sep 17 00:00:00 2001 From: SwetaTanwar Date: Sun, 21 Dec 2025 22:45:34 +0530 Subject: [PATCH 1/3] fix: support nested element pseudo selectors --- package.json | 2 +- tests/rules/no-invalid-properties.test.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cb43e564..204f0c15 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "license": "Apache-2.0", "dependencies": { "@eslint/core": "^1.0.1", - "@eslint/css-tree": "^3.6.8", + "@eslint/css-tree": "https://github.com/SwetaTanwar/csstree/tree/nested-parsing", "@eslint/plugin-kit": "^0.5.1" }, "devDependencies": { diff --git a/tests/rules/no-invalid-properties.test.js b/tests/rules/no-invalid-properties.test.js index 6ea8c08d..d8f8a407 100644 --- a/tests/rules/no-invalid-properties.test.js +++ b/tests/rules/no-invalid-properties.test.js @@ -266,6 +266,9 @@ ruleTester.run("no-invalid-properties", rule, { "a { color: oklch(from green l c h / 0.5) }", "a { color: oklch(from #123456 calc(l + 10) c h) }", "a { color: oklch(from hsl(180 100% 50%) calc(l - 10) c h) }", + + // https://github.com/eslint/css/issues/250 + "main { p:first-of-type { margin-top: 0; } }", ], invalid: [ { From 8553d19c3408a3b783b1f3f680b8db066212f066 Mon Sep 17 00:00:00 2001 From: SwetaTanwar Date: Sun, 21 Dec 2025 23:44:48 +0530 Subject: [PATCH 2/3] test: add more cases --- tests/rules/no-invalid-properties.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/rules/no-invalid-properties.test.js b/tests/rules/no-invalid-properties.test.js index d8f8a407..a654301d 100644 --- a/tests/rules/no-invalid-properties.test.js +++ b/tests/rules/no-invalid-properties.test.js @@ -269,6 +269,8 @@ ruleTester.run("no-invalid-properties", rule, { // https://github.com/eslint/css/issues/250 "main { p:first-of-type { margin-top: 0; } }", + "main { p:hover { color: red; } }", + "main { p:nth-child(2n) { color: red; } }", ], invalid: [ { From 18b2e53dbfa482873d7a49dc3d2d912919c70fe7 Mon Sep 17 00:00:00 2001 From: SwetaTanwar Date: Thu, 22 Jan 2026 22:50:59 +0530 Subject: [PATCH 3/3] test: add more cases --- tests/rules/no-invalid-properties.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/rules/no-invalid-properties.test.js b/tests/rules/no-invalid-properties.test.js index a654301d..2ecc9e3a 100644 --- a/tests/rules/no-invalid-properties.test.js +++ b/tests/rules/no-invalid-properties.test.js @@ -271,6 +271,9 @@ ruleTester.run("no-invalid-properties", rule, { "main { p:first-of-type { margin-top: 0; } }", "main { p:hover { color: red; } }", "main { p:nth-child(2n) { color: red; } }", + "main { p:has(.child) { color: red; } }", + "main { p:has(.child:hover) { color: red; } }", + "main { p:first-of-type, span { color: red; } }", ], invalid: [ {