coffeelint-stylish
Advanced tools
Comparing version 0.0.1 to 0.1.0
42
index.js
@@ -1,2 +0,2 @@ | ||
var chalk, errSign, happySign, isWin, table, warnSign; | ||
var StylishReporter, chalk, err_sign, happy_sign, is_win, reporter, table, warn_sign; | ||
@@ -7,11 +7,11 @@ chalk = require('chalk'); | ||
isWin = process.platform === 'win32'; | ||
is_win = process.platform === 'win32'; | ||
warnSign = "" + (isWin ? '' : '⚠'); | ||
warn_sign = "" + (is_win ? '' : '⚠'); | ||
errSign = "" + (isWin ? '' : '✖'); | ||
err_sign = "" + (is_win ? '' : '✖'); | ||
happySign = "" + (isWin ? '' : '✔'); | ||
happy_sign = "" + (is_win ? '' : '✔'); | ||
exports.reporter = function(filename, results) { | ||
reporter = function(filename, results) { | ||
var errs, ret, warns; | ||
@@ -39,7 +39,7 @@ if (filename == null) { | ||
} | ||
return ['', chalk.gray(level === 'error' ? errSign : warnSign), chalk.gray('line ' + lineNumber), chalk.blue(message), chalk.gray(context || '')]; | ||
return ['', chalk.gray(level === 'error' ? err_sign : warn_sign), chalk.gray('line ' + lineNumber), chalk.blue(message), chalk.gray(context || '')]; | ||
})); | ||
ret += '\n\n'; | ||
if (warns > 0) { | ||
ret += chalk.yellow.bold("" + warnSign + " " + warns + " warning" + (warns === 1 ? '' : 's')); | ||
ret += chalk.yellow("" + warn_sign + " " + warns + " warning" + (warns === 1 ? '' : 's')); | ||
if (errs > 0) { | ||
@@ -50,6 +50,6 @@ ret += '\n'; | ||
if (errs > 0) { | ||
ret += chalk.red.bold("" + errSign + " " + errs + " error" + (errs === 1 ? '' : 's')); | ||
ret += chalk.red("" + err_sign + " " + errs + " error" + (errs === 1 ? '' : 's')); | ||
} | ||
if (errs === 0 && warns === 0) { | ||
ret += chalk.green.bold("" + happySign + " No problems"); | ||
ret += chalk.green("" + happy_sign + " No problems"); | ||
ret = '\n' + ret.trim(); | ||
@@ -60,2 +60,22 @@ } | ||
module.exports = exports; | ||
module.exports = StylishReporter = (function() { | ||
StylishReporter.reporter = reporter; | ||
function StylishReporter(error_report) { | ||
this.error_report = error_report; | ||
} | ||
StylishReporter.prototype.publish = function() { | ||
var filename, results, _ref, _results; | ||
_ref = this.error_report.paths; | ||
_results = []; | ||
for (filename in _ref) { | ||
results = _ref[filename]; | ||
_results.push(StylishReporter.reporter(filename, results)); | ||
} | ||
return _results; | ||
}; | ||
return StylishReporter; | ||
})(); |
{ | ||
"name": "coffeelint-stylish", | ||
"version": "0.0.1", | ||
"description": "Stylish reporter for CoffeeLint runtime", | ||
"version": "0.1.0", | ||
"description": "Stylish reporter for CoffeeLint", | ||
"keywords": [ | ||
@@ -28,21 +28,27 @@ "reporter", | ||
"scripts": { | ||
"prepublish": "node ./node_modules/gulp/bin/gulp.js coffee --require coffee-script", | ||
"test": "node ./node_modules/mocha/bin/mocha test.coffee --require coffee-script --reporter nyan && node ./node_modules/coffeelint/bin/coffeelint index.coffee test.coffee gulpfile.coffee -f ./coffeelint.json" | ||
"prepublish": "gulp coffee --require \"coffee-script/register\"", | ||
"test": "coffeelint index.coffee test.coffee gulpfile.coffee && istanbul test _mocha --report lcovonly -- test.coffee --require coffee-script/register --reporter spec", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"lint-with-this": "coffeelint index.coffee test.coffee gulpfile.coffee --reporter ./" | ||
}, | ||
"dependencies": { | ||
"chalk": "~0.4.0", | ||
"text-table": "~0.2.0" | ||
"chalk": "^0.4.0", | ||
"text-table": "^0.2.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.16.1", | ||
"should": "~2.1.0", | ||
"gulp": "~3.2.0", | ||
"gulp-coffee": "~1.2.2", | ||
"coffee-script": "~1.6.3", | ||
"coffeelint": "~1.0.2" | ||
"coffee-script": "^1.7.0", | ||
"mocha": "^1.18.0", | ||
"gulp": "^3.6.0", | ||
"gulp-util": "^2.2.13", | ||
"gulp-coffee": "^1.4.3", | ||
"gulp-clean": "^0.2.2", | ||
"coffeelint": "^1.3.0", | ||
"coveralls": "^2.10.0", | ||
"istanbul": "^0.2.3" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.0" | ||
"node": ">=0.10.0", | ||
"npm": ">=1.3.7" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -1,9 +0,7 @@ | ||
coffeelint-stylish [![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] | ||
coffeelint-stylish [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url] | ||
================== | ||
[![Dependency Status][depstat-image]][depstat-url] [![devDependency Status][devdepstat-image]][devdepstat-url] | ||
[![Screenshot](http://img.shields.io/badge/pretty-stylish-ff69b4.svg)][screenshot-image] [![Dependency Status][depstat-image]][depstat-url] [![devDependency Status][devdepstat-image]][devdepstat-url] | ||
> Stylish reporter for CoffeeLint http://www.coffeelint.org. Heavily inspired by the beautiful [jshint-stylish](https://github.com/sindresorhus/jshint-stylish). | ||
**Note:** This is soley to be used with CoffeeLint's [runtime](http://www.coffeelint.org/#api), i.e. `coffeelint.lint(source, configuration)`, not with the `coffeelint` commandline tool. Currently the commandline tool does not support external reporters. | ||
![screenshot](screenshot.png) | ||
@@ -15,2 +13,8 @@ | ||
## Usage with CoffeeLint cli | ||
```bash | ||
coffeelint index.coffee --reporter coffeelint-stylish | ||
``` | ||
## Usage with CoffeeLint runtime | ||
@@ -28,5 +32,5 @@ | ||
## Options `reporter(filename, results)` | ||
## Runtime API `reporter(filename, results)` | ||
### filename | ||
### filename | ||
Type: `String`, Default: `''` | ||
@@ -36,3 +40,3 @@ | ||
### results | ||
### results | ||
Type: `Array`, Default: `[]` | ||
@@ -46,12 +50,17 @@ | ||
[screenshot-image]: https://github.com/janraasch/coffeelint-stylish/blob/master/screenshot.png | ||
[npm-url]: https://npmjs.org/package/coffeelint-stylish | ||
[npm-image]: https://badge.fury.io/js/coffeelint-stylish.png | ||
[npm-image]: http://img.shields.io/npm/v/coffeelint-stylish.svg | ||
[travis-url]: http://travis-ci.org/janraasch/coffeelint-stylish | ||
[travis-image]: https://secure.travis-ci.org/janraasch/coffeelint-stylish.png?branch=master | ||
[travis-image]: https://travis-ci.org/janraasch/coffeelint-stylish.svg?branch=master | ||
[coveralls-url]: https://coveralls.io/r/janraasch/coffeelint-stylish?branch=master | ||
[coveralls-image]: https://img.shields.io/coveralls/janraasch/coffeelint-stylish.svg | ||
[depstat-url]: https://david-dm.org/janraasch/coffeelint-stylish | ||
[depstat-image]: https://david-dm.org/janraasch/coffeelint-stylish.png | ||
[depstat-image]: https://david-dm.org/janraasch/coffeelint-stylish.svg | ||
[devdepstat-url]: https://david-dm.org/janraasch/coffeelint-stylish#info=devDependencies | ||
[devdepstat-image]: https://david-dm.org/janraasch/coffeelint-stylish/dev-status.png | ||
[devdepstat-image]: https://david-dm.org/janraasch/coffeelint-stylish/dev-status.svg |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5600
65
63
9
Updatedchalk@^0.4.0
Updatedtext-table@^0.2.0