* Use isIdentifierChar instead of regex for toIdentifier
* Apply suggestions from code review
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
* Undo dep
* Update packages/babel-types/test/converters.js
* Add testcase starting with a number
* Add test for non-ascii starting character
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
* fix: statementlist behavior
* fixed prettier and babel-types/converter errors
* added check for first node
* remove node length check, only check if node is first
* add reset eLU if proceeding is non-empty
* fix failure for ci tests
* remove .expressions since sequence expression isn't produced
* changed test title
* feat: add cloneDeepWithoutLoc
* fix: sort functions alphabetically
* doc: add documentation for the withoutLoc parameter
* test: add a test for shallow cloneWithoutLoc
* test: add loc object to node and fix test
* fix: set loc object on deeper node
* test: check loc on deeper node is null
* doc: adjust withoutLoc documentation
* fix: add withoutLoc param to deep clones
* fix: apply cloneIfNodeOrArray for leadingComments, innerComments and trailingComments
* test: add test for leadingComments, innerComments and trailingComments
* Cleanup PR
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Change isReferenced to return false for object/class method parameter names.
* use indexOf instead of for-of loop
* replace `.indexOf` check with `.includes` and assume `parent.params` exists
Co-Authored-By: Justin Ridgewell <justin@ridgewell.name>
* check .params within case block for ClassMethod/ClassPrivateMethod/ObjectMethod only
* add comment clarifying that case clause fall-through is intentional
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* fix: strip type imports used in Enums and object types
* chore: update failing snapshot
* docs: correct TSPropertySignature comment
* fix: enum value should be considered a reference
* chore: add tests for TSPropertySignature and TSEnumMember
Fixes#8163
The `isNodesEquivalent()` algorithm incorrectly assumes that any object properties must themselves be AST nodes, which is not the case here, causing the error.
| Q | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues? | Fixes#8001
| Patch: Bug Fix? | Y
| Major: Breaking Change? | Not unless things were relying on a very specific AST structure as output
| Minor: New Feature? |
| Tests Added + Pass? | Yes
| Documentation PR | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes? |
| License | MIT
The filed bug was for `-0`, but I also realize that `numericLiteral` also shouldn't be getting `-Infinity`/`Infinity` or `NaN` since those just get stringified with the JS-standard stringification logic which means we get a reference to `NaN` or `Infinity` identifiers, which could have been shadowed in a local scope and thus not be the right value. I've avoided that by generating `NaN` as `0/0` and the infinity values as `1/0` and `-1/0`.
* Add tests for path type inferers
* Add test for babel-types.valueToNode
* Add tests for babel-types.toKeyAlias
* Add tests for babel-types.toStatement
* Add tests for babel-types.toExpression
* Lint fixes in babel-traverse/test/inference