mirkoperillo / resting

A visual HTTP client browser extension
https://resting.owlcode.eu/
GNU General Public License v3.0
27 stars 12 forks source link

Format codebase #187

Closed nikhilraojl closed 1 year ago

nikhilraojl commented 1 year ago

Currently code in many places is not formatted properly. I am having to disable Format on save on my editor to push any PRs for review. Also code not being formatted causes trouble in skimming through it.

Can we resolve this? Maybe by running a formatter like prettier on entire codebase in one PR? Or by fixing one file at a time when we make some changes?

mirkoperillo commented 1 year ago

@nikhilraojl yes, it is time to have a formatter for project. I think prettier could be good.

I like your first proposal: a initial whole project formatting into one PR.

Do you have time to introduce a tool like prettier into the codebase ?

nikhilraojl commented 1 year ago

I have looked into using prettier for the entire codebase. It was throwing some html errors and wouldn't format some html files. Errors for one of the files:

prettier --check **/*.html
Checking formatting...
src\index.html[error] src\index.html: SyntaxError: Void elements do not have end tags "link" (33:71)
[error]   31 |
[error]   32 |   <!-- Bootstrap -->
[error] > 33 |   <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"></link>
[error]      |                                                                       ^^^^^^^
[error]   34 |   <link href="css/fork-awesome.min.css" rel="stylesheet" type="text/css"></link>
[error]   35 |   <link href="css/resting.css" rel="stylesheet" type="text/css"></link>
[error]   36 |

I thought it would be better we fix them first before running formatter. I will push a fix for invalid html and then we can run prettier in a separate PR. I hope this is fine

mirkoperillo commented 1 year ago

@nikhilraojl good idea, I merged your PR about html fixing