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

Eslint-Prettier integration & pre commit hook #2272

Merged
merged 3 commits into from
Oct 9, 2020

Conversation

vnishukov
Copy link
Contributor

@vnishukov vnishukov commented Oct 7, 2020

Motivation and context

Why:
https://prettier.io/docs/en/comparison.html

Description:
Using auto formatting tool like this integrated with project linter and pre-commit hooks is the fastest way to inline code styling for whole project

What it can do:

  • Format code to look pretty well for reading and understanding
  • Automatically add our header under commit process
  • Automatically format weird writing code under commit process
  • Automatically fix all autofixable stuffs using eslint under commit process
  • Prevent commit if any linter error is present and it cant be autofixed. Write user what exactly the error is

Benefits:

  • We will get unified code in the repo no matter how it was initially wrote
  • We can be sure that all of ours linter rules will be followed each contributor even if he/she not completely know this rules
  • Nice, clear and readable, pretty well formatted code which is easy to understand and support

See the auto formatted file as example below (shortcuts-dialog.tsx)

How has this been tested?

Make a changes for unformatted file, make couple of linter issues and try to commit.
In case all issues are autofixable hook will format all stuffs automatically otherwise it will write the error to console

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT

@vnishukov vnishukov requested a review from azhavoro as a code owner October 7, 2020 14:26
@vnishukov vnishukov changed the title Eslint prettier integrations and precommit hook Eslint-Prettier integration & pre commit hook Oct 7, 2020
@coveralls
Copy link

coveralls commented Oct 7, 2020

Coverage Status

Coverage remained the same at 65.32% when pulling 997ac41 on eh/eslint-prettier-integration into a4e8a98 on develop.

@nmanovic
Copy link
Contributor

nmanovic commented Oct 9, 2020

@vnishukov , could you please fix merge conflicts?

@nmanovic
Copy link
Contributor

nmanovic commented Oct 9, 2020

@vnishukov , I don't see git hooks in the commit.

@vnishukov
Copy link
Contributor Author

@vnishukov , could you please fix merge conflicts?

Sure, I will

@vnishukov vnishukov requested a review from nmanovic October 9, 2020 13:26
@bsekachev bsekachev merged commit 678f5b9 into develop Oct 9, 2020
@bsekachev bsekachev deleted the eh/eslint-prettier-integration branch October 12, 2020 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants