Skip to content

Latest commit

 

History

History
47 lines (25 loc) · 4.47 KB

File metadata and controls

47 lines (25 loc) · 4.47 KB

µESLint – ESLint for Nova, the micro edition

Use ESLint’s awesome linting powers when working in Nova.

Why use this, and why “micro edition”

There is an excellent, full featured ESLint extension by Cameron Little in the extension library; it has suggested fixes, a “fix on save” option and brings its own copy of ESLint. You may want to check Cameron’s extension out first if you have not installed any ESLint based linting extension for Nova yet. Really, it’s good.

However, if you find out it does not always work as reliably as it could for you, for instance because you work with JavaScript file types it does not know about (like JavaScript for Automation files that use the .jxa extension), or if you have got ESLint configured to lint crazy things like Markdown files (yes, that is possible), which it will ignore, or because Cameron’s extension is sometimes hit and miss when you switch workspaces and files a lot, or because you don’t keep your .eslintrc file in your workspace, or because you realise that “fix on save” only sounds nice until you lose your cursors and selections when it happens, or … well, anything else that makes you wish for ESLint linting in Nova to work exactly as it does with the CLI, µESLint may be for you.

Hence “µESLint” and “micro edition” – this extension does the absolute minimum it needs to be useful. No frills, no hassle.

Features

µESLint has exactly one feature: if the ESLint CLI would lint a file you have open in Nova, µESLint will do that too, in the exact same way, with the same results – but on every change and using Nova’s Issues pane.

_µESLint.nova linting feature

Uh, well, actually there is a sort of a second feature: it has commands to open the ESLint configuration and ignore files that are pertinent to a source file in the Editor menu.

So: one and a half features. And all of it should work reliably, everywhere, with no config outside the one you have to set up for ESLint itself. Should you find it does not, please refer to the “Known issues“ section below.

Requirements

µESLint requires you to have ESLint, version 4 or better, installed either globally or as a project dependency. You can install ESLint globally using Homebrew:

brew install eslint

or install it, either globally or locally, using a JavaScript package manager. The ESLint “Getting Started“ chapter of the User Guide explains all you need to know about this.

Once this is done, you need to configure ESLint. Please refer to the ESLint User Guide for a quick overview and an in-depth explanation.

(Technically, this extension also requires Node to be installed on your system. As there is no way I am aware of to install, never mind run, ESLint without Node, you need not worry about that.)

Configuration

You can disable µESLint on a per-project basis in project settings, and there is a shortcut to get there in the Extensions menu. That’s it. Configure ESLint, not the extension.

Known issues

… as in issues of this extension (this is, ahem, the issue with a linting extension: the terminology can get a wee bit confusing):

  1. Currently, Nova’s Issues pane will not display an entry for documents whose path or name has changed outside a “Save as…” operation (be it through renaming in the Nova sidebar, or through the Finder or a CLI). The document gets linted – you will find issue entries in its margin –, but the Issues pane never tells you about it. This is a Nova bug (Nova’s internal IssueCollection managed by the AssistantRegistry is affected the same way) I have found no workaround for.

Should you encounter other problems, kindly describe them in a Github issue.