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

Fix a definite style guide, linting fixes, hooks #86

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Fix a definite style guide, linting fixes, hooks #86

wants to merge 1 commit into from

Conversation

YashKumarVerma
Copy link
Contributor

@YashKumarVerma YashKumarVerma commented Mar 25, 2021

Description

  • Important : the diff is auto-generated by eslint & prettier.

What's done in this PR:

  • updated old eslint (from v6.8 to v7.x) as 6 is not compatible with prettier plugins
  • prettier
    • custom config file to match the code style
    • syncs with eslint to avoid conflicts
  • eslint changes
    • configs rewritten
      • removed browser as the backend is not interacting with any browser.
      • added prettier plugin to sync with prettier configs.
    • removes the .eslintignore file as node_modules are skipped by default.
  • pre-commit-hooks
    • new dependency
    • runs prettier and eslint-fix automatically before every commit
    • ensures that user always maintain the project code style.
    • option to override the hook if needed.

Motivation and Context

  • Fixes Central style config file #73
  • TLDR
    • strict style guide
    • automatically enforced
    • allows us to use automated checks on PR once setup.
    • integration with (almost) all code editors.

How Has This Been Tested?

  • the changes are done by an automated tool that changes the style of code. Therefore the code behaves the same way.
  • The pre-commit-hooks are manually tested and working.
  • The prettier confs and eslint configs are manually tested and do not conflict.

Screenshots (if appropriate)

  • NA

Types of changes

**What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

**Go over all the following points, and put an x in all the boxes that apply.
**(If you're unsure about any of these, don't hesitate to ask. We're here to help!)

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

I believe that such a big diff and that too generated by an automated tool should be ideally done by the project maintainer, therefore I am converting this PR into a draft PR.

- add .prettierrc file for style guide, can be used directly by code editors to style the code
- add scripts to run prettier from CLI, to trigger manually
- add pre-commit hooks for running formatter and linter before commit (optional)
- changes in the files are done by the hook itself
- use prettier plugin to link with eslint for integration
@YashKumarVerma YashKumarVerma marked this pull request as draft March 25, 2021 07:44
@YashKumarVerma YashKumarVerma changed the title Fix a definite style guide, linting fixes Fix a definite style guide, linting fixes, hooks Apr 8, 2021
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.

1 participant