Skip to content

Move Babel and ESLint configuration into package.json after ejecting #766

Closed
@gaearon

Description

@gaearon

Update: claimed by @montogeek

Currently we emit .babelrc and .eslintrc after ejecting.
This is better than embedding them in Webpack config like before, but still not ideal.

I think we should embed Babel and ESLint configuration into package.json after ejecting.
We already do this for Jest.

Relevant settings in package.json are called babel and eslintConfig.

This issue is up for grabs. If you’d like to work on it please comment below so that multiple people don’t work on the same thing. Please respect it if somebody has already commented, and don’t try to submit a PR before them.

Activity

added this to the 0.7.0 milestone on Sep 26, 2016
montogeek

montogeek commented on Sep 26, 2016

@montogeek
Contributor

Why not ask for it?

Example:
Do you want to export .babelrc and .eslintrc config files? (Y/n)

gaearon

gaearon commented on Sep 26, 2016

@gaearon
ContributorAuthor

What’s the benefit to separate files as opposed to package.json?

montogeek

montogeek commented on Sep 26, 2016

@montogeek
Contributor

I like to have each library configuration on its respective config file

jcreamer898

jcreamer898 commented on Sep 26, 2016

@jcreamer898

Less dotfiles FTW in my opinion. It's getting out of hand have a dotfile for all the things.

Seems to make more sense to have all the configuration live in a single spot with key value pairs rather than distributing the concern to all these different dotfiles.

gaearon

gaearon commented on Sep 26, 2016

@gaearon
ContributorAuthor

I like to have each library configuration on its respective config file

You can always move it, it’s literally four lines:

  babel: {
    presets: ['react-app']
  },
  eslintConfig: {
    extends: 'react-app'
  }

I think this is a better default but once you eject, you can do anything you like.

wesbos

wesbos commented on Sep 26, 2016

@wesbos

Yeah - and especially because CRA is targeted towards beginners, I can't tell you how much email I get from people who lose their dotfiles because no OS shows hidden files by default.

montogeek

montogeek commented on Sep 26, 2016

@montogeek
Contributor

Ok, agree, can I do it? :D

gaearon

gaearon commented on Sep 26, 2016

@gaearon
ContributorAuthor

Go for it @montogeek!

fson

fson commented on Sep 26, 2016

@fson
Contributor

I'm not sure if this is a good idea. I understand hidden files can be confusing beginners, but maybe the solution is not moving parts of the config to package.json, but teaching beginners to work with dotfiles.

Dotfiles are still going to be the solution for any platform independent configuration files that are supposed to also work in non-JS projects where package.json is not available, for example: .env, .gitignore, .editorconfig or .graphqlrc. Every developer will be exposed to these sooner than later, so I feel trying to hide them from the users instead of teaching might be just passing the buck.

jcreamer898

jcreamer898 commented on Sep 26, 2016

@jcreamer898

Those are system level dotfiles though, and that makes sense. Seems like for package specific ones it can eliminate confusion by keeping that configuration altogether? (no strong opinion here, just thoughts) :)

fson

fson commented on Sep 26, 2016

@fson
Contributor

I meant the project specific .env, .gitignore, .editorconfig or .graphqlrc etc. files. Ejecting a CRA project already creates a .gitignore and we support .env for specifying environment variables.

Anyway, I don't feel strongly about this either, and can't come up with reasons why config in package.json would be any worse than separate files. So why not. 😅

gaearon

gaearon commented on Sep 26, 2016

@gaearon
ContributorAuthor

You project’s build won’t break if you miss .gitignore or .editorconfig. I see the point about .graphqlrc and .env but both are more advanced use cases. Making just the common case more bulletproof is better than doing nothing IMO.

fson

fson commented on Sep 26, 2016

@fson
Contributor

Agreed, you convinced me. 👍

And unlike GraphQL or environment variables, Jest, ESLint and Babel are all JS specific things, so package.json also kind of makes sense for them.

vjeux

vjeux commented on Sep 26, 2016

@vjeux
Contributor

We already do this for Jest.

I'm glad that my decision to not make yet another dotfile for jest is getting some traction :)

gaearon

gaearon commented on Sep 27, 2016

@gaearon
ContributorAuthor

Fixed in #773.

removed this from the 0.7.0 milestone on Oct 12, 2016
locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wesbos@vjeux@jcreamer898@fson@gaearon

        Issue actions

          Move Babel and ESLint configuration into package.json after ejecting · Issue #766 · facebook/create-react-app