New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

csstree-validator

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csstree-validator - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

lib/reporter/gnu.js

4

HISTORY.md

@@ -0,1 +1,5 @@

## 1.2.2 (November 11, 2017)
- Updated `csstree` to 1.0.0-alpha.26
## 1.2.1 (September 14, 2017)

@@ -2,0 +6,0 @@

2

lib/cli.js

@@ -8,3 +8,3 @@ var cli = require('clap');

.version(require('../package.json').version)
.option('-r, --reporter <name>', 'Format of output: console (default), checkstyle, json', function(name) {
.option('-r, --reporter <name>', 'Format of output: console (default), checkstyle, json, gnu', function(name) {
if (!reporters.hasOwnProperty(name)) {

@@ -11,0 +11,0 @@ throw new cli.Error('Wrong value for reporter: ' + name);

module.exports = {
json: require('./json.js'),
console: require('./console.js'),
checkstyle: require('./checkstyle.js')
checkstyle: require('./checkstyle.js'),
gnu: require('./gnu.js')
};

@@ -26,47 +26,42 @@ var fs = require('fs');

var errors = [];
var parseOptions = {
var ast = csstree.parse(css, {
filename: filename,
positions: true,
tolerant: true,
onParseError: function(error) {
errors.push(error);
}
};
});
try {
csstree.walkDeclarations(csstree.parse(css, parseOptions), function(node) {
var match = syntax.matchDeclaration(node);
var error = match.error;
csstree.walkDeclarations(ast, function(node) {
var match = syntax.matchDeclaration(node);
var error = match.error;
if (error) {
var message = error.rawMessage || error.message || error;
if (error) {
var message = error.rawMessage || error.message || error;
// ignore errors except those which make sense
if (error.name !== 'SyntaxMatchError' &&
error.name !== 'SyntaxReferenceError') {
return;
}
// ignore errors except those which make sense
if (error.name !== 'SyntaxMatchError' &&
error.name !== 'SyntaxReferenceError') {
return;
}
if (message === 'Mismatch') {
message = 'Invalid value for `' + node.property + '`';
} else if (message === 'Uncomplete match') {
message = 'The rest part of value can\'t be matched to `' + node.property + '` syntax';
}
errors.push({
name: error.name,
node: node,
loc: error.loc || node.loc,
line: error.line || node.loc && node.loc.start && node.loc.start.line,
column: error.column || node.loc && node.loc.start && node.loc.start.column,
property: node.property,
message: message,
error: error
});
if (message === 'Mismatch') {
message = 'Invalid value for `' + node.property + '`';
} else if (message === 'Uncomplete match') {
message = 'The rest part of value can\'t be matched to `' + node.property + '` syntax';
}
});
} catch (e) {
errors.push(e);
}
errors.push({
name: error.name,
node: node,
loc: error.loc || node.loc,
line: error.line || node.loc && node.loc.start && node.loc.start.line,
column: error.column || node.loc && node.loc.start && node.loc.start.column,
property: node.property,
message: message,
error: error
});
}
});
return errors;

@@ -73,0 +68,0 @@ }

{
"name": "csstree-validator",
"version": "1.2.1",
"version": "1.2.2",
"description": "CSS validator build on csstree",

@@ -48,3 +48,3 @@ "keywords": [

"clap": "^1.1.1",
"css-tree": "1.0.0-alpha24"
"css-tree": "1.0.0-alpha.26"
},

@@ -51,0 +51,0 @@ "devDependencies": {

@@ -22,3 +22,3 @@ [![NPM version](https://img.shields.io/npm/v/csstree-validator.svg)](https://www.npmjs.com/package/csstree-validator)

-h, --help Output usage information
-r, --reporter <name> Format of output: console (default), checkstyle, json
-r, --reporter <name> Format of output: console (default), checkstyle, json, gnu
-v, --version Output version

@@ -25,0 +25,0 @@ ```

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