Appsilon / rhino

Build high quality, enterprise-grade Shiny apps at speed
https://appsilon.github.io/rhino
287 stars 24 forks source link

Introduce prettier to format JavaScript (.js) and Sass (.scss) files #594

Closed TymekDev closed 3 months ago

TymekDev commented 3 months ago

Description

With this PR I introduce two new functions: format_js() and format_sass(). Both of these take a fix argument that defaults to TRUE to allow just checking the style.

[!IMPORTANT] There might be places where prettier's formatting might be incompatible with AirBnB and/or stylelint linters, but I am not aware of these.

How to Test

A New App

  1. Install Rhino from the branch
  2. Create a new app with rhino::init()
  3. Add some unformatted code in app/js/ and app/styles/ directories
  4. Run format_js() and format_sass() to see if they work

An Existing App

  1. Run renv::install("TymekDev/rhino@formatters")
  2. Remove .rhino/ directory
  3. Make sure there is unformatted code in app/js/ and app/styles/ directories
  4. Run format_js() and format_sass() to see if they work

Definition of Done

kamilzyla commented 3 months ago

Merged as #597.