Sublime Text 2 and OpenLayers 3

javascript |

In case others are interested, here’s a nice setup for OpenLayers 3 development on OS X:

Install the Closure Linter.

sudo easy_install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz

Install Sublime Text 2 (register as well, its worth it). Add the Sublime Linter package (use Sublime Package Control).

Edit your user SublimeLinter.sublime-settings file (Preferences > Package Settings > SublimeLinter > Settings - User) so it looks something like the following:

/** SublimeLinter user settings */
{
  "sublimelinter": true,
  "sublimelinter_popup_errors_on_save": true,
  "javascript_linter": "gjslint",
  "gjslint_options": ["--strict", "--custom_jsdoc_tags=todo"],
  "gjslint_ignore": [],
  "sublimelinter_disable": ["css"]
}

As described in the readme, if gjslint is not on your path, you’ll need to provide the path with something like this in your user SublimeLinter.sublime-settings file:

  "sublimelinter_executable_map": {
    // your path may vary
    "javascript": "/Library/Frameworks/Python.framework/Versions/2.6/bin/gjslint"
  },

Edit your user Preferences.sublime-settings so it includes at least the following:

{
  "rulers": [80],
  "tab_size": 2,
  "translate_tabs_to_spaces": true
}

That’s it. The biggest pain here is that you can’t have per-project package settings. So if you don’t abide by the Closure Linter in all your projects, you have to modify your user SublimeLinter.sublime-settings when changing projects (i.e. setting "sublimelinter": false).

Related Posts (see all)

Topology Preserving Simplification Comments
Mocking the file system Comments
AngularJS Whitespace Guide Comments