<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current behavior</strong></p>

<p dir="auto">Upgrading our preset to babel 7.13.x, and trying to hoist the <code class="notranslate">targets</code> options at the preset root, following <a href="https://babeljs.io/blog/2021/02/22/7.13.0#top-level-targets-option-12189httpsgithubcombabelbabelpull12189-rfchttpsgithubcombabelrfcspull2" rel="nofollow">the blog post</a> and <a href="https://babeljs.io/docs/en/options#output-targets" rel="nofollow">the docs</a>, I get the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[BABEL] unknown: .targets is not allowed in preset options

  at node_modules/@babel/core/lib/config/validation/options.js:100:13
      at Array.forEach (&lt;anonymous&gt;)
  at validateNested (node_modules/@babel/core/lib/config/validation/options.js:92:21)
  at validate (node_modules/@babel/core/lib/config/validation/options.js:83:10)
  at node_modules/@babel/core/lib/config/full.js:328:36
  at cachedFunction (node_modules/@babel/core/lib/config/caching.js:62:27)
      at cachedFunction.next (&lt;anonymous&gt;)
  at evaluateSync (node_modules/gensync/index.js:251:28)
  at sync (node_modules/gensync/index.js:89:14)
  at loadPresetDescriptor (node_modules/@babel/core/lib/config/full.js:317:18)"><pre class="notranslate"><code class="notranslate">[BABEL] unknown: .targets is not allowed in preset options

  at node_modules/@babel/core/lib/config/validation/options.js:100:13
      at Array.forEach (&lt;anonymous&gt;)
  at validateNested (node_modules/@babel/core/lib/config/validation/options.js:92:21)
  at validate (node_modules/@babel/core/lib/config/validation/options.js:83:10)
  at node_modules/@babel/core/lib/config/full.js:328:36
  at cachedFunction (node_modules/@babel/core/lib/config/caching.js:62:27)
      at cachedFunction.next (&lt;anonymous&gt;)
  at evaluateSync (node_modules/gensync/index.js:251:28)
  at sync (node_modules/gensync/index.js:89:14)
  at loadPresetDescriptor (node_modules/@babel/core/lib/config/full.js:317:18)
