bloom-works / guides-template

Placeholder repo for work on Bloom Guides
https://bloom-guides-template.netlify.app/
MIT License
2 stars 0 forks source link

Add ESLinter for JS Linting #45

Closed LynnHerrick9 closed 1 year ago

LynnHerrick9 commented 1 year ago

This changes is related to the Setup Guides task. It adds linting functionality for JavaScript files. The linter can be run at any point during development. It is also added to the workflow process (from PR click checks tab in top-middle of screen, click Pull Request on left side of screen, click pr_checks on left-side or middle of screen, click Run Linter in middle of screen). Prior to this change the run linter option in PR Check was a print statement as a placeholder. The image below shows a screenshot of the workflow with ESLint running and passing during the PR check of this current PR.

Screenshot 2023-07-04 at 8 53 06 AM

To make it more consumable for review, I will split up all the linter work into PRs associated to each linter and language. This review will include all changes for ESLint and JavaScript code.

What was changed

How to check change

  1. Checkout branch and build project

  2. Verify all changes reported by linter did not disrupt the project by running npm run serve

  3. Verify there are no existing linter errors by using the path on PR above to see if pr checks passed for linter

  4. Verify there are no existing linter errors by manually running the linter in the code. Navigate to the base of the repo and run sh ./ci/linter.sh. Below image shows an example of what the command line will look like when there are no errors.

    Screenshot 2023-07-04 at 8 27 28 AM
  5. Verify linter is working and/or check any style fixes I made in other files. For this you will use the same command as above and choose any of the files that have changed and reverse any changes made. I have give two examples below, but feel free to check any of the changes using the same process.

Example 1: Here I have changed the single quotes back to double quotes on line 2 of the markdown.js file and then run the linter. Note the linter now reports an error for quotes with the message that Strings must use singlequote.

Screenshot 2023-07-04 at 8 28 41 AM

Example2: Here I have navigated to a different directory from the first example (_includes/components/) and removed the added space on line 4 of the PageHeader.js file. Note the linter now reports and error for space-before-function-paren with the message Missing space before function parentheses.

Screenshot 2023-07-04 at 8 29 48 AM

Notes

I have turned two rules off within the .eslintrc.js file.

netlify[bot] commented 1 year ago

Deploy Preview for bloom-guides-template ready!

Name Link
Latest commit e60f1bdf8ef1d28266263de2c0b83fd76da71f70
Latest deploy log https://app.netlify.com/sites/bloom-guides-template/deploys/64a6ffc129a19d00086a7f8f
Deploy Preview https://deploy-preview-45--bloom-guides-template.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

SMakaiTakori commented 1 year ago

@jeffmaher I went ahead and merged my branch with this one so now the linter is linting our hidden .eleventy.js file. I fixed the merge conflicts as well and all tests are passing, so we should be set on this one. I will wait for you to give your official approval before merging this into the main branch. Thanks!