DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

JavaScript Development Environment Setup


vim

Update at 2015-9-12:

(Optional) Install node.js and jshint (with npm install -g jshint). Now you can check syntax with jshint myfile.js.

Then install lint plugin scrooloose/syntastic for vim:

  1. add Plugin 'scrooloose/syntastic' into ~/.vimrc;

  2. Run vim +PluginInstall, there are totally 6.0MB for its repo, so you have to wait quite a while;

Now open a js file, and do some editing. When file saved, syntastic will mark the lines with errors.

To verify which checker is enabled when editing, run :SyntasticInfoin vim.

Check "2.1. Requirements" in syntastic page above for details.

google/closure-linter

To install google/closure-linter as the checker:

git clone https://github.com/google/closure-linter.git
cd closure-linter
sudo python ./setup.py install
cd ..
sudo rm -rf closure-linter

Now you can use gjslint myfile.js as the checker in terminal. To make syntastic use gjslint, add let g:syntastic_javascript_checkers = ['gjslint'] into ~/.vimrc.

jshint

Ref:

jshint docs


Update at 2015-5-11:

See Equipping Vim for JavaScript.

The plugin YouCompleteMe is very big (about 200MB for now). You have to wait quite a while when install this plugin using Vundle.

When install plugin with Vundle, you have to save .vimrc and quit, then run PluginInstall or PluginClean in a new vim window.

Note: To remove a plugin managed by Vundle in vim, remove declaration in .vimrc, then run PluginClean in vim.

--- Old Post ---

  1. Install nvm;

  2. Install node with nvm;

  3. Install jshint with npm, which is a tool in node: npm install -g jshint;

  4. Check syntax with jshint myfile.js;

  5. Check html syntax with Tidy, which is installed on Ubuntu with apt-get install tidy;

Ref: VIM + JSLint?

Eclipse

Eclipse's javascript development tools JSDT is part of WTP (web tools platform), which is a built-in plugin of "Eclipse JEE" (Eclipse for Java EE Developers).

Its editor has auto syntax checker. Config it in [Window -> Preferences -> JavaScript -> Editor]. Config its code style (tab size, for example) at [Window -> Preferences -> JavaScript -> Code Style -> Formatter].



Published

Nov 4, 2014

Last Updated

Nov 4, 2014

Category

Tech

Tags

  • ide 26
  • javascript 11
  • vim 92

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor