ESLint & BBEdit

In a previous post I showed how to run BBEdit’s active document through jshint. Since then I’ve switched to the newer & shinier eslint, and so comes a new AppleScript to lint your JavaScript:

(* Pipe eslint output into a BBEdit results window  *)
    tell application "BBEdit"
        set mydoc to file of (document 1 of window 1)
    end tell
    set posixPath to POSIX path of mydoc
    set cmd to "/usr/local/bin/node /usr/local/bin/eslint -c ~/.eslintrc.js -f unix " & (quoted form of POSIX path of mydoc) & " | /usr/local/bin/bbresults"
    do shell script cmd
on error
end try

Save the AppleScript under ~/Library/Application Support/BBEdit/Scripts (create the folder if it doesn’t exist), after which you can invoke the script via BBEdit’s Scripts menu and/or palette (Window → Palettes → Scripts).

Install ESLint via…

⚡ npm i eslint -g

… grab an ESLint configuration file via…

⚡ curl "" > ~/.eslintrc.js

… and customize it to suit your preferences.