General developer forum

 
 
Picture of Colin Chambers
Re: YUI + shifter
Group Developers

Hi Guys, a +1 from me for better tools for JS development. It's a big challenge for us at the OU and it's set to grow. Either that or we're unable to implement major improvements that the rest of the web are implementing. 

Just installed and used jshint for MDL-32750 on andrews suggestion. Was really simple to install and use. Thought I'd record the steps. Tim suggested here. 

These instructions are for Windows 7 64 bit.

install node js  

go to nodejs.org click install. When installed windows -> start -> programs -> node.js to start command line

install jshint
with an open node.js command line from above type npm install jshint -g

Check code
navigate in command line to the root directory of your moodle install.

Call jshint with the config options and path to the file to check.

Andrew has a jshint config file that sets the desired moodle code standards for jshint to use

I first used the line below and got the error "unexpected token". 
Wrapped configs in double quotes to fix it e.g. "evil":false (Yep, jshint can be configured to be evil
Now you're ready. Check your code by typing...
jshint --config pathtoandrewsconfigfile pathtofiletocheck e.g.git\lib\editor\tinymce\yui\collapse\collapse.js

hth

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: YUI + shifter
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

I just did this (thanks Colin for sharing) and it just worked! Really quick and easy. You can get the configuration file from https://tracker.moodle.org/browse/MDL-37626, or more specifically https://raw.github.com/andrewnicols/moodle/12dec2cf3db8179f9af42079cb759a40424aa4b4/.jshintrc.

 
Average of ratings: -