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

ReadMe should mention that using this styleguide and its eslint plugins effectively requires babel #1544

Closed
williscool opened this issue Aug 30, 2017 · 3 comments

Comments

@williscool
Copy link

williscool commented Aug 30, 2017

Requires babel and a preset that compiles es6 code for use in node projects.

Due to the import syntax not yet being supported in current (circa creating this ticket) versions of node.

nodejs/help#53 (comment)

https://medium.com/the-node-js-collection/an-update-on-es6-modules-in-node-js-42c958b890c

@williscool williscool changed the title Read Me should mention that using this styleguide and its plugins effectively requires babel Read Me should mention that using this styleguide and its eslint plugins effectively requires babel Aug 30, 2017
@williscool williscool changed the title Read Me should mention that using this styleguide and its eslint plugins effectively requires babel ReadMe should mention that using this styleguide and its eslint plugins effectively requires babel Aug 30, 2017
@ljharb
Copy link
Collaborator

ljharb commented Aug 31, 2017

That's a good idea.

We certainly expect you're using https://npmjs.com/babel-preset-airbnb and https://npmjs.com/airbnb-browser-shims, or the equivalent. I'll add a note to the readme about it.

@jondkinney
Copy link

jondkinney commented Dec 31, 2018

@ljharb thanks for adding the clarifying note in the readme. However, it seems a bit needlessly overly opinionated? Perhaps that's the whole point of the guide :) But would it be fair to say that you can still use the airbnb styleguide with a non-ejected CRA application that is using the default babel-preset-react-app instead of what you specifically mention: babel-preset-airbnb?

There are countless blog posts that discuss how to setup eslint and prettier with airbnb styleguide and none of them talk about the need to eject from CRA and ensure that your babel config is using the airbnb preset instead of the one provided by CRA.

Can you please clarify if there will be any issues or edge cases setting up eslint and prettier to use the airbnb config while sticking in the confines of a non-ejected CRA app? The only thing that comes to mind is that it could be possible (if I'm thinking about this right) to have eslint suggest changing a line of code to something that the babel-preset-react-app config won't properly transpile, leading you to need to override the eslint config or ignore a rule conditionally in a file or on a line. Have you seen that in practice? Is it worth worrying about? Thanks!

@ljharb
Copy link
Collaborator

ljharb commented Dec 31, 2018

I don't believe CRA can be used with airbnb linting/babel settings without ejecting; and no, I would not assume that any other babel preset will be completely compatible.

Internally, we always require CRA apps to be immediately ejected, so that they can utilize airbnb's settings.

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

No branches or pull requests

3 participants