{"record":{"id":"dd56ab359d25fc60","repo":"amruthpillai/reactive-resume","slug":"custom-class-selectors-are-not-supported","errorCode":null,"errorMessage":"Custom class selectors are not supported.","messagePattern":"Custom class selectors are not supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":229,"sourceCode":"\t\t\t\t\tthrow new Error(\"Selector function nesting is too deep.\");\n\t\t\t\t}\n\t\t\t\tconst nested = childrenOf(node);\n\t\t\t\tif (nested.length !== 1 || nested[0]?.type !== \"SelectorList\") {\n\t\t\t\t\tthrow new Error(`:${name} requires a selector list.`);\n\t\t\t\t}\n\t\t\t\tconst selectors = compileSelectorList(nested[0], { depth: context.depth + 1 });\n\t\t\t\treturn { type: \"pseudo\", name: name as \"is\" | \"where\" | \"not\", selectors };\n\t\t\t}\n\t\t\tif (name === \"nth-child\" || name === \"nth-of-type\") {\n\t\t\t\tif (context.depth >= SEMANTIC_CSS_LIMITS_V1.maxFunctionDepth) {\n\t\t\t\t\tthrow new Error(\"Selector function nesting is too deep.\");\n\t\t\t\t}\n\t\t\t\treturn compileNth(node, name, context);\n\t\t\t}\n\t\t\tthrow new Error(`Unsupported pseudo-class :${name}.`);\n\t\t}\n\t\tcase \"ClassSelector\":\n\t\t\tthrow new Error(\"Custom class selectors are not supported.\");\n\t\tcase \"PseudoElementSelector\":\n\t\t\tthrow new Error(\"Pseudo-elements are not supported.\");\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported selector node ${node.type}.`);\n\t}\n}\n\nfunction compileComplex(node: SelectorAst, context: CompileContext): CompiledComplexSelector {\n\tif (node.type !== \"Selector\") throw new Error(\"Expected a Selector AST.\");\n\n\tconst compounds: CompiledCompoundSelector[] = [];\n\tconst combinators: Combinator[] = [];\n\tlet selectors: CompiledSimpleSelector[] = [];\n\tfor (const child of childrenOf(node)) {\n\t\tif (child.type === \"Combinator\") {\n\t\t\tconst name = astName(child) as Combinator;\n\t\t\tif (![\" \", \">\", \"+\", \"~\"].includes(name) || selectors.length === 0) {\n\t\t\t\tthrow new Error(\"Unsupported or misplaced combinator.\");","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L211-L247","documentation":"Thrown by compileSimple in the ClassSelector branch. This compiler intentionally does not support custom class selectors (.foo) because the resume styling model is semantic: elements are addressed by kind, id, role, or registered attribute, not by author-defined classes.","triggerScenarios":"Writing .custom, .highlight, section.featured, or any class selector.","commonSituations":"Porting class-based CSS from a traditional stylesheet; habits from Bootstrap/Tailwind-style authoring; generated CSS that emits class hooks.","solutions":["Replace the class with a semantic kind, role, or registered attribute selector.","Use [id='...'] for a specific named element.","Use a structural pseudo-class or combinator to express the targeting."],"exampleFix":"// before\n.section.featured\n// after\nsection[role~='featured-summary']","handlingStrategy":"validation","validationCode":"const hasClassSelector = /\\.[^\\s>#:+~[.]+/.test(selector);\nconst isClassFree = (s) => !hasClassSelector(s);\n// reject any selector containing a class token before compiling","typeGuard":"const isRejected = (r) => r.selector === null && typeof r.error === 'string';","tryCatchPattern":"const result = compileSelector(selector);\nif (result.selector === null && result.error === 'Custom class selectors are not supported.') {\n  mapClassToSemanticSelector(selector);\n}","preventionTips":["Address elements by kind, id, role, or registered attribute, never by class.","Do not port class-based CSS from other stylesheets.","Lint selectors for '.' tokens before saving."],"tags":["semantic-css","selector","class","validation"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}