{"id":"481590e5bf314679","repo":"babel/babel","slug":"the-discardbinding-plugin-requires-a-syntaxtype","errorCode":null,"errorMessage":"The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.","messagePattern":"The 'discardBinding' plugin requires a 'syntaxType' option\\. Currently the only supported value is 'void'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/babel-parser/src/plugin-utils.ts","lineNumber":123,"sourceCode":"    throw error;\n  }\n\n  if (\n    pluginsMap.has(\"optionalChainingAssign\") &&\n    pluginsMap.get(\"optionalChainingAssign\").version !== \"2023-07\"\n  ) {\n    throw new Error(\n      \"The 'optionalChainingAssign' plugin requires a 'version' option,\" +\n        \" representing the last proposal update. Currently, the\" +\n        \" only supported value is '2023-07'.\",\n    );\n  }\n\n  if (\n    pluginsMap.has(\"discardBinding\") &&\n    pluginsMap.get(\"discardBinding\").syntaxType !== \"void\"\n  ) {\n    throw new Error(\n      \"The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.\",\n    );\n  }\n\n  if (pluginsMap.has(\"decimal\")) {\n    throw new Error(\n      \"The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.\",\n    );\n  }\n  if (pluginsMap.has(\"importReflection\")) {\n    throw new Error(\n      \"The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and \" +\n        \"replace 'import module' with 'import source' in your code.\",\n    );\n  }\n}\n\n// These plugins are defined using a mixin which extends the parser class.","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/babel/babel/blob/06b6eae39da4ce0689fad64e2c48a6375a464208/packages/babel-parser/src/plugin-utils.ts#L105-L141","documentation":"Thrown when the 'discardBinding' parser plugin is enabled but its `syntaxType` option is missing or not 'void'. Discard bindings (the ability to declare a parameter that is explicitly unused) currently only support the `void` keyword form (e.g. function f(void) {}). Requiring the explicit option future-proofs the API if more syntaxes are added.","triggerScenarios":"Listing ['discardBinding'] with no options object, or with a syntaxType other than 'void'.","commonSituations":"Enabling the plugin without reading its options contract. Following an early-proposal draft that did not require syntaxType.","solutions":["Pass the required option: ['discardBinding', { syntaxType: 'void' }].","Remove the plugin if you are not using `void` discard bindings."],"exampleFix":"// before\nparserPlugins: ['discardBinding']\n\n// after\nparserPlugins: [['discardBinding', { syntaxType: 'void' }]]","handlingStrategy":"validation","validationCode":"function normalizeDiscardBinding(plugins) {\n  return plugins.map(p => {\n    if (Array.isArray(p) && p[0] === 'discardBinding') {\n      return ['discardBinding', { syntaxType: 'void', ...(p[1] || {}) }];\n    }\n    return p;\n  });\n}","typeGuard":"function hasValidDiscardBindingSyntaxType(plugins) {\n  const p = plugins.find(x => Array.isArray(x) && x[0] === 'discardBinding');\n  return !p || (p[1] && p[1].syntaxType === 'void');\n}","tryCatchPattern":null,"preventionTips":["Read the option contract of any proposal plugin before enabling it — many require explicit option pins.","Wrap proposal-plugin config in helpers that inject required defaults."],"tags":["babel-parser","plugin-options","discard-binding","config"],"analyzedSha":"06b6eae39da4ce0689fad64e2c48a6375a464208","analyzedAt":"2026-08-03T20:13:43.465Z","schemaVersion":2}