Skip to content

Code Quality : Linting and formatting#69

Merged
anomic30 merged 6 commits into
anomic30:mainfrom
ezehlivinus:linting-and-formatting
Oct 6, 2022
Merged

Code Quality : Linting and formatting#69
anomic30 merged 6 commits into
anomic30:mainfrom
ezehlivinus:linting-and-formatting

Conversation

@ezehlivinus

Copy link
Copy Markdown
Contributor

Description

This defined coding standards (code quality) and formatting styles. This was done to help collaborators follow the same style to avoid inconsistency and quality of code.
To do this, ESLint was used as a linting tool for code quality and prettier was used as a formatting tool. The standard extended is the Airbnb JavaScript style guide.
As a result, ESLint and its peer dependencies.

Fixes #60 (issue)

Type of change

  • 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)
  • This change requires a documentation update
  • Chore: update coding style/standard

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ezehlivinus

Copy link
Copy Markdown
Contributor Author

I have tested this in a separate branch. Review, if it is okay, then you can run npm run lint:format. Why I did not do this myself is because most of the existing code would be formatted. As a result, it would show that I made changes in all the files at least for the first time. This will help see the small changes that were made without lifting and formatting the whole code.

After your review, we can lint it.

@ezehlivinus

Copy link
Copy Markdown
Contributor Author

Note that the lint and format are run by the developer. If the person forgets, then the code still gets pushed. No pre-hook like the one described here or some kind of CI automation.

@anomic30

@anomic30 anomic30 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include a prettierignore file to ignore node modules when linting?

@ezehlivinus

Copy link
Copy Markdown
Contributor Author

Should we include a prettierignore file to ignore node modules when linting?

Yes yes. I didn't add that because prettier ignores that by default... But we can excilicitly ignore that.

@anomic30

@ezehlivinus

Copy link
Copy Markdown
Contributor Author

Also @ezehlivinus, can you add a pre-commit hook so that the code is formatted properly? Maybe use husky

Okay fine.

I am trying to finish or fix up #71 ...PR

@anomic30 anomic30 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@anomic30

anomic30 commented Oct 6, 2022

Copy link
Copy Markdown
Owner

Also @ezehlivinus, can you add a pre-commit hook so that the code is formatted properly? Maybe use husky

Okay fine.

I am trying to finish or fix up #71 ...PR

We can set it up later.

@anomic30 anomic30 merged commit 0a3e4e8 into anomic30:main Oct 6, 2022
@anomic30 anomic30 added enhancement New feature or request hacktoberfest-accepted Accepted for Hacktoberfest 2022 hacktoberfest labels Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hacktoberfest hacktoberfest-accepted Accepted for Hacktoberfest 2022

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint: enforce coding standards

2 participants