JavaScript Standard Style
standardjs is a style guide, code linter and beautifier in one. standard is a command line tool for the JavaScript Standard Style that automatically formats JavaScript code in a consistent manner and points out common style and programmer errors.
There are a number of JavaScript tools for this task — and standard is built on ESLint and Prettier — but standard is easier to install and configure and uses a code style that will be familiar to R developers.
💻 Once you've installed node and npm, you can install standard by running
npm install standard --global
Once installed, you can use the Lint File or Selection RStudio addin provided by the js4shiny package to automatically format your JavaScript.
Visual Studio Code
💻 We will use RStudio throughout the workshop, but if you plan to spend more time coding JavaScript, HTML, or CSS than R, then you may want to use Visual Studio Code.
The primary benefit of using VSCode is that web development languages are first-class citizens, which means that the editor's interface provides helpful autocompletion and links to help documentation. Furthermore, there is a wide variety of community-contributed extensions that augment VSCode's capabilities.
A few extensions that I've found personally helpful include
- Visual Studio IntelliCode
- Live Server
- Debugger for Firefox
- VSCode Icons
- Bracket Pair Colorizer
- ESLint
- CSS Extensions
- HTML Extensions
VSCode and RStudio are somewhat at opposite sides of the spectrum: RStudio excels at supporting R developers while providing a reasonable editing experience for web developers; while on the other hand VSCode is excellent for the latter but less supportive of R developers.
There are a pair of extensions for R language support that are very helpful:
- R support for Visual Studio Code
- R Language Server Protocol
- Requires that you install the R package
languageserver
- Requires that you install the R package