With the imminent release of Brackets 1.3 we now have the much-needed ability to easily start the editor from the terminal.
Setup of the command line shortcut takes just a couple of minutes:
1. Install Brackets 1.3
The latest version should be released for automatic update in a few days but if you can’t wait you can download the pre-release version right now from the Brackets GitHub repository.
2. Install the Command Line Shortcut
Start up Brackets then select the File… Install Command Line Shortcut menu item which now appears at the very bottom of the File menu.
You’ll be asked to confirm your password, then the shortcut will be installed.
If everything went smoothly you’ll see a confirmation message and Brackets will be ready to use from within terminal:
Notice that you can open a single file or switch projects.
3. Start Brackets from within terminal
As is common with other GUI apps started from the terminal there is one peculiarity:
- If Brackets is closed, it will be started, the file (or project) to be edited will be loaded and the app brought to the front
- If Brackets is open but not on top (or in another space), the file (or project) to be edited will be loaded and the app brought to the front
- If Brackets is minimised, the file (or project) to be edited will be loaded but the app will not be brought to the front. This can be confusing if you haven’t seen this behaviour before because it appears that nothing at all has happened.
More info about Brackets 1.3 can be found in the release notes on GitHub.
Command line startup can also be set up on Windows; brief details are in the release notes.
‘onelineperfile’ is a new custom formatter for ESLint that, unsurprisingly, displays one line per file. Linting details are displayed whether the file passed linting or not.
If you use ESLint you probably already know that it comes with six formatters (a.k.a. reporters) that allow you to change the way that messages output by ESLint are reported.
Briefly, the six styles are:
Stylish (the default formatter)
Each of these are good for what they do but none of them are exactly what I need, which is output with:
- One line for each file processed
- Each line to indicate the status of the linting; success, error or warning
- Each line to indicate the number of errors / warnings, if any
- No error details to be displayed, I can check and fix that in the editor if needed
- A summary line showing the total number of files processed, the number which passed linting and the number with warnings or errors
The reason for these requirements is to allow the output to be used in an audit trail, for example as the result of running a Git pre-receive hook; I should easily be able to check that a particular file was linted and it’s status.
Luckily, ESLint is very extensible so I created a new formatter — onelineperfile — which meets all of my criteria.
Here’s sample output:
The easiest way to add it to your project is using NPM:
npm install --save-dev eslint-onelineperfile
You can then run it directly from the command line:
eslint --format node_modules/eslint-onelineperfile/onelineperfile.js <span class="keyword operator shell">*</span>.js
If you prefer to automate ESLint you can do so using Grunt ESLint: