TheLastScrub / delta-green-foundry-vtt-system-unofficial

A Foundry VTT game system for Delta Green: The RPG! This is a fan made work that is unaffiliated with Shane Ivey or Arc Dream Publishing, published under the Delta Green Community license. http://www.delta-green.com https://foundryvtt.com/
MIT License
25 stars 23 forks source link

Linting and Formatting #88

Closed jalensailin closed 9 months ago

jalensailin commented 9 months ago

This PR introduces ESLint and Prettier to help keep the code consistent between contributors, and to reduce syntax errors potentially leading to bugs.

NOTE: This PR does two other things which helped fix some linting errors:

  1. Moves the Handlebars.registerHelper(...) calls to their own file (module/other/register-helpers.js).
  2. Moves the Macro functions to their own files (module/other/macro-functions.js)

Steps to test:

NOTE: If you wish to review the code changes in this, I would look at the diffs for each commit, rather than all at once

  1. Open VS Code
  2. Check out this branch
  3. Download the ESLint extensions and Prettier extensions
  4. Open a terminal and run npm i
  5. You should see a new /node_modules folder that is ignored by git.
  6. Open a javascript like actor-sheet.js and notice that ESLint is highlighting warnings in yellow.
  7. Try changing some of the syntax (removing semi-colons, adding multiple blank lines between functions, removing spaces between function names and the opening brackets, etc.)
  8. Notice that ESLint gives red errors and that saving auto-fixes these errors
  9. IMPORTANT LAST STEP: Test as much as you can in the system to make sure that reformatting didn't break anything. Check that sheets look right, buttons behave correctly, etc. Formatting shouldn't break anything, but fixing some of the linting errors has the potential to.