Closed
Description
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
montogeek commentedon Sep 26, 2016
Why not ask for it?
Example:
Do you want to export .babelrc and .eslintrc config files? (Y/n)
gaearon commentedon Sep 26, 2016
What’s the benefit to separate files as opposed to
package.json
?montogeek commentedon Sep 26, 2016
I like to have each library configuration on its respective config file
jcreamer898 commentedon Sep 26, 2016
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 commentedon Sep 26, 2016
You can always move it, it’s literally four lines:
I think this is a better default but once you eject, you can do anything you like.
wesbos commentedon 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 commentedon Sep 26, 2016
Ok, agree, can I do it? :D
gaearon commentedon Sep 26, 2016
Go for it @montogeek!
fson commentedon 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 commentedon Sep 26, 2016
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 commentedon 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 commentedon 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 commentedon 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 commentedon Sep 26, 2016
I'm glad that my decision to not make yet another dotfile for jest is getting some traction :)
gaearon commentedon Sep 27, 2016
Fixed in #773.