{"id":"e427773a725fabd8","repo":"eslint/eslint","slug":"key-rules-key-ruleid","errorCode":null,"errorMessage":"Key \"rules\": Key \"${ruleId}\":","messagePattern":"Key \"rules\": Key \"(.+?)\":","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/config/config.js","lineNumber":728,"sourceCode":"\n\t\t\t// Check if the rule supports the current language\n\t\t\tif (\n\t\t\t\t!doesRuleSupportLanguage(\n\t\t\t\t\trule.meta?.languages,\n\t\t\t\t\tnormalizedLanguageName,\n\t\t\t\t\tvalidPluginNames,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tunsupportedLanguageRules.push(ruleId);\n\t\t\t}\n\n\t\t\tconst validateRule = getOrCreateValidator(rule, ruleId);\n\n\t\t\tif (validateRule) {\n\t\t\t\tvalidateRule(ruleOptions.slice(1));\n\n\t\t\t\tif (validateRule.errors) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Key \"rules\": Key \"${ruleId}\":\\n${validateRule.errors\n\t\t\t\t\t\t\t.map(error => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\terror.keyword === \"additionalProperties\" &&\n\t\t\t\t\t\t\t\t\terror.schema === false &&\n\t\t\t\t\t\t\t\t\ttypeof error.parentSchema?.properties ===\n\t\t\t\t\t\t\t\t\t\t\"object\" &&\n\t\t\t\t\t\t\t\t\ttypeof error.params?.additionalProperty ===\n\t\t\t\t\t\t\t\t\t\t\"string\"\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tconst expectedProperties = Object.keys(\n\t\t\t\t\t\t\t\t\t\terror.parentSchema.properties,\n\t\t\t\t\t\t\t\t\t).map(property => `\"${property}\"`);\n\n\t\t\t\t\t\t\t\t\treturn `\\tValue ${JSON.stringify(error.data)} ${error.message}.\\n\\t\\tUnexpected property \"${error.params.additionalProperty}\". Expected properties: ${expectedProperties.join(\", \")}.\\n`;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn `\\tValue ${JSON.stringify(error.data)} ${error.message}.\\n`;","sourceCodeStart":710,"sourceCodeEnd":746,"githubUrl":"https://github.com/eslint/eslint/blob/f131c034ad91bbf06bcbb6b5e931447a8e419a46/lib/config/config.js#L710-L746","documentation":"Thrown in validateRulesConfig() (config.js:728) when the per-rule ajv validator runs against the rule's configured options and reports errors. The message is prefixed 'Key \"rules\": Key \"<ruleId>\":' followed by each ajv error (value, message, and for additionalProperties the expected properties). This is the standard 'rule options do not match the rule's schema' error.","triggerScenarios":"Configuring a rule with options that violate its meta.schema: wrong types, out-of-range enums, extra properties when additionalProperties is false, wrong array length, etc. Reached for enabled (non-zero) rules after defaultOptions are merged.","commonSituations":"Passing a string where a number is expected; typo'd option names; using options from a different rule version; passing options to a rule whose schema is `[]` (no options allowed).","solutions":["Read the full message: it names the value, the failing keyword, and (for extra props) the allowed properties.","Open the rule's docs/schema and align your options array to the expected shape and types.","If you intended no options, configure the rule as a bare severity (e.g. 'error') without an options array.","Disable the rule (severity 0) only as a last resort; it skips validation entirely."],"exampleFix":"// before\n{ 'quotes': ['error', 'single', { avoidEscape: 'yes' }] }\n\n// after\n{ 'quotes': ['error', 'single', { avoidEscape: true }] }","handlingStrategy":"try-catch","validationCode":"function ruleOptionsMatch(ruleId, rule, options) {\n  const schema = rule?.meta?.schema;\n  if (!schema) return true;\n  // Use ajv against schema with the options array; returns true/false.\n}","typeGuard":"null","tryCatchPattern":"try {\n  config.validateRulesConfig(rules);\n} catch (e) {\n  if (/^Key \"rules\":/.test(e.message)) {\n    console.error('Rule options invalid:\\n' + e.message);\n  } else throw e;\n}","preventionTips":["Cross-check option names/types against the rule's docs before configuring.","Run ESLint's --print-config to surface option errors early.","For rules taking no options, use a bare severity."],"tags":["rules","rule-options","schema","ajv","validation"],"analyzedSha":"f131c034ad91bbf06bcbb6b5e931447a8e419a46","analyzedAt":"2026-08-03T19:53:24.025Z","schemaVersion":2}