{"record":{"id":"6bc25cd981efd1cc","repo":"amruthpillai/reactive-resume","slug":"unsupported-name-expression","errorCode":null,"errorMessage":"Unsupported :${name} expression.","messagePattern":"Unsupported :(.+?) expression\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":163,"sourceCode":"\tcontext: CompileContext,\n): CompiledSimpleSelector {\n\tconst nth = childrenOf(node);\n\tif (nth.length !== 1 || nth[0]?.type !== \"Nth\" || !nth[0].nth) {\n\t\tthrow new Error(`:${name} requires one An+B expression.`);\n\t}\n\n\tconst expression = nth[0].nth;\n\tlet a = 0;\n\tlet b = 0;\n\tif (expression.type === \"Identifier\") {\n\t\tconst keyword = astName(expression).toLowerCase();\n\t\tif (keyword === \"odd\") {\n\t\t\ta = 2;\n\t\t\tb = 1;\n\t\t} else if (keyword === \"even\") {\n\t\t\ta = 2;\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported :${name} expression.`);\n\t\t}\n\t} else if (expression.type === \"AnPlusB\") {\n\t\ta = expression.a === null || expression.a === undefined ? 0 : Number(expression.a);\n\t\tb = expression.b === null || expression.b === undefined ? 0 : Number(expression.b);\n\t\tif (!Number.isInteger(a) || !Number.isInteger(b)) throw new Error(`Invalid :${name} expression.`);\n\t} else {\n\t\tthrow new Error(`Unsupported :${name} expression.`);\n\t}\n\n\tif (name === \"nth-of-type\" && nth[0].selector) throw new Error(\":nth-of-type does not accept an of selector.\");\n\tconst of = nth[0].selector ? compileSelectorList(nth[0].selector, { depth: context.depth + 1 }) : undefined;\n\treturn { type: \"pseudo\", name, a, b, ...(of ? { of } : {}) };\n}\n\nfunction compileSimple(node: SelectorAst, context: CompileContext): CompiledSimpleSelector | null {\n\tswitch (node.type) {\n\t\tcase \"TypeSelector\": {\n\t\t\tconst name = astName(node);","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L145-L181","documentation":"Thrown by compileNth when the nth expression is an Identifier keyword but is neither 'odd' nor 'even'. Those are the only bare-keyword nth forms accepted by this compiler.","triggerScenarios":"Writing :nth-child(foo), :nth-child(first), or any identifier other than odd/even inside the parentheses.","commonSituations":"Confusing nth keywords with structural pseudo-class names like first-child; using a CSS keyword from a different spec.","solutions":["Use odd or even: :nth-child(odd), :nth-child(even).","For a fixed position use an integer: :nth-child(2).","For a formula use An+B: :nth-child(2n+1)."],"exampleFix":"// before\nitem:nth-child(first)\n// after\nitem:first-child","handlingStrategy":"validation","validationCode":"const NTH_KEYWORDS = new Set(['odd', 'even']);\nconst validNthKeyword = (kw) => NTH_KEYWORDS.has(kw.toLowerCase());\n// before emitting :nth-child(<kw>) verify validNthKeyword(kw)","typeGuard":"const isRejected = (r) => r.selector === null && typeof r.error === 'string';","tryCatchPattern":"const result = compileSelector(selector);\nif (result.selector === null && result.error.includes('Unsupported :')) {\n  suggestOddEvenOrAnPlusB(selector);\n}","preventionTips":["Use only 'odd' or 'even' as bare nth keywords.","For positional needs use :first-child/:last-child or an integer.","Do not invent nth keywords from other CSS features."],"tags":["semantic-css","selector","nth","pseudo-class"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}