</code></pre></div>
<p dir="auto"><strong>GitHub Repo</strong></p>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="814615721" data-permission-text="Title is private" data-url="https://github.com/Gandi/babel-preset-gandi/issues/29" data-hovercard-type="pull_request" data-hovercard-url="/Gandi/babel-preset-gandi/pull/29/hovercard" href="https://github.com/Gandi/babel-preset-gandi/pull/29">Gandi/babel-preset-gandi#29</a></p>
<p dir="auto"><strong>Input Code</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module.exports = (context, options = {}) =&gt; {
  let targets = {
    browsers: ['last 2 versions', '&gt; 1%', 'Firefox ESR', 'not dead'],
    ...options.targets,
  };

  let envOpts = {
    modules: options.modules,
    bugfixes: targets.esmodules === true,
  };

  let runtimeOpts = {
    corejs: 2,
    helpers: true,
    regenerator: true,
    version: '7.13.0', // 1
  };

  let presets = [
    ['@babel/preset-env', envOpts],
    '@babel/preset-react',
    '@babel/preset-flow',
  ];

  let plugins = [
    '@babel/plugin-transform-flow-strip-types', 
    ['@babel/plugin-proposal-class-properties', { loose: true }],
    ['@babel/plugin-transform-runtime', runtimeOpts],
  ];

  return {
    targets,
    presets,
    plugins,
  };
};"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-en">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-s1">context</span><span class="pl-kos">,</span> <span class="pl-s1">options</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> <span class="pl-s1">targets</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">browsers</span>: <span class="pl-kos">[</span><span class="pl-s">'last 2 versions'</span><span class="pl-kos">,</span> <span class="pl-s">'&gt; 1%'</span><span class="pl-kos">,</span> <span class="pl-s">'Firefox ESR'</span><span class="pl-kos">,</span> <span class="pl-s">'not dead'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    ...<span class="pl-s1">options</span><span class="pl-kos">.</span><span class="pl-c1">targets</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-k">let</span> <span class="pl-s1">envOpts</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">modules</span>: <span class="pl-s1">options</span><span class="pl-kos">.</span><span class="pl-c1">modules</span><span class="pl-kos">,</span>
    <span class="pl-c1">bugfixes</span>: <span class="pl-s1">targets</span><span class="pl-kos">.</span><span class="pl-c1">esmodules</span> <span class="pl-c1">===</span> <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-k">let</span> <span class="pl-s1">runtimeOpts</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">corejs</span>: <span class="pl-c1">2</span><span class="pl-kos">,</span>
    <span class="pl-c1">helpers</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">regenerator</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">version</span>: <span class="pl-s">'7.13.0'</span><span class="pl-kos">,</span> <span class="pl-c">// 1</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-k">let</span> <span class="pl-s1">presets</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">'@babel/preset-env'</span><span class="pl-kos">,</span> <span class="pl-s1">envOpts</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-s">'@babel/preset-react'</span><span class="pl-kos">,</span>
    <span class="pl-s">'@babel/preset-flow'</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">;</span>

  <span class="pl-k">let</span> <span class="pl-s1">plugins</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
    <span class="pl-s">'@babel/plugin-transform-flow-strip-types'</span><span class="pl-kos">,</span> 
    <span class="pl-kos">[</span><span class="pl-s">'@babel/plugin-proposal-class-properties'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">loose</span>: <span class="pl-c1">true</span> <span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">'@babel/plugin-transform-runtime'</span><span class="pl-kos">,</span> <span class="pl-s1">runtimeOpts</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">;</span>

  <span class="pl-k">return</span> <span class="pl-kos">{</span>
    targets<span class="pl-kos">,</span>
    presets<span class="pl-kos">,</span>
    plugins<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>
<p dir="auto"><strong>Expected behavior</strong><br>
No error...</p>
<p dir="auto"><strong>Environment</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="System:
  OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
Binaries:
  Node: 12.16.2 - /tmp/fnm-shell-1022461/bin/node
  Yarn: 1.22.5 - /usr/bin/yarn
  npm: 6.14.9 - /tmp/fnm-shell-1022461/bin/npm
npmPackages:
  @babel/core: ^7.13.1 =&gt; 7.13.1 
  @babel/plugin-proposal-class-properties: ^7.13.0 =&gt; 7.13.0 
  @babel/plugin-transform-runtime: ^7.13.5 =&gt; 7.13.5 
  @babel/preset-env: ^7.13.5 =&gt; 7.13.5 
  @babel/preset-flow: ^7.12.13 =&gt; 7.12.13 
  @babel/preset-react: ^7.12.13 =&gt; 7.12.13 
  @babel/runtime-corejs2: ^7.13.4 =&gt; 7.13.4 
  jest: ^26.6.3 =&gt; 26.6.3 "><pre class="notranslate"><code class="notranslate">System:
  OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
Binaries:
  Node: 12.16.2 - /tmp/fnm-shell-1022461/bin/node
  Yarn: 1.22.5 - /usr/bin/yarn
  npm: 6.14.9 - /tmp/fnm-shell-1022461/bin/npm
npmPackages:
  @babel/core: ^7.13.1 =&gt; 7.13.1 
  @babel/plugin-proposal-class-properties: ^7.13.0 =&gt; 7.13.0 
  @babel/plugin-transform-runtime: ^7.13.5 =&gt; 7.13.5 
  @babel/preset-env: ^7.13.5 =&gt; 7.13.5 
  @babel/preset-flow: ^7.12.13 =&gt; 7.12.13 
  @babel/preset-react: ^7.12.13 =&gt; 7.12.13 
  @babel/runtime-corejs2: ^7.13.4 =&gt; 7.13.4 
  jest: ^26.6.3 =&gt; 26.6.3 
</code></pre></div>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Error</strong><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/11495164/110433202-1ac94500-80eb-11eb-9587-35fa65bf94e5.png"><img src="https://user-images.githubusercontent.com/11495164/110433202-1ac94500-80eb-11eb-9587-35fa65bf94e5.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Input Code</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" // test.js
  export function test(obj) {
    const { x, y } = obj;
    var result = {
      x: `${x}&lt;${x}`,
      y: `${x}[${y}-${x}]`,
    };
    return result;
  }"><pre class="notranslate"> <span class="pl-c">// test.js</span>
  <span class="pl-k">export</span> <span class="pl-k">function</span> <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s1">obj</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">const</span> <span class="pl-kos">{</span> x<span class="pl-kos">,</span> y <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">obj</span><span class="pl-kos">;</span>
    <span class="pl-k">var</span> <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
      <span class="pl-c1">x</span>: <span class="pl-s">`<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>&lt;<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span>
      <span class="pl-c1">y</span>: <span class="pl-s">`<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>[<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">y</span><span class="pl-kos">}</span></span>-<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>]`</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span> <span class="pl-s1">result</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span></pre></div>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// .babelrc
{
  &quot;presets&quot;: [
    [
      &quot;@babel/preset-env&quot;
    ]
  ],
  &quot;plugins&quot;: [&quot;@babel/transform-runtime&quot;]
}
"><pre class="notranslate"><span class="pl-ii">// .babelrc</span>
{
  <span class="pl-ent">"presets"</span>: [
    [
      <span class="pl-s"><span class="pl-pds">"</span>@babel/preset-env<span class="pl-pds">"</span></span>
    ]
  ],
  <span class="pl-ent">"plugins"</span>: [<span class="pl-s"><span class="pl-pds">"</span>@babel/transform-runtime<span class="pl-pds">"</span></span>]
}
</pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// .eslintrc.js
module.exports = {
  env: {
    browser: true,
    commonjs: true,
    es6: true,
    node: true,
    jquery: true,
  },
  root: true,
  parserOptions: {
    requireConfigFile: false,
    parser: '@babel/eslint-parser',
    ecmaVersion: 2020,
    sourceType: 'module',
    ecmaFeatures: {
      defaultParams: true,
    },
  },
  plugins: ['vue', 'prettier', 'feq'],
  settings: {
    'import/resolver': {
      webpack: {
        config: 'build/webpack.base.conf.js',
      },
    },
  },
  extends: ['plugin:vue/essential', 'airbnb-base'],
  globals: {},
  rules: {},
};"><pre class="notranslate"><span class="pl-c">// .eslintrc.js</span>
<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">env</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">browser</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">commonjs</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">es6</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">node</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">jquery</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">root</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-c1">parserOptions</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">requireConfigFile</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">parser</span>: <span class="pl-s">'@babel/eslint-parser'</span><span class="pl-kos">,</span>
    <span class="pl-c1">ecmaVersion</span>: <span class="pl-c1">2020</span><span class="pl-kos">,</span>
    <span class="pl-c1">sourceType</span>: <span class="pl-s">'module'</span><span class="pl-kos">,</span>
    <span class="pl-c1">ecmaFeatures</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">defaultParams</span>: <span class="pl-c1">true</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>
  <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-s">'vue'</span><span class="pl-kos">,</span> <span class="pl-s">'prettier'</span><span class="pl-kos">,</span> <span class="pl-s">'feq'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-c1">settings</span>: <span class="pl-kos">{</span>
    <span class="pl-s">'import/resolver'</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">webpack</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">config</span>: <span class="pl-s">'build/webpack.base.conf.js'</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>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">extends</span>: <span class="pl-kos">[</span><span class="pl-s">'plugin:vue/essential'</span><span class="pl-kos">,</span> <span class="pl-s">'airbnb-base'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-c1">globals</span>: <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">rules</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>
<p dir="auto"><strong>Expected behavior</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- Babel version(s): [v7.13.10]
- Node/npm version: [Node v12.19.0/npm 6.14.9]
- OS: [macOS 10.14.6]
- How you are using Babel: [`webpack`]
"><pre class="notranslate"><code class="notranslate">- Babel version(s): [v7.13.10]
- Node/npm version: [Node v12.19.0/npm 6.14.9]
- OS: [macOS 10.14.6]
- How you are using Babel: [`webpack`]

</code></pre></div>