R/addin.R

Defines functions jshintAddin

#' @importFrom rstudioapi hasFun documentPath
#' @importFrom tools file_ext
#' @keywords internal
jshintAddin <- function(){
  if(!hasFun("documentPath")){
    message("This version of RStudio is too old!")
    return(invisible(NULL))
  }
  fp <- documentPath()
  ext <- tolower(file_ext(fp))
  if(ext != "js"){
    message("This is not a JavaScript file!")
    return(invisible(NULL))
  }
  jshintr(fp)
}

Try the jshintr package in your browser

Any scripts or data that you put into this service are public.

jshintr documentation built on June 10, 2022, 5:11 p.m.