Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

csslint

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csslint - npm Package Compare versions

Comparing version 0.9.8 to 0.9.9

122

cli.js
#!/usr/bin/env node
/* Build time: 14-May-2012 10:24:48 */
/* Build time: 12-September-2012 01:46:26 */

@@ -32,5 +32,4 @@ /*

*/
function gatherRules(options){
var ruleset,
warnings = options.rules || options.warnings,
function gatherRules(options, ruleset){
var warnings = options.rules || options.warnings,
errors = options.errors;

@@ -51,3 +50,22 @@

}
return ruleset;
}
/**
* Filters out rules using the ignore command line option.
* @param options {Object} the CLI options
* @return {Object} A ruleset object.
*/
function filterRules(options) {
var ignore = options.ignore,
ruleset = null;
if (ignore) {
ruleset = CSSLint.getRuleset();
ignore.split(",").forEach(function(value){
delete ruleset[value];
});
}
return ruleset;

@@ -76,3 +94,4 @@ }

var input = api.readFile(relativeFilePath),
result = CSSLint.verify(input, gatherRules(options)),
ruleset = filterRules(options),
result = CSSLint.verify(input, gatherRules(options, ruleset)),
formatter = CSSLint.getFormatter(options.format || "text"),

@@ -122,2 +141,3 @@ messages = result.messages || [],

" --warnings=<rule[,rule]+> Indicate which rules to include as warnings.",
" --ignore=<rule,[,rule]+> Indicate which rules to ignore completely.",
" --version Outputs the current version number."

@@ -169,4 +189,53 @@ ].join("\n") + "\n");

return exitCode;
}
}
function processArguments(args, options) {
var arg = args.shift(),
argName,
parts,
files = [];
while(arg){
if (arg.indexOf("--") === 0){
argName = arg.substring(2);
options[argName] = true;
if (argName.indexOf("=") > -1){
parts = argName.split("=");
options[parts[0]] = parts[1];
} else {
options[argName] = true;
}
} else {
//see if it's a directory or a file
if (api.isDirectory(arg)){
files = files.concat(api.getFiles(arg));
} else {
files.push(arg);
}
}
arg = args.shift();
}
options.files = files;
return options;
}
function readConfigFile(options) {
var data = api.readFile(api.getFullPath(".csslintrc"));
if (data) {
options = processArguments(data.split(/[\s\n\r]+/m), options);
api.print("ignore = " + options.ignore);
api.print("errors = " + options.errors);
api.print("warnings = " + options.warnings);
}
return options;
}
//-----------------------------------------------------------------------------

@@ -177,33 +246,12 @@ // Process command line

var args = api.args,
argName,
parts,
arg = args.shift(),
options = {},
files = [];
argCount = args.length,
options = {};
// first look for config file .csslintrc
options = readConfigFile(options);
// Command line arguments override config file
options = processArguments(args, options);
while(arg){
if (arg.indexOf("--") === 0){
argName = arg.substring(2);
options[argName] = true;
if (argName.indexOf("=") > -1){
parts = argName.split("=");
options[parts[0]] = parts[1];
} else {
options[argName] = true;
}
} else {
//see if it's a directory or a file
if (api.isDirectory(arg)){
files = files.concat(api.getFiles(arg));
} else {
files.push(arg);
}
}
arg = args.shift();
}
if (options.help || arguments.length === 0){
if (options.help || argCount === 0){
outputHelp();

@@ -223,3 +271,3 @@ api.quit(0);

api.quit(processFiles(files,options));
api.quit(processFiles(options.files,options));
}

@@ -226,0 +274,0 @@ /*

{
"name": "csslint",
"version": "0.9.8",
"version": "0.9.9",
"description": "CSSLint",

@@ -5,0 +5,0 @@ "author": "Nicholas C. Zakas",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc