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

Refactor: Don't use alias to export print function #109

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Conversation

zackad
Copy link
Owner

@zackad zackad commented Dec 18, 2024

The modular print function has signature

const p = (node, path, print, options) => {
    // function body here
}

It is easy to recognise which is the main function responsibe to build the doc. Unfortunately it has to be aliased when exported to prevent name collision. And it is not obvious where the callstack come from when debugging since it share the same name across multiple file/module.

With Alias
Screen Shot 2024-12-18 at 15 46 56

No Alias
Screen Shot 2024-12-18 at 15 46 12

The modular print function has signature
```js
const p = (node, path, print, options) => {
    // function body here
}
```

It is easy to recognise which is the main function responsibe to build
the doc. Unfortunately it has to be aliased when exported to prevent
name collision. And it is not obvious where the callstack come from when
debugging since it share the same name across multiple file/module.
@zackad zackad merged commit 51f1014 into master Dec 18, 2024
3 checks passed
@zackad zackad deleted the no-alias-export branch December 18, 2024 11:46
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.

1 participant