Forem: Fix linting issues in the views

Created on 21 Feb 2019  路  34Comments  路  Source: forem/forem

A couple of weeks ago erblint and the corresponding lint-staged hook were added to the project.
But for now there is a huge linting debt in the *.html.erb files. You can learn more about how it could affect the project and the contributions to it from the discussion #1828 .
Volunteers could help the project to eliminate the debt or make it smaller.
You can get the list of the linting issues running:

bundle exec erblint --lint-all

Get the list for of issues for the specific file or directory:

bundle exec erblint app/views/%path_to_file_or_directory%

You can use --autocorrect flag, but be careful with it, cause it sometimes fixes indentation incorrectly.
I would recommend running

bundle exec erblint --autocorrect %path_to_file%` and check manually if the fixes are correct.

Please, keep the pull requests small, so they could be reviewed faster. E.g. a separate pull request for each of the app/views/ folder (e.g. app/views/comments).
If there're some issues you can't fix, please, leave a comment to this issue, or commit with a --no-verify flag and mention it in your pull request.
I would appreciate your help with this issue.

good first issue

Most helpful comment

I will probably start working on this this weekend (not sure if you can assignee an issue to me), if anyone wants to help please check if I am not already working on that specific folder.

volunteer

All 34 comments

I will probably start working on this this weekend (not sure if you can assignee an issue to me), if anyone wants to help please check if I am not already working on that specific folder.

volunteer

Hello 馃憢 I'd like to start working on fixing the linting issues for the views in app/views/additional_content_boxes.

Update: Done in #1843 馃樃

Currently fixing linting issues for app/views/admin files.

Update: Done in #1871

Like the idea of using this thread to coordinate, thanks @lightalloy !

@arnellebalane in lots of files there are also HTML errors, if you find any please also fix them.

As I mentioned here:
https://github.com/thepracticaldev/dev.to/issues/1828#issuecomment-465199995

@Glennmen Noted, thanks for pointing that out! I'll keep an eye on errors like those in the views as I go along fixing linting issues in them 馃憤

Working on app/views/articles

I thought it might be helpful to add a checklist:

  • [x] additional_content_boxes (merged #1843)
  • [x] admin (merged #1871)
  • [x] api (No *.html.erb files)
  • [x] articles (merged #1848)
  • [x] badges (merged #1850)
  • [x] blocks (merged #1851)
  • [x] chat_channels (merged #1852)
  • [x] comments (merged #1853)
  • [x] dashboards (merged #1854)
  • [x] devise (merged #1858)
  • [x] email_subscriptions (merged #1859)
  • [x] events (merged #1860)
  • [x] feedback_messages (merged #1861)
  • [x] fields (merged #1862)
  • [x] giveaways (merged #1863)
  • [x] homepage (Only contains an empty file)
  • [x] html_variants (merged #1872)
  • [x] internal (merged #1873 & #1882)
  • [x] layouts (merged #1884)
  • [x] mailers (merged #1889)
  • [x] moderations (merged #1900)
  • [x] notifications (merged #1894)
  • [x] organizations (merged #1895)
  • [x] pages (merged #1897)
  • [x] podcast_episodes (merged #1898)
  • [x] reading_list_items (merged #1902)
  • [x] social_previews (merged #1903)
  • [x] stories (merged #1904)
  • [x] stripe_subscriptions (merged #1905)
  • [x] tags (merged #1906)
  • [x] users (merged #1908)
  • [x] videos (merged #1907)

Not sure if this is correct but it is kinda strange that app/views/homepage/ only contains an empty file.

https://github.com/thepracticaldev/dev.to/blob/e45c61a3084f4b70907476de307b3b1e9cbd77b3/app/views/homepage/index.html.erb

Currently fixing linting issues for app/views/html_variants files.

Update: Done in #1872

Currently fixing linting issues for app/views/internal files.

Update: Done in #1873 and #1882

Currently fixing linting issues for app/views/layouts files.

Update: Done in #1884

@arnellebalane If the PR still has open errors submit it as a Draft PR or add [WIP] in the PR title.
Unless project maintainers say it is fine to merge PR's with open linting errors.

@Glennmen Thanks, I've updated my existing PRs with errors to start with [WIP] in their titles 馃憤

Currently fixing linting issues for app/views/mailers files.

Update: Done in #1889

Currently fixing linting issues for app/views/moderations files.

Update: Done in #1900

@maestromac you are a fast reviewer 馃槀
I hope I didn't miss anything, once we do a general sweep through all folders I will go through each one again to double check for HTML errors.

It feels great reviewing/merging lint fixes 馃槃

These PRs doesn't have to fix _everything_. And yeah, can always run the linter again on the whole views folder to see what's left.

@maestromac Problem is that the linter doesn't catch HTML errors, I am trusting Jetbrains to help me find HTML errors.

Just need to jump in a say that this is amazing. Thanks everyone 馃檶

Currently fixing linting issues for app/views/reading_list_items.

Update: Done in #1902

Currently fixing linting issues for app/views/social_previews.

Update: Done in #1903

Currently fixing linting issues for app/views/stories.

Update: Done in #1904

Currently fixing linting issues for app/views/stripe_subscriptions.

Update: Done in #1905

Currently fixing linting issues for app/views/tags.

Update: Done in #1906

Currently fixing linting issues for app/views/users.

Update: Done in #1908

app/views/videos is for me 馃槀

At this rate in a couple of days you all will be done! Amazing!

@rhymes All PR's have been made 馃ぃ all in review now and ready for merge.

As this issue is reaching it's final stages I would like to say thank you to @arnellebalane for helping me out in going through all the views and fixing all errors.

Also thank you to @lightalloy, @maestromac and @Zhao-Andy for reviewing the PR's and getting them merged this fast.

An extra thank you to @lightalloy for providing extra assistance for any linting error that we couldn't solve.


Also I would like to ask how can this be avoided in the future? How can we know for sure that the PR has ran through the pre-commit check without skipping it.
Maybe this is a discussion for #1828

@Glennmen I think that if the bulk of changes have been dealt with, now the percentage of "unrelated style corrections" shall greatly diminish, lowering in return the times people will skip the pre-commit check. At least in theory

Great work by the way!

I believe everything is merged. Anything else missing?

@maestromac I would like to do a final sweep through all views files before closing this.

Everything is merged yay! 馃挴

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Turnerj picture Turnerj  路  3Comments

nickytonline picture nickytonline  路  3Comments

bencodezen picture bencodezen  路  3Comments

vepo picture vepo  路  3Comments

rhymes picture rhymes  路  3Comments