grunt-contrib-csslint
Advanced tools
Comparing version 0.4.0 to 0.5.0
{ | ||
"name": "grunt-contrib-csslint", | ||
"description": "Lint CSS files", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"author": { | ||
@@ -9,9 +9,4 @@ "name": "Grunt Team", | ||
}, | ||
"repository": "grunt/grunt-contrib-csslint", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/gruntjs/grunt-contrib-csslint/blob/master/LICENSE-MIT" | ||
} | ||
], | ||
"repository": "gruntjs/grunt-contrib-csslint", | ||
"license": "MIT", | ||
"engines": { | ||
@@ -24,5 +19,5 @@ "node": ">=0.10.0" | ||
"dependencies": { | ||
"chalk": "^0.5.1", | ||
"chalk": "^1.0.0", | ||
"csslint": "^0.10.0", | ||
"lodash": "^2.4.1", | ||
"lodash": "^3.3.0", | ||
"strip-json-comments": "^1.0.2" | ||
@@ -35,3 +30,3 @@ }, | ||
"grunt-contrib-internal": "^0.4.2", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-jshint": "^0.11.0", | ||
"grunt-contrib-nodeunit": "^0.4.1" | ||
@@ -38,0 +33,0 @@ }, |
119
README.md
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-csslint v0.4.0 [![Build Status: Linux](https://travis-ci.org/grunt/grunt-contrib-csslint.svg?branch=master)](https://travis-ci.org/grunt/grunt-contrib-csslint) | ||
# grunt-contrib-csslint v0.5.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-csslint.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-csslint) | ||
@@ -35,37 +35,37 @@ > Lint CSS files | ||
* important | ||
* adjoining-classes | ||
* known-properties | ||
* box-sizing | ||
* box-model | ||
* overqualified-elements | ||
* display-property-grouping | ||
* bulletproof-font-face | ||
* compatible-vendor-prefixes | ||
* regex-selectors | ||
* errors | ||
* duplicate-background-images | ||
* duplicate-properties | ||
* empty-rules | ||
* selector-max-approaching | ||
* gradients | ||
* fallback-colors | ||
* font-sizes | ||
* font-faces | ||
* floats | ||
* star-property-hack | ||
* outline-none | ||
* import | ||
* ids | ||
* underscore-property-hack | ||
* rules-count | ||
* qualified-headings | ||
* selector-max | ||
* shorthand | ||
* text-indent | ||
* unique-headings | ||
* universal-selector | ||
* unqualified-attributes | ||
* vendor-prefix | ||
* zero-units | ||
- [important](https://github.com/CSSLint/csslint/wiki/Disallow-%21important) | ||
- [adjoining-classes](https://github.com/CSSLint/csslint/wiki/Disallow-adjoining-classes) | ||
- [known-properties](https://github.com/CSSLint/csslint/wiki/Require-use-of-known-properties) | ||
- [box-sizing](https://github.com/CSSLint/csslint/wiki/Disallow-box-sizing) | ||
- [box-model](https://github.com/CSSLint/csslint/wiki/Beware-of-box-model-size) | ||
- [overqualified-elements](https://github.com/CSSLint/csslint/wiki/Disallow-overqualified-elements) | ||
- [display-property-grouping](https://github.com/CSSLint/csslint/wiki/Require-properties-appropriate-for-display) | ||
- [bulletproof-font-face](https://github.com/CSSLint/csslint/wiki/Bulletproof-font-face) | ||
- [compatible-vendor-prefixes](https://github.com/CSSLint/csslint/wiki/Require-compatible-vendor-prefixes) | ||
- [regex-selectors](https://github.com/CSSLint/csslint/wiki/Disallow-selectors-that-look-like-regular-expressions) | ||
- errors | ||
- [duplicate-background-images](https://github.com/CSSLint/csslint/wiki/Disallow-duplicate-background-images) | ||
- [duplicate-properties](https://github.com/CSSLint/csslint/wiki/Disallow-duplicate-properties) | ||
- [empty-rules](https://github.com/CSSLint/csslint/wiki/Disallow-empty-rules) | ||
- selector-max-approaching | ||
- [gradients](https://github.com/CSSLint/csslint/wiki/Require-all-gradient-definitions) | ||
- [fallback-colors](https://github.com/CSSLint/csslint/wiki/Require-fallback-colors) | ||
- [font-sizes](https://github.com/CSSLint/csslint/wiki/Don%27t-use-too-many-font-size-declarations) | ||
- [font-faces](https://github.com/CSSLint/csslint/wiki/Don%27t-use-too-many-web-fonts) | ||
- [floats](https://github.com/CSSLint/csslint/wiki/Disallow-too-many-floats) | ||
- [star-property-hack](https://github.com/CSSLint/csslint/wiki/Disallow-star-hack) | ||
- [outline-none](https://github.com/CSSLint/csslint/wiki/Disallow-outline%3Anone) | ||
- [import](https://github.com/CSSLint/csslint/wiki/Disallow-%40import) | ||
- [ids](https://github.com/CSSLint/csslint/wiki/Disallow-IDs-in-selectors) | ||
- [underscore-property-hack](https://github.com/CSSLint/csslint/wiki/Disallow-underscore-hack) | ||
- rules-count | ||
- [qualified-headings](https://github.com/CSSLint/csslint/wiki/Disallow-qualified-headings) | ||
- selector-max | ||
- [shorthand](https://github.com/CSSLint/csslint/wiki/Require-shorthand-properties) | ||
- [text-indent](https://github.com/CSSLint/csslint/wiki/Disallow-negative-text-indent) | ||
- [unique-headings](https://github.com/CSSLint/csslint/wiki/Headings-should-only-be-defined-once) | ||
- [universal-selector](https://github.com/CSSLint/csslint/wiki/Disallow-universal-selector) | ||
- [unqualified-attributes](https://github.com/CSSLint/csslint/wiki/Disallow-unqualified-attribute-selectors) | ||
- [vendor-prefix](https://github.com/CSSLint/csslint/wiki/Require-standard-property-with-vendor-prefix) | ||
- [zero-units](https://github.com/CSSLint/csslint/wiki/Disallow-units-for-zero-values) | ||
@@ -83,3 +83,3 @@ For an explanation of those rules, [check the csslint wiki](https://github.com/stubbornella/csslint/wiki/Rules). | ||
###### csslintrc | ||
#### csslintrc | ||
@@ -100,3 +100,3 @@ Type: `string` | ||
###### formatters | ||
#### formatters | ||
@@ -109,3 +109,3 @@ Type: `array` | ||
For the current csslint version, the following formatters are supported: | ||
For the current csslint version, the following formatters are included out of the box: | ||
@@ -121,9 +121,18 @@ - `text` | ||
###### absoluteFilePathsForFormatters | ||
You are also able to supply your own custom formatter, such as [csslint-stylish](https://www.npmjs.com/package/csslint-stylish). Note that you have to provide the complete module, not just the id. See [example](#providing-a-custom-formatter). | ||
#### absoluteFilePathsForFormatters | ||
Type: `boolean` | ||
Default: `false` | ||
If the absoluteFilePathsForFormatters option is specified and set to `true`, the file names in the generated reports are absolute. | ||
If the `absoluteFilePathsForFormatters` option is specified and set to `true`, the file names in the generated reports are absolute. | ||
#### quiet | ||
Type: `boolean` | ||
Default: `false` | ||
Only output errors. | ||
### Usage Examples | ||
@@ -148,3 +157,3 @@ | ||
###### Loading rules from an external file | ||
#### Loading rules from an external file | ||
@@ -171,3 +180,3 @@ ```js | ||
###### Specifiying output formatters | ||
#### Specifiying output formatters | ||
@@ -192,3 +201,3 @@ ```js | ||
###### Using absolute file paths in the output formatters | ||
#### Providing a custom formatter | ||
@@ -198,2 +207,21 @@ ```js | ||
options: { | ||
csslintrc: '.csslintrc', | ||
formatters: [ | ||
{id: require('csslint-stylish'), dest: 'report/csslint_stylish.xml'} | ||
] | ||
}, | ||
strict: { | ||
options: { | ||
import: 2 | ||
}, | ||
src: ['path/to/**/*.css'] | ||
} | ||
} | ||
``` | ||
#### Using absolute file paths in the output formatters | ||
```js | ||
csslint: { | ||
options: { | ||
absoluteFilePathsForFormatters: true, | ||
@@ -211,2 +239,3 @@ formatters: [ | ||
* 2015-07-18 v0.5.0 Add ability to register custom formatters. | ||
* 2015-01-18 v0.4.0 The `.csslintrc` file can now contain comments. | ||
@@ -224,2 +253,2 @@ * 2014-09-07 v0.3.1 Show affected browsers in errors and warnings. | ||
*This file was generated on Sun Jan 18 2015 16:00:53.* | ||
*This file was generated on Sat Jul 18 2015 22:58:12.* |
@@ -12,5 +12,5 @@ /* | ||
module.exports = function(grunt) { | ||
grunt.registerMultiTask( 'csslint', 'Lint CSS files with csslint', function() { | ||
var csslint = require( 'csslint' ).CSSLint; | ||
var stripJsonComments = require( 'strip-json-comments' ); | ||
grunt.registerMultiTask('csslint', 'Lint CSS files with csslint', function() { | ||
var csslint = require('csslint').CSSLint; | ||
var stripJsonComments = require('strip-json-comments'); | ||
var ruleset = {}; | ||
@@ -28,4 +28,4 @@ var verbose = grunt.verbose; | ||
if (options.csslintrc) { | ||
var contents = grunt.file.read( options.csslintrc ); | ||
externalOptions = JSON.parse( stripJsonComments( contents ) ); | ||
var contents = grunt.file.read(options.csslintrc); | ||
externalOptions = JSON.parse(stripJsonComments(contents)); | ||
// delete csslintrc option to not confuse csslint if a future release | ||
@@ -37,3 +37,3 @@ // implements a rule or options on its own | ||
// merge external options with options specified in gruntfile | ||
options = _.assign( options, externalOptions ); | ||
options = _.assign(options, externalOptions); | ||
@@ -44,18 +44,18 @@ // if we have disabled explicitly unspecified rules | ||
csslint.getRules().forEach(function( rule ) { | ||
if ( options[ rule.id ] || ! defaultDisabled ) { | ||
ruleset[ rule.id ] = 1; | ||
csslint.getRules().forEach(function(rule) { | ||
if (options[rule.id] || !defaultDisabled) { | ||
ruleset[rule.id] = 1; | ||
} | ||
}); | ||
for ( var rule in options ) { | ||
if ( !options[ rule ] ) { | ||
for (var rule in options) { | ||
if (!options[rule]) { | ||
delete ruleset[rule]; | ||
} else { | ||
ruleset[ rule ] = options[ rule ]; | ||
ruleset[rule] = options[rule]; | ||
} | ||
} | ||
var hadErrors = 0; | ||
this.filesSrc.forEach(function( filepath ) { | ||
var file = grunt.file.read( filepath ), | ||
this.filesSrc.forEach(function(filepath) { | ||
var file = grunt.file.read(filepath), | ||
message = 'Linting ' + chalk.cyan(filepath) + '...', | ||
@@ -66,6 +66,6 @@ result; | ||
if (file.length) { | ||
result = csslint.verify( file, ruleset ); | ||
verbose.write( message ); | ||
result = csslint.verify(file, ruleset); | ||
verbose.write(message); | ||
if (result.messages.length) { | ||
verbose.or.write( message ); | ||
verbose.or.write(message); | ||
grunt.log.error(); | ||
@@ -79,3 +79,3 @@ } else { | ||
result.messages.forEach(function( message ) { | ||
result.messages.forEach(function(message) { | ||
var offenderMessage; | ||
@@ -91,4 +91,5 @@ if (typeof message.line !== 'undefined') { | ||
grunt.log.writeln(chalk.red('[') + offenderMessage + chalk.red(']')); | ||
grunt.log[ message.type === 'error' ? 'error' : 'writeln' ]( | ||
if (!options.quiet || options.quiet && message.type === 'error') { | ||
grunt.log.writeln(chalk.red('[') + offenderMessage + chalk.red(']')); | ||
grunt.log[ message.type === 'error' ? 'error' : 'writeln' ]( | ||
message.type.toUpperCase() + ': ' + | ||
@@ -99,5 +100,6 @@ message.message + ' ' + | ||
' Browsers: ' + message.rule.browsers | ||
); | ||
); | ||
} | ||
if (message.type === 'error' ) { | ||
if (message.type === 'error') { | ||
hadErrors += 1; | ||
@@ -113,16 +115,24 @@ } | ||
// formatted output | ||
if (options.formatters && Array.isArray( options.formatters )) { | ||
options.formatters.forEach(function ( formatterDefinition ) { | ||
if (formatterDefinition.id && formatterDefinition.dest) { | ||
var formatter = csslint.getFormatter( formatterDefinition.id ); | ||
if (options.formatters && Array.isArray(options.formatters)) { | ||
options.formatters.forEach(function (formatterDefinition) { | ||
var formatterId = formatterDefinition.id; | ||
if (formatterId && formatterDefinition.dest) { | ||
if (!csslint.hasFormat(formatterId) && typeof formatterId === 'object' ) { // A custom formatter was supplied | ||
csslint.addFormatter(formatterId); | ||
formatterId = formatterId.id; | ||
} | ||
var formatter = csslint.getFormatter(formatterId); | ||
if (formatter) { | ||
var output = formatter.startFormat(); | ||
_.each( combinedResult, function ( result, filename ) { | ||
_.each(combinedResult, function (result, filename) { | ||
if (absoluteFilePaths) { | ||
filename = path.resolve(filename); | ||
} | ||
output += formatter.formatResults( result, filename, {}); | ||
output += formatter.formatResults(result, filename, {}); | ||
}); | ||
output += formatter.endFormat(); | ||
grunt.file.write( formatterDefinition.dest, output ); | ||
grunt.file.write(formatterDefinition.dest, output); | ||
} | ||
@@ -133,7 +143,7 @@ } | ||
if ( hadErrors ) { | ||
if (hadErrors) { | ||
return false; | ||
} | ||
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.'); | ||
}); | ||
}; |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
15155
5
121
1
1
244
0
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedchalk@0.5.1(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedlodash@2.4.2(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedsupports-color@0.2.0(transitive)
Updatedchalk@^1.0.0
Updatedlodash@^3.3.0