grunt-contrib-csslint
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "grunt-contrib-csslint", | ||
"description": "Lint CSS files.", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-csslint", | ||
@@ -23,5 +23,4 @@ "author": { | ||
], | ||
"main": "Gruntfile.js", | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.10.0" | ||
}, | ||
@@ -32,8 +31,10 @@ "scripts": { | ||
"dependencies": { | ||
"csslint": "~0.10.0" | ||
"csslint": "~0.10.0", | ||
"chalk": "~0.5.1", | ||
"lodash": "~2.4.1" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "~0.2.0", | ||
"grunt-contrib-nodeunit": "~0.1.2", | ||
"grunt-contrib-clean": "~0.4.0", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-contrib-nodeunit": "~0.4.1", | ||
"grunt-contrib-clean": "~0.6.0", | ||
"grunt-contrib-internal": "~0.4.2", | ||
@@ -47,3 +48,7 @@ "grunt": "~0.4.0" | ||
"gruntplugin" | ||
], | ||
"files": [ | ||
"tasks", | ||
"LICENSE-MIT" | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-csslint v0.2.0 [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-csslint.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-csslint) | ||
# grunt-contrib-csslint v0.3.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-csslint.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-csslint) | ||
@@ -194,2 +194,3 @@ > Lint CSS files. | ||
* 2014-09-07 v0.3.0 CSSLint "warnings" no longer fail build. Updated dependencies. | ||
* 2013-12-02 v0.2.0 Bump to csslint 0.10.0 | ||
@@ -204,2 +205,2 @@ * 2013-04-02 v0.1.2 Allow absolute filepaths in reports. | ||
*This file was generated on Mon Dec 02 2013 13:12:47.* | ||
*This file was generated on Sun Sep 07 2014 19:38:01.* |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 Tim Branyen, contributors | ||
* Copyright (c) 2014 Tim Branyen, contributors | ||
* Licensed under the MIT license. | ||
@@ -13,4 +13,4 @@ */ | ||
module.exports = function(grunt) { | ||
grunt.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { | ||
var csslint = require( "csslint" ).CSSLint; | ||
grunt.registerMultiTask( 'csslint', 'Lint CSS files with csslint', function() { | ||
var csslint = require( 'csslint' ).CSSLint; | ||
var ruleset = {}; | ||
@@ -21,3 +21,5 @@ var verbose = grunt.verbose; | ||
var options = this.options(); | ||
var path = require("path"); | ||
var path = require('path'); | ||
var _ = require('lodash'); | ||
var chalk = require('chalk'); | ||
var absoluteFilePaths = options.absoluteFilePathsForFormatters || false; | ||
@@ -34,6 +36,12 @@ | ||
// merge external options with options specified in gruntfile | ||
options = grunt.util._.extend( options, externalOptions ); | ||
options = _.assign( options, externalOptions ); | ||
// if we have disabled explicitly unspecified rules | ||
var defaultDisabled = options['*'] === false; | ||
delete options['*']; | ||
csslint.getRules().forEach(function( rule ) { | ||
ruleset[ rule.id ] = 1; | ||
if ( options[ rule.id ] || ! defaultDisabled ) { | ||
ruleset[ rule.id ] = 1; | ||
} | ||
}); | ||
@@ -51,3 +59,3 @@ | ||
var file = grunt.file.read( filepath ), | ||
message = "Linting " + filepath + " ...", | ||
message = 'Linting ' + chalk.cyan(filepath) + '...', | ||
result; | ||
@@ -70,10 +78,23 @@ | ||
result.messages.forEach(function( message ) { | ||
grunt.log.writeln( "[".red + (typeof message.line !== "undefined" ? ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow : "GENERAL".yellow) + "]".red ); | ||
grunt.log[ message.type === "error" ? "error" : "writeln" ]( message.message + " " + message.rule.desc + " (" + message.rule.id + ")" ); | ||
var offenderMessage; | ||
if (typeof message.line !== 'undefined') { | ||
offenderMessage = | ||
chalk.yellow('L' + message.line) + | ||
chalk.red(':') + | ||
chalk.yellow('C' + message.col); | ||
} else { | ||
offenderMessage = chalk.yellow('GENERAL'); | ||
} | ||
grunt.log.writeln(chalk.red('[') + offenderMessage + chalk.red(']')); | ||
grunt.log[ message.type === 'error' ? 'error' : 'writeln' ]( | ||
message.type.toUpperCase() + ': ' + message.message + ' ' + message.rule.desc + ' (' + message.rule.id + ')' | ||
); | ||
if (message.type === 'error' ) { | ||
hadErrors += 1; | ||
} | ||
}); | ||
if ( result.messages.length ) { | ||
hadErrors += 1; | ||
} | ||
} else { | ||
grunt.log.writeln( "Skipping empty file " + filepath); | ||
grunt.log.writeln('Skipping empty file ' + chalk.cyan(filepath) + '.'); | ||
} | ||
@@ -84,3 +105,3 @@ | ||
// formatted output | ||
if (options.formatters && grunt.util._.isArray( options.formatters )) { | ||
if (options.formatters && Array.isArray( options.formatters )) { | ||
options.formatters.forEach(function ( formatterDefinition ) { | ||
@@ -91,3 +112,3 @@ if (formatterDefinition.id && formatterDefinition.dest) { | ||
var output = formatter.startFormat(); | ||
grunt.util._.each( combinedResult, function ( result, filename ) { | ||
_.each( combinedResult, function ( result, filename ) { | ||
if (absoluteFilePaths) { | ||
@@ -108,4 +129,4 @@ filename = path.resolve(filename); | ||
} | ||
grunt.log.ok( this.filesSrc.length + grunt.util.pluralize(this.filesSrc.length, " file/ files") + " lint free." ); | ||
grunt.log.ok( this.filesSrc.length + grunt.util.pluralize(this.filesSrc.length, ' file/ files') + ' lint free.' ); | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
205
11275
4
4
108
1
+ Addedchalk@~0.5.1
+ Addedlodash@~2.4.1
+ Addedansi-regex@0.2.1(transitive)
+ Addedansi-styles@1.1.0(transitive)
+ Addedchalk@0.5.1(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-ansi@0.1.0(transitive)
+ Addedstrip-ansi@0.3.0(transitive)
+ Addedsupports-color@0.2.0(transitive)