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

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

Closed
gaearon opened this issue Sep 26, 2016 · 15 comments
Closed

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

gaearon opened this issue Sep 26, 2016 · 15 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Sep 26, 2016

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.

@montogeek
Copy link
Contributor

montogeek commented Sep 26, 2016

Why not ask for it?

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

@gaearon
Copy link
Contributor Author

gaearon commented Sep 26, 2016

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

@montogeek
Copy link
Contributor

montogeek commented Sep 26, 2016

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

@jcreamer898
Copy link

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
Copy link
Contributor Author

gaearon commented Sep 26, 2016

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
Copy link

wesbos commented Sep 26, 2016

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
Copy link
Contributor

Ok, agree, can I do it? :D

@gaearon
Copy link
Contributor Author

gaearon commented Sep 26, 2016

Go for it @montogeek!

@fson
Copy link
Contributor

fson commented Sep 26, 2016

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
Copy link

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
Copy link
Contributor

fson commented Sep 26, 2016

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
Copy link
Contributor Author

gaearon commented Sep 26, 2016

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
Copy link
Contributor

fson commented Sep 26, 2016

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
Copy link
Contributor

vjeux commented Sep 26, 2016

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
Copy link
Contributor Author

gaearon commented Sep 27, 2016

Fixed in #773.

@gaearon gaearon closed this as completed Sep 27, 2016
@fson fson removed this from the 0.7.0 milestone Oct 12, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants