<h3 dir="auto">Is this a bug report or feature request?</h3>
<p dir="auto">Bug</p>
<p dir="auto"><a href="https://github.com/julien-f/issue-babel-env-duplicate">Repro repo</a>.</p>

<h3 dir="auto">Input Code</h3>


<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export default class {
  method ({ ...object }) {}
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-k">class</span> <span class="pl-kos">{</span>
  <span class="pl-en">method</span> <span class="pl-kos">(</span><span class="pl-kos">{</span> ...<span class="pl-s1">object</span> <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Babel/Babylon Configuration (.babelrc, package.json, cli command)</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot;: [
    [
      &quot;@babel/env&quot;,
      {
        &quot;shippedProposals&quot;: true,
        &quot;targets&quot;: {
          &quot;node&quot;: 8
        },
        &quot;useBuiltIns&quot;: &quot;usage&quot;
      }
    ]
  ]
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"presets"</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">[</span>
      <span class="pl-s">"@babel/env"</span><span class="pl-kos">,</span>
      <span class="pl-kos">{</span>
        <span class="pl-s">"shippedProposals"</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
        <span class="pl-s">"targets"</span>: <span class="pl-kos">{</span>
          <span class="pl-s">"node"</span>: <span class="pl-c1">8</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-s">"useBuiltIns"</span>: <span class="pl-s">"usage"</span>
      <span class="pl-kos">}</span>
    <span class="pl-kos">]</span>
  <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Should compile.</p>
<h3 dir="auto">Current Behavior</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: index.js: Duplicate declaration &quot;object&quot;
  1 | export default class {
&gt; 2 |   method ({ ...object }) {}
    |                ^
  3 | }
  4 |
    at File.buildCodeFrameError (issue-babel-env-duplicate/node_modules/@babel/core/lib/transformation/file/file.js:209:12)
    at Scope.checkBlockScopedCollisions (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:303:27)
    at Scope.registerBinding (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:485:16)
    at Scope.registerDeclaration (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:404:14)
    at Object.BlockScoped (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:146:28)
    at Object.newFn (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/visitors.js:266:17)
    at NodePath._call (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/path/context.js:64:19)
    at NodePath.call (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/path/context.js:34:14)
    at NodePath.visit (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/path/context.js:99:12)
    at TraversalContext.visitQueue (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/context.js:139:18)"><pre class="notranslate"><code class="notranslate">TypeError: index.js: Duplicate declaration "object"
  1 | export default class {
&gt; 2 |   method ({ ...object }) {}
    |                ^
  3 | }
  4 |
    at File.buildCodeFrameError (issue-babel-env-duplicate/node_modules/@babel/core/lib/transformation/file/file.js:209:12)
    at Scope.checkBlockScopedCollisions (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:303:27)
    at Scope.registerBinding (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:485:16)
    at Scope.registerDeclaration (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:404:14)
    at Object.BlockScoped (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/scope/index.js:146:28)
    at Object.newFn (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/visitors.js:266:17)
    at NodePath._call (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/path/context.js:64:19)
    at NodePath.call (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/path/context.js:34:14)
    at NodePath.visit (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/path/context.js:99:12)
    at TraversalContext.visitQueue (issue-babel-env-duplicate/node_modules/@babel/traverse/lib/context.js:139:18)
</code></pre></div>
<h3 dir="auto">Possible Solution</h3>


<h3 dir="auto">Context</h3>


<h3 dir="auto">Your Environment</h3>

<table role="table">
<thead>
<tr>
<th>software</th>
<th>version(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>7.0.0-beta.39</td>
</tr>
<tr>
<td>Babylon</td>
<td></td>
</tr>
<tr>
<td>node</td>
<td>9.4.0</td>
</tr>
<tr>
<td>npm</td>
<td></td>
</tr>
<tr>
<td>Operating System</td>
<td></td>
</tr>
</tbody>
</table>
<p dir="auto">See: <a href="https://github.com/babel/babel/pull/7869/files#r189395861">https://github.com/babel/babel/pull/7869/files#r189395861</a></p>
<blockquote>
<p dir="auto">Hey all, I'm concerned about this. Now that we've defined the ability to pass options to Babylon plugins, ordering becomes critical. What if some other piece of tooling injected a syntax plugin into the plugin list after this one, or before? Which one should take priority? For instance for <a href="https://github.com/babel/babel/pull/7934/files#diff-3a8233bcd2766d2c7d87f23f944f7726R12">https://github.com/babel/babel/pull/7934/files#diff-3a8233bcd2766d2c7d87f23f944f7726R12</a>, say the user's framework auto-enables flow, but the user wants to enable all, which comes first?</p>
<p dir="auto">So far we've avoided this problem by not having options, and not worrying about duplicates. Now it will matter very much both what order your Babel plugins are in, but also what order they enable Babylon plugins in.</p>
<p dir="auto">At a minimum, have we verified that the ordering on these is consistent with the ordering of visitors? e.g. If two plugins are enabled with different options, whichever one's visitors run first, is also the one who's Babylon configuration takes affect?</p>
</blockquote>
<p dir="auto">The plugin map logic in <a href="https://github.com/babel/babel/pull/7869/files#diff-8b7138068ab1dfcbfafe8422f16505cbR45">https://github.com/babel/babel/pull/7869/files#diff-8b7138068ab1dfcbfafe8422f16505cbR45</a> will always take the last set of options. If I'm piecing things together in my head correctly, that'll be a problem, because the <em>first</em> plugin in the list will run its visitors first, but the <em>last</em> plugin in the list will be the thing specifying the options to Babylon.</p>