JSLint in action

JSLint in action.


JSLint is a JavaScript code quality tool. It helps to keep the JavaScript code clean and maintainable. The compile step in WebODF checks the JavaScript with JSLint. There are JSLint plugins for code editors. A plugin for VIM marks each line with an error red so that problems are spotted quickly while editing.



WebODF has several build targets: compiled JavaScript (webodf.js), unit tests, and desktop programs. For building all this, CMake is used. CMake is a cross-platform build tool. It also takes care of downloading and verifying useful tools such as Closure Compiler, Rhino, JSDoc, Node.JS and JSCoverage.

Closure Compiler

JavaScript code is interpreted: usually there is not compile step needed. Nevertheless, WebODF uses a compiler. The compiler checks the syntax and creates a single optimized JavaScript file out of a collection of JavaScript files. This makes WebODF download and run faster. The Closure Compiler is invoked by calling 'make webodf.js' after creating the build files with CMake.

The WebODF code is annotated with types for the benefit of the compiler and documentation generator.



Node.JS is a command-line JavaScript runtime that does fast IO via callbacks. WebODF uses Node.JS for running unit tests and for running a light-weight test server. WebODF includes a script, httpserver.js, for quickly starting a webserver that servers the files in directory.


Rhino is JavaScript interpreter implemented in Java. WebODF uses it, next to Node.JS for running unit tests. Rhino has a synchronous IO and Node.JS has asynchronous IO. This means that callback functions are called at different times. In Rhino, the callback is called before the calling function returns. In Node.JS, the callback is called after the function returns. We use both runtimes to throughly test all IO callback calls.


API documentation is generated with JSDoc.


WebODF has a collection of unit tests that help in maintaining high quality code. The unit tests can be run in the browser and on the command-line. JSCoverage is a tool that keeps track of how often each line of code is run when running the unit tests. With it, we can make sure that all parts of WebODF are tested by unit tests. Anyone can run the tests in their browser. Click on the tab 'Summary' to see how well the code is covered with tests.


The Qt toolkit is a cross-platform C++ toolkit that includes a WebKit based browser. WebODF uses Qt for running unit tests and also contains a simple desktop application that uses WebODF to display ODF files.