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

Replace Airbnb linting with prettier #18

Closed
arvigeus opened this issue Apr 11, 2017 · 5 comments
Closed

Replace Airbnb linting with prettier #18

arvigeus opened this issue Apr 11, 2017 · 5 comments
Assignees
Labels

Comments

@arvigeus
Copy link

Airbnb code guide is great, but developer's job is to focus on code, not on code styling. Prettier "just works" and produces nicely formatted code without forcing you to think about formatting.

@lucasmotta
Copy link

@arvigeus I think Airbnb's linter provides more than just styling rules, it also checks for possible mistakes. Prettier in the other hand, only cares about how your code looks.
So IMO they can both live together, maybe some of the eslint rules for code-style could be disabled then.

@leebenson
Copy link
Owner

I agree with @lucasmotta. I think there's a huge benefit to enforcing linting during the code process, not just afterwards. In bigger teams, it keeps everyone on the same page. In solo teams, it can pick up on obvious goofs like missing commas or uninitialised vars. The eslinter provided also dynamically checks propTypes on components and highlights if something is declared but not used, or vice versa. IMO, these are all invaluable coding aids that I would like to keep.

As for prettier integration, where in the workflow do you think it should fit in? Since prettier outputs a uniform format, it's just as easy (and possibly more useful) to enable it in Atom or another IDE and get prettify-on-save functionality. I could add it as a step to Webpack to prettify on bundle, but then that only happens when you run a corresponding npm... command -- arguably, the job of the editor you're writing it in. And there's no sense prettifying bundled code, because that's all minified for production anyway, so bolting it on to the webpack flow probably isn't that useful.

I'll keep this open to thoughts for now.

Somewhat related to #19.

@leebenson leebenson self-assigned this Apr 11, 2017
@arvigeus
Copy link
Author

Airbnb and Prettier disagree on some styling rules - for example 'string' vs "string" and can't be used together (or at least not in their current form)
As for fixing possible mistakes, I think prettier does that. Not totally sure, @lucasmotta, can you provide and example? This could be somehow related to #19, because CRA uses prettier by default and probably eslint-config-react-app contains those checks as well.
As for where prettier could fit, maybe as a pre-commit step.

@leebenson
Copy link
Owner

There's this that might be useful.

Picking up code goofs and conforming code to a style would be perfect.

@leebenson
Copy link
Owner

I want to create a 'slim' version of the repo shortly that would not have any opinions as far as linting and stylistic choices, so it'd be up to the developer to add in things like prettier.

I'll close this for now.

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

No branches or pull requests

3 participants