Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add all node walkers method as no implemented #3

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

maastrich
Copy link
Collaborator

what does it do?

This pull request adds all methods for nodes walking as not implemented.

why is it needed?

This will make it easier to implement the missing methods in the future and allow usage without crashing on missing node walkers

@morganney
Copy link
Owner

@maastrich thanks for this, I really appreciate your help.

I was actually sitting on a bit of work that I did over the weekend, and so would like to get that in first. However, I can then pull this branch and resolve any merge conflicts, etc.

How does that sound?

@maastrich
Copy link
Collaborator Author

maastrich commented Jun 10, 2024

@morganney sure as you want 💪
I've also based my other PR on this branch and started few of the remaining walkers

@maastrich
Copy link
Collaborator Author

@morganney the rebase is done 💪

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 36.36364% with 287 lines in your changes missing coverage. Please review.

Project coverage is 51.69%. Comparing base (e88099c) to head (15d74cf).

Files Patch % Lines
src/baseVisitor.ts 35.21% 287 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main       #3       +/-   ##
===========================================
- Coverage   83.88%   51.69%   -32.19%     
===========================================
  Files           2        2               
  Lines         242      677      +435     
  Branches       13       12        -1     
===========================================
+ Hits          203      350      +147     
- Misses         39      327      +288     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@morganney morganney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maastrich this is great work and much appreciated! We can work on the test coverage as we go, I'm still tinkering with the best approach to that.

@morganney morganney merged commit 8f967ab into morganney:main Jun 10, 2024
1 of 3 checks passed
@maastrich
Copy link
Collaborator Author

@morganney thanks for the merge,
I was thinking about unit tests using jest ?
that way we can use the jest.spy method on any base visitor method and checke that it has been called
I can try and setup this on my other PR ?

@morganney
Copy link
Owner

@maastrich Would you mind trying something similar with nodes native test runner first? I’ve used a similar approach on other projects. Here’s the relevant documentation: https://nodejs.org/api/test.html#mockmethodobject-methodname-implementation-options

Only reason is I’d like to avoid the extra dependency on jest.

@maastrich
Copy link
Collaborator Author

Sure, didn't know node natives tests utils were that high level

maastrich added a commit to maastrich/swc-walk that referenced this pull request Jun 17, 2024
commit a3c417b
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 20:54:32 2024 +0200

    chore: Remove console.error in AssignmentProperty method

commit 281106d
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 20:46:56 2024 +0200

    chore: Enable decorators in parseSync options

commit b59b57a
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 20:07:49 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit 631e4f2
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 18:13:35 2024 +0200

    chore: Update npm dependency to latest stable version

commit 54ee886
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 16:13:18 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit e626433
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 16:05:10 2024 +0200

    chore: Update npm dependency to latest stable version

commit fe09515
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 19:27:19 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit 5c21cbc
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 17:31:16 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit e86fc0c
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 02:28:27 2024 +0200

    feat: Implement all node walkers method

commit dab2fd8
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 01:37:41 2024 +0200

    chore: Implement all node walkers method

commit 8f967ab
Author: Mathis Pinsault <pinsaultm@gmail.com>
Date:   Tue Jun 11 01:56:53 2024 +0200

    chore: add all node walkers method as no implemented (morganney#3)

    * chore: add all node walkers method as no implemented

    * refactor: remove unused import in walk.ts

commit e88099c
Author: Morgan Ney <morganney@gmail.com>
Date:   Mon Jun 10 18:39:17 2024 -0500

    feat: add more nodes. (morganney#4)

    * chore: add style preferences as lint rules.
morganney pushed a commit that referenced this pull request Jun 17, 2024
* Squash chore/add-visitors (merge-base 72c04a6, previous tip a3c417b)

commit a3c417b
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 20:54:32 2024 +0200

    chore: Remove console.error in AssignmentProperty method

commit 281106d
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 20:46:56 2024 +0200

    chore: Enable decorators in parseSync options

commit b59b57a
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 20:07:49 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit 631e4f2
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 18:13:35 2024 +0200

    chore: Update npm dependency to latest stable version

commit 54ee886
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 16:13:18 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit e626433
Author: maastrich <pinsaultm@gmail.com>
Date:   Wed Jun 12 16:05:10 2024 +0200

    chore: Update npm dependency to latest stable version

commit fe09515
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 19:27:19 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit 5c21cbc
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 17:31:16 2024 +0200

    feat: Add missing callbacks for function properties in BaseVisitor

commit e86fc0c
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 02:28:27 2024 +0200

    feat: Implement all node walkers method

commit dab2fd8
Author: maastrich <pinsaultm@gmail.com>
Date:   Tue Jun 11 01:37:41 2024 +0200

    chore: Implement all node walkers method

commit 8f967ab
Author: Mathis Pinsault <pinsaultm@gmail.com>
Date:   Tue Jun 11 01:56:53 2024 +0200

    chore: add all node walkers method as no implemented (#3)

    * chore: add all node walkers method as no implemented

    * refactor: remove unused import in walk.ts

commit e88099c
Author: Morgan Ney <morganney@gmail.com>
Date:   Mon Jun 10 18:39:17 2024 -0500

    feat: add more nodes. (#4)

    * chore: add style preferences as lint rules.

* chore: Update npm dependency to latest stable version

* chore: Update @swc/types npm dependency to version 0.1.8

* feat: Update AggregatedNode type to include ExportSpecifier and ImportSpecifier

* feat: Fix typo in test/utils.ts

The commit message suggests that a typo has been fixed in the `test/utils.ts` file.

* chore: Update tsconfig.json to include "test" and "eslint.config.js" in the "include" field

* fix

* chore: Update npm dependency to latest stable version

* chore: Fix unnecessary condition in TsPropertySignature method

The code changes in `baseVisitor.ts` fix an unnecessary condition in the `TsPropertySignature` method. The `for` loop now correctly handles the case when `n.params` is undefined. This change improves the code's readability and ensures proper execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants