How to use csslint - 10 common examples

To help you get started, we’ve selected a few csslint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nbproject / nbproject / lib / grunt-css.js View on Github external
files.forEach(function( filepath ) {
      var file = grunt.file.read( filepath ),
        message = "Linting " + filepath + "...",
        result;

      // skip empty files
      if (file.length) {
        result = csslint.verify( file, ruleset );
        verbose.write( message );
        if (result.messages.length) {
          verbose.or.write( message );
          grunt.log.error();
        } else {
          verbose.ok();
        }

        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 + ")" );
        });
        if ( result.messages.length ) {
          hadErrors += 1;
        }
      } else {
github jzaefferer / grunt-css / tasks / grunt-css.js View on Github external
files.forEach(function( filepath ) {
      var file = grunt.file.read( filepath ),
        message = "Linting " + filepath + "...",
        result;

      // skip empty files
      if (file.length) {
        result = csslint.verify( file, ruleset );
        verbose.write( message );
        if (result.messages.length) {
          verbose.or.write( message );
          grunt.log.error();
        } else {
          verbose.ok();
        }

        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 + ")" );
        });
        if ( result.messages.length ) {
          hadErrors += 1;
        }
      } else {
github gruntjs / grunt-contrib-csslint / tasks / csslint.js View on Github external
this.filesSrc.forEach(function(filepath) {
      var file = grunt.file.read(filepath),
        message = 'Linting ' + chalk.cyan(filepath) + '...',
        result;

      // skip empty files
      if (file.length) {
        result = csslint.verify(file, ruleset);
        verbose.write(message);
        if (result.messages.length) {
          verbose.or.write(message);
          grunt.log.error();
        } else {
          verbose.ok();
        }

        // store combined result for later use with formatters
        combinedResult[filepath] = result;

        result.messages.forEach(function(message) {
          var offenderMessage;
          if (message.line !== 'undefined') {
            offenderMessage =
              chalk.yellow('L' + message.line) +
github 4ae9b8 / browserhacks / tasks / db / csslint.js View on Github external
module.exports = function(hack){
  if (hack.language === 'css' && !hack.safe){
    var result = csslint.verify(hack.test);

    var filterdMessages = result.messages.filter(function(v){ // filter for real errors!
      return v.type === 'error';
    });

    if (filterdMessages.length > 0){
      hack.safe = false;
      hack.csslint = filterdMessages[0].message;
    } else {
      hack.safe = true;
    }
  }
};
github 4ae9b8 / browserhacks / tasks / css-lint.js View on Github external
module.exports = function(hack){
  if (hack.language === 'css' && !hack.safe){
    var result = [],
        filterdMessages = [];
    for(var i = 0; i < hack.test.length; i++) {
      result[i] = csslint.verify(hack.test[i]);
      /*if(result[i].messages.filter === 'error') {
        filterdMessages[i] = result[i];
      }*/
    }
      /*
    filterdMessages = result.messages.filter(function(v){ // filter for real errors!
      return v.type === 'error';
    });
*/

    if (filterdMessages.length > 0){
      hack.safe = false;
  //    hack.csslint = filterdMessages[0].message;
    } else {
      hack.safe = true;
    }
github tcoopman / elm-css-webpack-loader / test / loader.js View on Github external
var callback = function (loaderErr, loaderResult) {
      var result = CSSLint.verify(loaderResult);
      _.each(_.map(result.messages, 'type'), function(errTy) {
        assert.notEqual(errTy,  "error");
      });
      done();
    };
github colorhook / att / lib / builtins / hint.js View on Github external
this.hintCSS = function(file, options){
      var content = fileutil.read(file);
      var results = CSSLint.verify(content);
      var messages = results.messages;
      if (!messages.length) {
        return console.log('[Perfect] %s', file);
      }
      for (var i = 0, len = messages.length; i < len; i++) {
        console.log('    ' + messages[i].message + 
          ' (line ' + messages[i].line + ', col ' + messages[i].col + ')', messages[i].type);
      }
    }
github colorhook / att / plugins / csslint.js View on Github external
var checkFile = exports.checkFile = function(file){
	var content = fs.readFileSync(file, 'utf-8');
	var results = CSSLint.verify(content);
	messages = results.messages;
	if (messages.length) {
		console.log("# " + file);
	}
	for (i = 0, len = messages.length; i < len; i++) {
		console.log("    " + messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
	}
}
/**
github mosen / buildy / lib / buildy / tasks / csslint.js View on Github external
fs.readFile(o.sourceFile, encoding, function(err, data) {

            if (err) {
                callback(err);
            } else {
                data = data.toString(encoding);

                result = csslint.verify(data, opts);
                callback(false, result);
            }
        });
    } else {
github mosen / buildy / lib / utils.js View on Github external
fs.readFile(o.sourceFile, encoding, function(err, data) {
           
           if (err) {
               callback(err);
           } else {
               data = data.toString(encoding);

               result = csslint.verify(data, opts);
               callback(false, result);
           }
        });
    } else {

csslint

CSSLint

MIT
Latest version published 8 years ago

Package Health Score

62 / 100
Full package analysis

Popular csslint functions