Skip to contents

This addin lints and fixes selected JavaScript code or the currently open file in RStudio. The addin can be helpful for linting JavaScript code embedded in R Markdown or Shiny apps, in addition to linting whole JavaScript files. The underlying functions are not exported from js4shiny. If you want to programmatically lint multiple files, it would be better to use npm scripts or another JavaScript task running system to lint your files.

Installing StandardJS

standardjs is a style guide, code linter, and beautifier in one. It is also a command line tool (standard) for automatically formatting JavaScript code in the JavaScript Standard Style. The command line tool will also alert users to common style and programmer errors.

Using standard and this addin requires that node, npm, and standard be installed on your system. To install node and npm, you need to install Node.js (they come together). Follow the instructions from Node.js to install these tools. Confirm that your installation was successful by running npm -v in a new terminal session. Once npm is available, install standard globally by running this command in the terminal.

npm install standard --global

References

https://standardjs.com/