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

babel-plugin error when using domain() #580

Open
olegKusov opened this issue Dec 9, 2021 · 5 comments
Open

babel-plugin error when using domain() #580

olegKusov opened this issue Dec 9, 2021 · 5 comments
Labels
bug Something isn't working effector/babel-plugin babel plugin

Comments

@olegKusov
Copy link

olegKusov commented Dec 9, 2021

What is the current behavior:

When use visx with d3 domain() function, app crashed because of conflicts with function naming. Need isolation of babel-plugin from another code. Without babel-plugin I can't use normally logging.

Please provide the steps to reproduce and if possible a minimal demo of the problem via https://share.effector.dev, https://codesandbox.io or similar

  1. Install visx
  2. use domain() function from scale.

What is the expected behavior:

no errors

Which versions of effector packages, and which browser and OS are affected by this issue? Did this work in previous versions of effector?:

"effector": "21.8.12",
"effector-react": "^21.3.3",

@olegKusov olegKusov added bug Something isn't working needs triage labels Dec 9, 2021
@zerobias
Copy link
Member

zerobias commented Dec 9, 2021

Our plugin has options to disable particular transformations, in your case it will looks like that

{
  "plugins": [
    ["effector/babel-plugin", {
      "domainMethods": {
        "domain": ["createDomain"]
      }
    }]
  ]
}

This reads as "when parsing source code, treat as creation of subdomain calls of .createDomain property only"

And as for isolation, I was hoping for babel, that users would configure exceptions through it, but apparently babel is not up to this task and we' ll have to add options to the plugin itself

@zerobias zerobias added effector/babel-plugin babel plugin and removed needs triage labels Dec 9, 2021
@olegKusov
Copy link
Author

@zerobias I did not found this info in effector docs. maybe we can add it

@egorguscha
Copy link
Collaborator

@zerobias Perhaps I'm wrong, but why it should specify?
I guess it should work by default

const normalizeOptions = options => {
   const defaults = options.noDefaults ? {....} : {....., domainMethods: {domain: ['createDomain']}}
}

@zerobias
Copy link
Member

zerobias commented Dec 10, 2021

full set of options of that group:

  • storeCreators
  • eventCreators
  • effectCreators
  • domainCreators
  • restoreCreators
  • combineCreators
  • sampleCreators
  • forwardCreators
  • guardCreators
  • attachCreators
  • splitCreators
  • apiCreators
  • mergeCreators
  • domainMethods
    • store
    • event
    • effect
    • domain

honestly, I don’t quite like the naming, for example inconsistent apiCreators (and createApiCreators would be even worse). probably, there should be no -Creators postfix

@zerobias
Copy link
Member

@egorguscha there is another supported alias for .createDomain: .domain, which leads to this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effector/babel-plugin babel plugin
Projects
None yet
Development

No branches or pull requests

3 participants