Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Update AST for TSModuleDeclaration #371

Closed
@JamesHenry

Description

@JamesHenry

Currently, we do not explicitly handle the transformation of SyntaxKind.ModuleDeclaration.

As per discussions with Andy, we want to move more towards modifiers being applied as booleans on the node, rather than persisting the array of modifiers (where possible).

Because we are falling back with deeplyCopy(), we are also currently persisting name from the original TSNode, whereas we should be using id.

E.g. the refactored AST diff would be something like:

-      "modifiers": Array [
-        Object {
-          "loc": Object {
-            "end": Object {
-              "column": 7,
-              "line": 1,
-            },
-            "start": Object {
-              "column": 0,
-              "line": 1,
-            },
-          },
-          "range": Array [
-            0,
-            7,
-          ],
-          "type": "TSDeclareKeyword",
-        },
-      ],
+      "declare": true,
-      "name": Object {
+      "id": Object {

I do not believe this change will have a negative impact on linting capabilities, and downstream dependencies can easily be updated to check for the boolean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions