estree-to-babel
Advanced tools
Comparing version 4.4.0 to 4.5.0
@@ -13,3 +13,6 @@ 'use strict'; | ||
const convertImportDeclaration = require('./convert-import-declaration'); | ||
const {convertTSClassImplements} = require('./ts'); | ||
const { | ||
convertTSClassImplements, | ||
convertPropertyDefinition, | ||
} = require('./ts'); | ||
@@ -58,2 +61,6 @@ const {convertNodeComments} = require('./comments'); | ||
return convertTSClassImplements(path); | ||
if (type === 'PropertyDefinition') { | ||
return convertPropertyDefinition(path); | ||
} | ||
}, | ||
@@ -60,0 +67,0 @@ exit(path) { |
@@ -6,1 +6,23 @@ 'use strict'; | ||
}; | ||
module.exports.convertPropertyDefinition = (path) => { | ||
const {node} = path; | ||
if (node.key.type === 'PrivateIdentifier') { | ||
const {key} = node; | ||
node.type = 'ClassPrivateProperty'; | ||
node.key = { | ||
type: 'PrivateName', | ||
id: { | ||
...key, | ||
type: 'Identifier', | ||
}, | ||
}; | ||
return; | ||
} | ||
path.node.type = 'ClassProperty'; | ||
}; | ||
{ | ||
"name": "estree-to-babel", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "convert estree ast to babel", |
@@ -15,5 +15,5 @@ # Estree-to-babel [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL] | ||
- [acorn](https://github.com/acornjs/acorn) | ||
- [cherow](https://github.com/cherow/cherow) | ||
- [espree](https://github.com/eslint/espree) | ||
- [`acorn`](https://github.com/acornjs/acorn) | ||
- [`cherow`](https://github.com/cherow/cherow) | ||
- [`espree`](https://github.com/eslint/espree) | ||
- etc... | ||
@@ -23,7 +23,7 @@ | ||
- [@babel/traverse](https://babeljs.io/docs/en/babel-traverse) | ||
- [@babel/types](https://babeljs.io/docs/en/babel-types) | ||
- [`@babel/traverse`](https://babeljs.io/docs/en/babel-traverse) | ||
- [`@babel/types`](https://babeljs.io/docs/en/babel-types) | ||
- etc... | ||
The thing is `@babel/parser` has a [little differences](https://babeljs.io/docs/en/babel-parser#output) with `estree` standard: | ||
The thing is [`@babel/parser`](https://babeljs.io/docs/en/babel-parser) has a [little differences](https://babeljs.io/docs/en/babel-parser#output) with `estree` standard: | ||
@@ -43,5 +43,8 @@ - `Property` of `ObjectExpression` called `ObjectProperty`; | ||
Also ([typescript-estree](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree) has differenceswith `@babel/parser`: | ||
Also [typescript-estree](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree) has differences with `@babel/parser`: | ||
-`TSClassImplements` used instead of `TSExpressionWithTypeArguments | ||
- `TSClassImplements` used instead of `TSExpressionWithTypeArguments` | ||
- `ClassPrivateProperty` instead of `PropertyDefinition` when `key.type=PrivateName`; | ||
- `ClasseProperty` instead of `PropertyDefinition` when `key.type=TSPrivateIdentifier`; | ||
- 'PrivateName` instead of `TSPrivateIdentifier`; | ||
- etc... | ||
@@ -48,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19411
315
80