Issue 1:
💻

Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

type Json = Record<string, unknown>

class C {
constructor(public json: Json) {
}

hogeFoge = this.json.hoge_hoge;
}

Configuration file name

No response

Configuration

{
"cacheDirectory": "/PATH/TO/node_modules/.cache/storybook/babel",
"sourceType": "unambiguous",
"presets": [
[
"/PATH/TO/node_modules/@babel/preset-env/lib/index.js",
{ "shippedProposals": true, "loose": true }
],
"/PATH/TO/node_modules/@babel/preset-typescript/lib/index.js",
["/PATH/TO/node_modules/@babel/preset-react/lib/index.js", { "runtime": "automatic" }],
"/PATH/TO/node_modules/@babel/preset-flow/lib/index.js"
],
"plugins": [],
"overrides": [
{
"test": {},
"plugins": ["/PATH/TO/node_modules/babel-plugin-named-exports-order/index.js"]
},
{
"test": {},
"plugins": [
[
"/PATH/TO/node_modules/babel-plugin-react-docgen/lib/index.js",
{ "DOC_GEN_COLLECTION_NAME": "STORYBOOK_REACT_CLASSES" }
]
]
}
]
}

This is output of babel options in .storybook/main.js.

.storybook/main.js

const path = require('path');

/** @type {import("@storybook/core-common").StorybookConfig} */
module.exports = {
// ...
babel: (options) => {
options.plugins = [];
console.log(JSON.stringify(options)) // <- this json
return options;
},
};

Current and expected behavior

Babel currently output parameter property after field.

Babel Playground

// ...

class C {
constructor(json) {
_defineProperty(this, "hogeFoge", this.json.hoge_hoge);
this.json = json;
}
}

Like output code of TypeScript Playground, I want field after parameter property.

class C {
constructor(json) {
this.json = json;
this.hogeFoge = this.json.hoge_hoge;
}
}

Environment

System:

OS: macOS 13.1

Binaries:

Node: 16.13.0 - ~/.nodenv/versions/16.13.0/bin/node

Yarn: 1.22.19 - ~/.node_modules/bin/yarn

npm: 8.1.0 - ~/.nodenv/versions/16.13.0/bin/npm

npmPackages:

@babel/cli: ^7.19.3 => 7.19.3

@babel/core: ^7.20.5 => 7.20.5

babel-loader: ^8.3.0 => 8.3.0

eslint: ^8.28.0 => 8.28.0

Possible solution

No response

Additional context

TypeScript Playground

Issue 2:
When trying to export toString, hasOwnProperty etc Babel thinks these are duplicate exports.

Input Code

export function toString() {}

Expected Behavior

Should create a module that exports toString

Current Behavior

$ node_modules/.bin/babel test.js
SyntaxError: test.js: `toString` has already been exported. Exported identifiers must be unique. (1:0)
> 1 | export function toString() {}
| ^
2 |

Possible Solution

I guess you are doing an in check which leads to these false negatives.

Context

Broke our compilation

Your Environment

software
version

Babel
See below

node
5.11.1, 6.6.0

npm
3.8.6, 3.9.2

Operating System
OS X

