postcss-reporter
Advanced tools
Comparing version 0.3.1 to 0.4.0
# Changelog | ||
### v0.3.1 | ||
## v0.4.0 | ||
- Add `positionless` option (to both the reporter and the formatter), with default value `"first"`. | ||
- Cleaner npm install (files specified in `package.json`). | ||
## v0.3.1 | ||
- Remove leftover debugging log statement. | ||
### v0.3.0 | ||
## v0.3.0 | ||
- Add `sortByPosition` option (to both the reporter and the formatter), with default value `true`. | ||
@@ -8,0 +12,0 @@ |
@@ -7,5 +7,10 @@ var chalk = require('chalk'); | ||
var getMessageLine = property('node.source.start.line'); | ||
var getMessageColumn = property('node.source.start.column'); | ||
module.exports = function(opts) { | ||
var options = opts || {}; | ||
var sortByPosition = (typeof options.sortByPosition !== 'undefined') ? options.sortByPosition : true; | ||
var positionless = options.positionless || 'first'; | ||
return function(input) { | ||
@@ -17,9 +22,19 @@ var messages = input.messages; | ||
var orderedMessages = (sortByPosition) | ||
? sortByAll( | ||
messages, | ||
property('node.source.start.line'), | ||
property('node.source.start.column') | ||
) | ||
: messages; | ||
var orderedMessages = sortByAll( | ||
messages, | ||
function(m) { | ||
if (!getMessageLine(m)) return 1; | ||
if (positionless === 'any') return 1; | ||
if (positionless === 'first') return 2; | ||
if (positionless === 'last') return 0; | ||
}, | ||
function(m) { | ||
if (!sortByPosition) return 1; | ||
return getMessageLine(m); | ||
}, | ||
function(m) { | ||
if (!sortByPosition) return 1; | ||
return getMessageColumn(m); | ||
} | ||
); | ||
@@ -26,0 +41,0 @@ var output = '\n'; |
@@ -10,2 +10,3 @@ var chalk = require('chalk'); | ||
sortByPosition: (typeof options.sortByPosition !== 'undefined') ? options.sortByPosition : true, | ||
positionless: options.positionless || 'first', | ||
}); | ||
@@ -12,0 +13,0 @@ |
{ | ||
"name": "postcss-reporter", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Log PostCSS messages in the console", | ||
@@ -11,2 +11,6 @@ "main": "index.js", | ||
}, | ||
"files": [ | ||
"index.js", | ||
"lib" | ||
], | ||
"repository": { | ||
@@ -27,6 +31,6 @@ "type": "git", | ||
"devDependencies": { | ||
"eslint": "0.24.1", | ||
"lodash.clonedeep": "3.0.1", | ||
"postcss-bem-linter": "0.4.0", | ||
"tape": "4.0.0" | ||
"eslint": "1.0.0", | ||
"lodash.clonedeep": "3.0.2", | ||
"stylelint": "0.6.2", | ||
"tape": "4.0.2" | ||
}, | ||
@@ -33,0 +37,0 @@ "dependencies": { |
@@ -82,2 +82,8 @@ # postcss-reporter [![Build Status](https://travis-ci.org/postcss/postcss-reporter.svg?branch=master)](https://travis-ci.org/postcss/postcss-reporter) | ||
**positionless** (`"first"|"last"|"any"`, default = `"first"`) | ||
By default, messages without line/column positions will be grouped at the beginning of the output. | ||
To put them at the end, instead, use `"last"`. | ||
To not bother sorting these, use `"any"`. | ||
## How to get output without colors | ||
@@ -84,0 +90,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
110
0
9865
7
99
1