{"record":{"id":"2cc75f1e2797ce04","repo":"denoland/deno","slug":"unknown-attribute-operator-s","errorCode":null,"errorMessage":"Unknown attribute operator: '${s}'","messagePattern":"Unknown attribute operator: '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/js/40_lint_selector.js","lineNumber":113,"sourceCode":"  switch (s) {\n    case \"=\":\n      return BinOp.Equal;\n    case \"!=\":\n      return BinOp.NotEqual;\n    case \">\":\n      return BinOp.Greater;\n    case \">=\":\n      return BinOp.GreaterThan;\n    case \"<\":\n      return BinOp.Less;\n    case \"<=\":\n      return BinOp.LessThan;\n    case \"~\":\n      return BinOp.Tilde;\n    case \"+\":\n      return BinOp.Plus;\n    default:\n      throw new Error(`Unknown attribute operator: '${s}'`);\n  }\n}\n\nexport class Lexer {\n  token = Token.Word;\n  start = 0;\n  end = 0;\n  ch = 0;\n  i = -1;\n\n  value = \"\";\n\n  /**\n   * @param {string} input\n   */\n  constructor(input) {\n    this.input = input;\n    this.step();","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_lint_selector.js#L95-L131","documentation":"Deno lint plugin selectors support a fixed set of attribute operators in [...] parts: =, !=, >, >=, <, <=, ~ and + (getAttrOp in cli/js/40_lint_selector.js). Any other operator string throws `Unknown attribute operator: '<op>'` while the visitor key is parsed, so the rule never registers and linting fails loudly. The classic trigger is copying a CSS attribute substring operator (*=, ^=, $=, |=) that this engine intentionally does not implement.","triggerScenarios":"A visitor key like \"ClassDeclaration[id.name*=\\\"Factory\\\"]\", \"Function[id.name^=\\\"render\\\"]\", \"VariableDeclarator[id.name$=\\\"Count\\\"]\", or a typo such as [attr=!value]. The same getAttrOp path also evaluates top-level combinator tokens (Token.Op), so an unrecognized operator token anywhere in the key can land here.","commonSituations":"Porting CSS selector habits to lint plugin visitor keys; expecting substring matching that the selector engine never had; typos in hand-written selectors.","solutions":["Replace substring operators with the regex value form: [id.name*=\"Factory\"] → [id.name=/Factory/].","Or drop the operator ([attr] existence form) and do the precise check in JavaScript inside the visitor callback.","Check your key against the supported operator list: = != > >= < <= ~ +.","Keep a unit test that parses every visitor key so unsupported operators fail in CI, not during a lint run."],"exampleFix":"// before\n\"ClassDeclaration[id.name*=\\\"Factory\\\"]:exit\"(node) { /* ... */ },\n\n// after\n\"ClassDeclaration[id.name=/Factory/]:exit\"(node) { /* ... */ },","handlingStrategy":"validation","validationCode":"const SUPPORTED_ATTR_OPS = [\"=\", \"!=\", \">\", \">=\", \"<\", \"<=\", \"~\", \"+\"];\nfunction checkVisitorKeys(keys) {\n  for (const key of keys) {\n    if (/(\\*|\\^|\\$|\\|)=/.test(key)) {\n      throw new Error(\n        `Unsupported attribute operator in \"${key}\"; supported: ${SUPPORTED_ATTR_OPS.join(\" \")}`,\n      );\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize the supported operator set (= != > >= < <= ~ +) — CSS substring operators are intentionally absent.","Use the regex value form [attr=/pattern/] for substring/prefix/suffix matching.","Run every visitor key through a parse smoke test in CI so bad keys fail before a lint run."],"tags":["deno","deno-lint","lint-plugin","selector","attribute-operator","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"}