$ npm ls | grep babel
│ ├─┬ babel-eslint@6.1.2
├─┬ babel-cli@6.14.0
│ ├── babel-polyfill@6.13.0
│ ├─┬ babel-register@6.14.0
├─┬ babel-core@6.14.0
│ ├─┬ babel-code-frame@6.11.0
│ ├── babel-helpers@6.8.0
│ ├── babel-messages@6.8.0
│ ├─┬ babel-template@6.15.0
│ ├─┬ babel-traverse@6.15.0
│ ├─┬ babel-types@6.15.0
├─┬ babel-generator@6.14.0
├── babel-plugin-syntax-async-functions@6.13.0
├── babel-plugin-syntax-flow@6.13.0
├─┬ babel-plugin-transform-async-to-generator@6.8.0
│ └── babel-helper-remap-async-to-generator@6.11.2
├─┬ babel-plugin-transform-class-properties@6.11.5
│ ├── babel-helper-function-name@6.8.0
│ └── babel-plugin-syntax-class-properties@6.13.0
├── babel-plugin-transform-es2015-destructuring@6.9.0
├─┬ babel-plugin-transform-es2015-modules-commonjs@6.14.0
│ └── babel-plugin-transform-strict-mode@6.11.3
├─┬ babel-plugin-transform-es2015-parameters@6.11.4
│ ├─┬ babel-helper-call-delegate@6.8.0
│ │ └── babel-helper-hoist-variables@6.8.0
│ └── babel-helper-get-function-arity@6.8.0
├── babel-plugin-transform-runtime@6.15.0
├─┬ babel-preset-es2015@6.14.0
│ ├── babel-plugin-check-es2015-constants@6.8.0
│ ├── babel-plugin-transform-es2015-arrow-functions@6.8.0
│ ├── babel-plugin-transform-es2015-block-scoped-functions@6.8.0
│ ├─┬ babel-plugin-transform-es2015-block-scoping@6.15.0
│ ├─┬ babel-plugin-transform-es2015-classes@6.14.0
│ │ ├─┬ babel-helper-define-map@6.9.0
│ │ ├── babel-helper-optimise-call-expression@6.8.0
│ │ └── babel-helper-replace-supers@6.14.0
│ ├── babel-plugin-transform-es2015-computed-properties@6.8.0
│ ├── babel-plugin-transform-es2015-duplicate-keys@6.8.0
│ ├── babel-plugin-transform-es2015-for-of@6.8.0
│ ├── babel-plugin-transform-es2015-function-name@6.9.0
│ ├── babel-plugin-transform-es2015-literals@6.8.0
│ ├── babel-plugin-transform-es2015-modules-amd@6.8.0
│ ├── babel-plugin-transform-es2015-modules-systemjs@6.14.0
│ ├── babel-plugin-transform-es2015-modules-umd@6.12.0
│ ├── babel-plugin-transform-es2015-object-super@6.8.0
│ ├── babel-plugin-transform-es2015-shorthand-properties@6.8.0
│ ├── babel-plugin-transform-es2015-spread@6.8.0
│ ├─┬ babel-plugin-transform-es2015-sticky-regex@6.8.0
│ │ └─┬ babel-helper-regex@6.9.0
│ ├── babel-plugin-transform-es2015-template-literals@6.8.0
│ ├── babel-plugin-transform-es2015-typeof-symbol@6.8.0
│ ├─┬ babel-plugin-transform-es2015-unicode-regex@6.11.0
│ └── babel-plugin-transform-regenerator@6.14.0
├─┬ babel-preset-react@6.11.1
│ ├── babel-plugin-syntax-jsx@6.13.0
│ ├── babel-plugin-transform-flow-strip-types@6.14.0
│ ├── babel-plugin-transform-react-display-name@6.8.0
│ ├─┬ babel-plugin-transform-react-jsx@6.8.0
│ │ └─┬ babel-helper-builder-react-jsx@6.9.0
│ ├── babel-plugin-transform-react-jsx-self@6.11.0
│ └── babel-plugin-transform-react-jsx-source@6.9.0
├── babel-regenerator-runtime@6.5.0
├─┬ babel-runtime@6.11.6
│ ├─┬ babel-plugin-transform-decorators-legacy@1.3.4
│ │ └── babel-plugin-syntax-decorators@6.13.0
│ ├─┬ babel-preset-stage-0@6.5.0
│ │ ├─┬ babel-plugin-transform-do-expressions@6.8.0
│ │ │ └── babel-plugin-syntax-do-expressions@6.13.0
│ │ ├─┬ babel-plugin-transform-function-bind@6.8.0
│ │ │ └── babel-plugin-syntax-function-bind@6.13.0
│ │ └─┬ babel-preset-stage-1@6.13.0
│ │ ├─┬ babel-plugin-transform-class-constructor-call@6.8.0
│ │ │ └── babel-plugin-syntax-class-constructor-call@6.13.0
│ │ ├─┬ babel-plugin-transform-export-extensions@6.8.0
│ │ │ └── babel-plugin-syntax-export-extensions@6.13.0
│ │ └─┬ babel-preset-stage-2@6.13.0
│ │ ├─┬ babel-plugin-transform-decorators@6.13.0
│ │ │ └─┬ babel-helper-explode-class@6.8.0
│ │ │ └── babel-helper-bindify-decorators@6.8.0
│ │ ├─┬ babel-plugin-transform-object-rest-spread@6.8.0
│ │ │ └── babel-plugin-syntax-object-rest-spread@6.13.0
│ │ └─┬ babel-preset-stage-3@6.11.0
│ │ ├── babel-plugin-syntax-trailing-function-commas@6.13.0
│ │ └─┬ babel-plugin-transform-exponentiation-operator@6.8.0
│ │ ├─┬ babel-helper-builder-binary-assignment-operator-visitor@6.15.0
│ │ │ └── babel-helper-explode-assignable-expression@6.8.0
│ │ └── babel-plugin-syntax-exponentiation-operator@6.13.0
│ ├── babelify@7.3.0
│ │ ├─┬ babel-generator@6.14.0
│ │ │ ├── babel-messages@6.8.0
│ │ │ ├─┬ babel-runtime@6.11.6
│ │ ├── babel-template@6.15.0
│ │ ├─┬ babel-traverse@6.15.0
│ │ │ ├─┬ babel-code-frame@6.11.0
│ │ ├─┬ babel-types@6.15.0