Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

🐛 Exclude .babelrc from APM releases (fixes #796) #809

Merged
merged 1 commit into from
Feb 10, 2017

Conversation

SpainTrain
Copy link
Member

@SpainTrain SpainTrain commented Feb 10, 2017

Background

It appears that if any file recursively required by the linter-eslint worker includes babel/register, then all babel configs through all parent directories of that file are processed.

Here is where babel/register inits OptionManager: https://github.com/babel/babel/blob/master/packages/babel-register/src/node.js#L51

And here is where OptionManager iterates parent dirs: https://github.com/babel/babel/blob/master/packages/babel-core/src/transformation/file/options/build-config-chain.js#L60

In #796, this happens specifically when eslint-import-resolver-webpack requires a webpack config that in turn requires babel/register. register inits OptionManager, which in turn finds and processes all babel configs in parent dirs, and chokes when it cannot find the referenced plugins/presets.

Here is where eslint-import-resolver-webpack requires the webpack config (vanilla require): https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/webpack/index.js#L68

Solution

Since the .babelrc is going to get processed if it is present in the APM package dir, either

  • Any plugins or presets it uses must be production deps, OR
  • The .babelrc file must not be in the isntalled APM package

This PR does the latter since .babelrc seems to be only a build-time config, and not needed to run the plugin. (Locally I have confirmed that simplying deleting the .babelrc file from the APM package dir fixes #796)

Changes

  • Added git attribute to export-ignore build-time babelrc config

Related

APM/export-ignore: atom/apm#498 (comment)

Closes #796


This change is Reviewable

- Added git attribute to export-ignore build-time babelrc config

More info: atom/apm#498 (comment)

Closes AtomLinter#796
@SpainTrain SpainTrain force-pushed the 796-apmignore-babelrc branch from 0a5f6f6 to 113aa1c Compare February 10, 2017 02:34
Copy link
Member

@IanVS IanVS left a comment

Choose a reason for hiding this comment

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

Great work tracking this down. Thanks for the PR.

@SpainTrain SpainTrain merged commit cb068a7 into AtomLinter:master Feb 10, 2017
@SpainTrain SpainTrain deleted the 796-apmignore-babelrc branch February 10, 2017 08:21
@wuct
Copy link

wuct commented Feb 10, 2017

Thanks! Would you release a patch version for this fix?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants