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

Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option

Open gotjoshua opened this issue 7 years ago • 9 comments

Atom 1.29.0 - Mac 10.11 - in a meteor project - cmd-shift-i gives this error:

Uncaught (in promise) Error: Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean.
    at new Importer (/Users/usernam/.atom/packages/atom-import-js/node_modules/import-js/build/Importer.js:118)
    at getImporter (/Users/usernam/.atom/packages/atom-import-js/lib/getImporter.js:8)
    at withModuleFinder (/Users/usernam/.atom/packages/atom-import-js/lib/import-js.js:121)
    at initializeModuleFinder.then.catch (/Users/usernam/.atom/packages/atom-import-js/lib/withModuleFinder.js:8)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188)
Importer @ /Users/usernam/.atom/packages/atom-import-js/node_modules/import-js/build/Importer.js:118
getImporter @ /Users/usernam/.atom/packages/atom-import-js/lib/getImporter.js:8
withModuleFinder @ /Users/usernam/.atom/packages/atom-import-js/lib/import-js.js:121
initializeModuleFinder.then.catch @ /Users/usernam/.atom/packages/atom-import-js/lib/withModuleFinder.js:8
_tickCallback @ internal/process/next_tick.js:188
Promise rejected (async)
withModuleFinder @ /Users/usernam/.atom/packages/atom-import-js/lib/withModuleFinder.js:6
fixImports @ /Users/usernam/.atom/packages/atom-import-js/lib/import-js.js:120
import-js:fix-imports @ /Users/usernam/.atom/packages/atom-import-js/lib/import-js.js:155
handleCommandEvent @ commitCommentContainer_item.graphql.js:112
module.exports.KeymapManager.dispatchCommandEvent @ commitCommentContainer_item.graphql.js:112
module.exports.KeymapManager.handleKeyboardEvent @ commitCommentContainer_item.graphql.js:112
handleDocumentKeyEvent @ commitCommentContainer_item.graphql.js:112

any known workarounds

gotjoshua avatar Aug 28 '18 20:08 gotjoshua

Hi! Sorry you're hitting this issue!

The same thing has been reported upstream as well: https://github.com/Galooshi/import-js/issues/515. The workaround is to install an older version of the plugin, or switch your project over to babel 7 (I think).

trotzig avatar Aug 30 '18 09:08 trotzig

Hey Thanks for your reply!

It seems that the decorators plugin requires an explicit value now... https://github.com/babel/babel/issues/8562

but I don't get where to set it... Is atom-import-js using a decorators plugin? does it belong in my project .babelrc?

I have a Meteor project ([email protected]) and i am not using any decorators plugin at the top level - could this be an issue that comes from a sub-dependency?

gotjoshua avatar Aug 31 '18 20:08 gotjoshua

I want to cross post a meteor thread here, because I really want to get to the bottom of this error: https://forums.meteor.com/t/babel-what-is-required-where-and-why/45420/2

Would changes to my project's babelrc file affect the operation of the atom-import-js package?

I downgraded to atom-import-js 0.14.0, by uninstalling and then running: apm install [email protected] Now i don't get the error anymore... but i still want to understand how to update.

Also curiously enough my colleague is able to run v0.15.0 in the same project repo!

hoping for insight...

gotjoshua avatar Sep 02 '18 15:09 gotjoshua

Don't forget the babel-eslint flag if you're using this https://github.com/babel/babel-eslint/issues/679 , that also changed very recently and that got me.

ecmaFeatures: {
  legacyDecorators: true
}

the-simian avatar Sep 03 '18 17:09 the-simian

Thanks! does that belong in the .eslintrc file? if so, as a top level option? or under parser options?

gotjoshua avatar Sep 03 '18 19:09 gotjoshua

parser options like

{
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "modules": true,
      "legacyDecorators": true
    }
  },
//... rest of linter file
}

the-simian avatar Sep 03 '18 23:09 the-simian

It looks like this is the same issue as https://github.com/Galooshi/import-js/issues/515. Any help debugging this is deeply appreciated 🙏.

trotzig avatar Sep 05 '18 14:09 trotzig

Don't forget the babel-eslint flag if you're using this babel/babel-eslint#679 , that also changed very recently and that got me.

ecmaFeatures: {
  legacyDecotators: true
}

Mind the typo:

legacyDecota--->t<---ors

This worked well for me:

  parserOptions: {
    parser: 'babel-eslint',
    'ecmaFeatures': {
      'legacyDecorators': true
    }
  }

kakenbok avatar Nov 02 '18 11:11 kakenbok

@kakenbok fixed spelling on initial comment! thanks

the-simian avatar Nov 02 '18 14:11 the-simian