import-js icon indicating copy to clipboard operation
import-js copied to clipboard

Unable to import files when using smart pipeline operator

Open LandonSchropp opened this issue 3 years ago • 0 comments

I have my project set up to use the smart pipeline operator via the babel/plugin-proposal-pipeline-operator plugin. When I'm in a file using this operator, importjs fails to import my modules with an error.

Here's an example of a file:

export function mapDouble(array) {
  return array |> _.map(#, x => x * 2);
}

When I run importjs fix source/javascript/example.js, I get the following error:

{
  "messages": [
    "SyntaxError: Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option. (2:24)"
  ],
  "fileContent": "export function mapDouble(array) {\n  return array |> _.map(#, x => x * 2);\n}\n",
  "unresolvedImports": {}
}

This code works fine inside my app, but not with importjs. Here's my .babelrc:

{
  "presets": [ "babel-preset-react-app" ],
  "plugins": [
    [ "@babel/plugin-proposal-pipeline-operator", { "proposal": "smart" } ]
  ]
}

Thanks!

LandonSchropp avatar May 20 '21 15:05 LandonSchropp