Permalink
Browse files

* nodelint > node-lint

* doc updated
* use only "formatter" or "format" words
  • Loading branch information...
1 parent d596eae commit 35c99c4576131d3078b0a7dc5567d386c23badac jpolo committed Nov 20, 2010
View
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2010 Julien Polo (author), Alternative Shift© (http://www.alternativeshift.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -1,14 +1,14 @@
-nodelint
+node-lint
--------
- [Node] is a [V8] based framework for writing Javascript applications outside
the browser.
- [JSLint] is a code quality tool that checks for problems in Javascript programs.
-- **nodelint** lets you run JSLint from the command line.
+- **node-lint** lets you run JSLint from the command line.
-- nodelint currently supports node version 0.2.1
+- node-lint currently supports node version 0.2.1
[Node]: http://nodejs.org/
[V8]: http://code.google.com/p/v8/
@@ -20,27 +20,27 @@ installation
npm:
- $ npm install nodelint
+ $ npm install lint
usage
-----
-You can use `nodelint` directly if you have `node` in your $PATH:
+You can use `node-lint` directly if you have `node` in your $PATH:
- $ ./nodelint path/to/your/file.js
+ $ ./node-lint path/to/your/file.js
Or if you installed it using npm:
- $ nodelint path/to/your/file.js
+ $ node-lint path/to/your/file.js
Otherwise, you need to run it with node:
- $ node nodelint path/to/your/file.js
+ $ node node-lint path/to/your/file.js
-You can also specify a directory param and nodelint will find all .js files under that directory and its subdirectories:
+You can also specify a directory param and node-lint will find all .js files under that directory and its subdirectories:
- $ node nodelint dir1/ dir2/
+ $ node node-lint dir1/ dir2/
Enjoy!
@@ -52,32 +52,32 @@ You can set JSLint options by modifying the default `config.js` file or even
override the default config by passing another config file with the optional
`--config` parameter, e.g.
- $ nodelint file1 file2 dir1 dir2 --config path/to/your/config/file.js
+ $ node-lint file1 file2 dir1 dir2 --config path/to/your/config/file.json
-For example, if the default config.js has:
+For example, if the default config.json has:
- var options = {
- adsafe : false,
- bitwise : true,
- error_prefix : "\u001b[1m",
- error_suffix : ":\u001b[0m "
- };
+ {
+ "adsafe" : false,
+ "bitwise" : true,
+ "error_prefix" : "\u001b[1m",
+ "error_suffix" : ":\u001b[0m "
+ }
-And your own path/to/your/config/file.js looks like:
+And your own path/to/your/config/file.json looks like:
- var options = {
- bitwise : false,
- browser : false
+ {
+ "bitwise" : false,
+ "browser" : false
};
Then the final options used will be:
- var options = {
- adsafe : false,
- bitwise : false,
- browser : false,
- error_prefix : "\u001b[1m",
- error_suffix : ":\u001b[0m "
+ {
+ "adsafe" : false,
+ "bitwise" : false,
+ "browser" : false,
+ "error_prefix" : "\u001b[1m",
+ "error_suffix" : ":\u001b[0m "
};
Take a look at [JSLint's Options] to see what to put in the `options` variable.
@@ -86,16 +86,16 @@ Take a look at [JSLint's Options] to see what to put in the `options` variable.
reporters
---------
-By default nodelint uses an internal `reporter` function to output it's results
+By default node-lint uses an internal `reporter` function to output it's results
to the console. For basic use it's possible to alter the `error_prefix` and
`error_suffix` colors within your `config.js` file. This will prepend or append
coloring information to the results when JSLint complains about your code. There
may be times when a more customizable reporting system might be needed (*i.e.
IDE/Text Editor integrations or customized console outputs*).
-nodelint allows you to designate a custom reporter for outputting the results
+node-lint allows you to designate a custom reporter for outputting the results
from JSLint's run. This `reporter` function will override the default function
-built into nodelint. To utilize a custom reporter first create a js file that
+built into node-lint. To utilize a custom reporter first create a js file that
has a function in it named `reporter`:
`example-reporter.js`:
@@ -107,10 +107,10 @@ has a function in it named `reporter`:
sys.puts(len + ' error' + ((len === 1) ? '' : 's'));
}
-Then when you run nodelint from the command line, pass in the customized
+Then when you run node-lint from the command line, pass in the customized
reporter:
-`$ ./nodelint path/to/file.js --reporter path/to/file/example-reporter.js`
+`$ ./node-lint path/to/file.js --reporter path/to/file/example-reporter.js`
For brevity sake, this is a fairly simple reporter. For more elaborate examples
see the `examples/reporters/` directory or `examples/textmate/`.
@@ -134,25 +134,25 @@ pull request to me <<http://github.com/tav>>. Thanks!
credits
-------
-- [tav], wrote nodelint
+- [tav], wrote node-lint
- [Felix Geisendörfer][felixge], clarified Node.js specific details
- [Douglas Crockford], wrote the original JSLint and rhino.js runner
-- [Nathan Landis][my8bird], updated nodelint to Node's new API.
+- [Nathan Landis][my8bird], updated node-lint to Node's new API.
- [Oleg Efimov][Sannis], added support for overridable configurations, running
- nodelint from a symlink and updates to reflect Node.js API changes.
+ node-lint from a symlink and updates to reflect Node.js API changes.
- [Matthew Kitt][mkitt], added support for configurable reporters, various code
cleanups and improvements including updates to reflect Node.js API changes.
-- [Corey Hart], updated nodelint with multiple files and config support.
+- [Corey Hart], updated node-lint with multiple files and config support.
-- [Mamading Ceesay][evangineer], added support for using nodelint within Emacs.
+- [Mamading Ceesay][evangineer], added support for using node-lint within Emacs.
-- [Matt Ranney][mranney], updated nodelint to use sys.error.
+- [Matt Ranney][mranney], updated node-lint to use sys.error.
- [Cliffano Subagio], added npm installation support, XML reporter, and directory param support.
@@ -168,4 +168,4 @@ credits
[Cliffano Subagio]: http://blog.cliffano.com
[JSLINT's Options]: http://www.jslint.com/lint.html#options
-[wiki]: http://github.com/tav/nodelint/wiki
+[wiki]: http://github.com/tav/node-lint/wiki
@@ -1,25 +1,25 @@
-nodelint(1) -- Run JSLint from the command-line under node.js
+node-lint(1) -- Run JSLint from the command-line under node.js
=============================================================
## SYNOPSIS
- nodelint [options] <file-or-directory> [<file-or-directory> ...]
+ node-lint [options] <file-or-directory> [<file-or-directory> ...]
## DESCRIPTION
-The nodelint command-line tool allows you to check for problems and ensure
+The node-lint command-line tool allows you to check for problems and ensure
the code quality of your JavaScript files using JSLint.
It is completely extensible so you can use your own custom JSLint config or
-even use custom reporters that better integrate with your quality assurance
+even use custom formatters that better integrate with your quality assurance
framework.
## OPTIONS
- __--reporter FILE__:
- Override the default reporter with your own custom module. See
- the *examples/reporters* directory for custom reporters that come
- bundled with nodelint.
+ __--formatter FILE__:
+ Override the default formatter with your own custom module. See
+ the *examples/* directory for custom formatters that come
+ bundled with node-lint.
__--config FILE__:
Override the default *config.js* with your own config file.
@@ -31,40 +31,40 @@ framework.
Output version information and exit.
__<file-or-directory>__:
- You can run nodelint on specific files or on all *\*.js* files inside
+ You can run node-lint on specific files or on all *\*.js* files inside
a directory.
## CONFIG
-You can customise the JSLint options by modifying the default config.js
+You can customize the JSLint options by modifying the default config.js
file or by providing your own config file with the *--config* parameter:
- nodelint --config path/to/custom.js file1.js file2.js ...
+ node-lint --config path/to/custom.json file1.js file2.js ...
-For example, if the default config.js looks like:
+For example, if the default config.json looks like:
- var options = {
- adsafe : false,
- bitwise : true,
- error_prefix : "\u001b[1m",
- error_suffix : ":\u001b[0m "
+ {
+ "adsafe" : false,
+ "bitwise" : true,
+ "error_prefix" : "\u001b[1m",
+ "error_suffix" : ":\u001b[0m "
};
-And your custom.js looks like:
+And your custom.json looks like:
- var options = {
- bitwise : false,
- browser : false
+ {
+ "bitwise" : false,
+ "browser" : false
};
Then the final options will be:
- var options = {
- adsafe : false,
- bitwise : false,
- browser : false,
- error_prefix : "\u001b[1m",
- error_suffix : ":\u001b[0m "
+ {
+ "adsafe" : false,
+ "bitwise" : false,
+ "browser" : false,
+ "error_prefix" : "\u001b[1m",
+ "error_suffix" : ":\u001b[0m "
};
## JSLINT OPTIONS
@@ -145,16 +145,17 @@ Then the final options will be:
## AUTHORS
-Written by Tav and other nodelint contributors.
+Originally written by Tav and other node-lint contributors.
+Forked by as-jpolo.
Contributors list: <http://github.com/tav/nodelint/contributors>.
## REPORTING BUGS
-Report nodelint bugs to <http://github.com/tav/nodelint/issues>.
+Report node-lint bugs to <http://github.com/as-jpolo/node-lint/issues>.
## COPYRIGHT
-Nodelint has been released into the Public Domain by its Authors.
+node-lint is under MIT License.
## SEE ALSO
View
@@ -90,7 +90,7 @@ Formatter.prototype.format = function (report) {
*
* Usage:
*
- * > inherits from this class to create a new reporter
+ * > inherits from this class to create a new formatter
******************************************************************************/
/**
* Base constructor
@@ -14,12 +14,11 @@ var formatter = require('../formatter');
* @param {Object} options
*/
function Formatter(options) {
- formatter.Base.call(this, options);
-
- //Default identity function
- this.callback = null;
+ options = options || {};
+ this._callback = null;
+ this._callbackName = 'format';
- this.configure(options);
+ formatter.Base.call(this, options);
}
util.inherits(Formatter, formatter.Base);
@@ -39,15 +38,14 @@ Formatter.prototype.configure = function (options) {
var scriptObj, env;
env = {};
-
scriptObj = new Script(options.callback, __filename);
scriptObj.runInNewContext(env);
- options.callback = env.reporter;
+ options.callback = env[this._callbackName];
}
if (typeof(options.callback) === 'function') {
- this.callback = options.callback;
+ this._callback = options.callback;
} else {
throw new Error('options.callback must be a Function');
}
@@ -61,7 +59,7 @@ Formatter.prototype.configure = function (options) {
* @return {string}
*/
Formatter.prototype._formatNormal = function (report) {
- return this.callback(report);
+ return this._callback(report);
};
/**
Oops, something went wrong.

0 comments on commit 35c99c4

Please sign in to comment.