{"record":{"id":"84b3d3ae46d3f1df","repo":"denoland/deno","slug":"unknown-pseudo-selector-lex-value","errorCode":null,"errorMessage":"Unknown pseudo selector: '${lex.value}'","messagePattern":"Unknown pseudo selector: '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/js/40_lint_selector.js","lineNumber":725,"sourceCode":"          stack.push([]);\n\n          continue;\n        }\n        case \"not\": {\n          lex.next();\n          lex.expect(Token.BraceOpen);\n          lex.next();\n\n          current.push({\n            type: PSEUDO_NOT,\n            selectors: [],\n          });\n          stack.push([]);\n\n          continue;\n        }\n        default:\n          throw new Error(`Unknown pseudo selector: '${lex.value}'`);\n      }\n    } else if (lex.token === Token.Comma) {\n      if (throwOnComma) {\n        throw new Error(`Multiple selector arguments not supported here`);\n      }\n\n      lex.next();\n      if (lex.token === Token.Space) {\n        lex.next();\n      }\n\n      popSelector(result, stack);\n      stack.push([]);\n      continue;\n    } else if (lex.token === Token.BraceClose) {\n      throwOnComma = false;\n      popSelector(result, stack);\n    } else if (lex.token === Token.Op) {","sourceCodeStart":707,"sourceCodeEnd":743,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_lint_selector.js#L707-L743","documentation":"The lint selector engine implements only a fixed pseudo-class set: :first-child, :last-child, :nth-child(), :where(), :matches(), :is(), :has() and :not(). The default branch of the pseudo switch (cli/js/40_lint_selector.js) throws `Unknown pseudo selector: '<name>'` for anything else. This is a deliberate limitation — the engine matches an AST, not the DOM, so CSS pseudo-classes like :hover have no meaning here.","triggerScenarios":"A visitor key containing :root, :hover, :empty, :nth-of-type(), :first-of-type, or any other pseudo not in the supported set — thrown while parsing the key when the rule registers.","commonSituations":"Copy-pasting a CSS selector into a plugin rule; assuming full CSS selector support; using structural pseudo-classes that exist in CSS but map to nothing in an AST.","solutions":["Remove the unsupported pseudo-class from the key.","Re-express the intent with the supported set — e.g. :nth-of-type(2) usually becomes :nth-child(2); grouping becomes :is(a, b).","If no selector expresses it, match the node type in the key and do the extra check in JavaScript inside the visitor callback."],"exampleFix":"// before\n\"CallExpression:nth-of-type(2)\"(node) { /* ... */ },\n\n// after\n\"CallExpression:nth-child(2)\"(node) { /* ... */ },","handlingStrategy":"validation","validationCode":"const SUPPORTED_PSEUDOS = new Set([\n  \"first-child\", \"last-child\", \"nth-child\", \"where\", \"matches\", \"is\", \"has\", \"not\",\n]);\nfunction checkPseudos(key) {\n  for (const m of key.matchAll(/:([a-z-]+)/g)) {\n    if (!SUPPORTED_PSEUDOS.has(m[1])) {\n      throw new Error(`Unsupported pseudo :${m[1]} in \"${key}\"`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the engine is AST-based: only first-child, last-child, nth-child, where, matches, is, has, not exist.","Do extra structural checks in JavaScript inside the visitor instead of reaching for CSS pseudo-classes."],"tags":["deno","deno-lint","lint-plugin","selector","pseudo-class","parse-error"],"backgroundTag":"invalid-selector-syntax","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}