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

lesshint

Package Overview
Dependencies
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lesshint - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

6

CHANGELOG.md
# Changelog
## 4.0.1 (2017-07-10)
* Fixed an issue where incomplete rules would crash `lesshint`. ([31b54c1](https://github.com/lesshint/lesshint/commit/31b54c1ef48840d457ddbfd04c9b08dd4fad936d))
* Fixed faulty column reporting in `spaceAroundOperator`. ([87cb546](https://github.com/lesshint/lesshint/commit/87cb546697c5424800393b1bc6902c875fac3650))
* Added `fr` to `propertyUnits` defaults. ([80fb2b4](https://github.com/lesshint/lesshint/commit/80fb2b4b18d4657a9944d79a149e20d9a1d61f4a))
* The `isColor` from `postcss-values-parser` is now used where applicable. ([2c038af](https://github.com/lesshint/lesshint/commit/2c038afa8c04399427b4eb7b2ee4acddcd0e5f02))
## 4.0.0 (2017-06-25)

@@ -3,0 +9,0 @@ * **Breaking** Updated `postcss-less` to `1.0.0`, could cause issues if custom linters are used. ([03107e5](https://github.com/lesshint/lesshint/commit/0a020df33c3cf04c7e0f12305311efeeb0a3611d))

6

lib/config/defaults.json

@@ -15,5 +15,5 @@ {

},
"colorVariables": {
"enabled": false
"enabled": false
},

@@ -103,3 +103,3 @@

"dpi", "dpcm", "dppx", // Resolution
"%" // Other
"%", "fr" // Other
],

@@ -106,0 +106,0 @@ "invalid": [],

@@ -31,3 +31,3 @@ 'use strict';

ast.first.walk((child) => {
if (child.type !== 'word' || !/^#/.test(child.value)) {
if (child.type !== 'word' || !child.isColor) {
return;

@@ -34,0 +34,0 @@ }

@@ -12,5 +12,2 @@ 'use strict';

lint: function hexValidationLinter (config, node) {
const rColor = /^(#([0-9a-f]{3}|[0-9a-f]{6}))(;?)$/i;
const rHex = /^#([0-9a-f]+)(;?)$/i;
/**

@@ -30,3 +27,3 @@ * Just in case, since postcss will sometimes include the semicolon

if (rHex.test(child.value) && !rColor.test(child.value)) {
if (child.isHex && !child.isColor) {
results.push({

@@ -33,0 +30,0 @@ column: node.source.start.column + node.prop.length + node.raws.between.length + child.source.start.column - 1,

@@ -33,4 +33,6 @@ 'use strict';

const nodeEnd = node.source.end || {};
if (config.allowSingleLineRules) {
if (node.source.start.line === node.source.end.line && node.nodes.length === 1) {
if (node.source.start.line === nodeEnd.line && node.nodes.length === 1) {
return;

@@ -49,6 +51,8 @@ }

const validBefore = hasNewlineBefore(child);
const childEnd = child.source.end || {};
let validAfter = isValidAfter(child, index);
// Check if the closing bracket is on the same line as the last property
if (index === node.nodes.length - 1 && child.source.end.line === node.source.end.line) {
if (index === node.nodes.length - 1 && childEnd.line === nodeEnd.line) {
validAfter = false;

@@ -55,0 +59,0 @@ }

@@ -11,2 +11,3 @@ 'use strict';

lint: function spaceAfterPropertyValueLinter (config, node) {
const nodeEnd = node.source.end || {};
const results = [];

@@ -19,3 +20,3 @@

column: node.source.start.column + node.prop.length + node.raws.between.length + node.value.length,
line: node.source.end.line,
line: nodeEnd.line,
message: util.format(this.message, ' not', 'any')

@@ -30,3 +31,3 @@ });

column: node.source.start.column + node.prop.length + node.raws.between.length + node.value.length,
line: node.source.end.line,
line: nodeEnd.line,
message: util.format(this.message, '', 'one')

@@ -33,0 +34,0 @@ });

@@ -42,3 +42,3 @@ 'use strict';

let startElement;
let operator;
let message;

@@ -48,5 +48,4 @@

case 'both':
if (child.raws.before !== ' ' || !/^\s/.test(child.raws.before) ||
nextElement.raws.before !== ' ' || !/\s$/.test(nextElement.raws.before)) {
startElement = !/\s$/.test(child.raws.before) ? child : nextElement;
if (child.raws.before !== ' ' || !/^\s/.test(child.raws.before) || nextElement.raws.before !== ' ' || !/\s$/.test(nextElement.raws.before)) {
operator = child.value;
message = util.format(this.message, '', 'preceded and followed', 'one');

@@ -58,3 +57,3 @@ }

if (child.raws.before || nextElement.raws.before) {
startElement = child.raws.before ? child : nextElement;
operator = child.value;
message = util.format(this.message, ' not', 'preceded nor followed', 'any');

@@ -69,4 +68,9 @@ }

if (message) {
const position = node.positionBy({
word: operator
});
results.push({
column: node.source.start.column + node.prop.length + node.raws.between.length + startElement.source.start.column + 1,
column: position.column,
line: position.line,
message: message

@@ -73,0 +77,0 @@ });

{
"name": "lesshint",
"description": "A tool to aid you in writing clean and consistent Less.",
"version": "4.0.0",
"version": "4.0.1",
"main": "./lib/index.js",

@@ -6,0 +6,0 @@ "author": {

@@ -38,3 +38,4 @@ 'use strict';

const expected = [{
column: 20,
column: 18,
line: 1,
message: 'Operators should be preceded and followed by one space.'

@@ -53,3 +54,4 @@ }];

const expected = [{
column: 22,
column: 19,
line: 1,
message: 'Operators should be preceded and followed by one space.'

@@ -68,3 +70,4 @@ }];

const expected = [{
column: 20,
column: 18,
line: 1,
message: 'Operators should be preceded and followed by one space.'

@@ -181,3 +184,4 @@ }];

const expected = [{
column: 21,
column: 19,
line: 1,
message: 'Operators should not be preceded nor followed by any space.'

@@ -196,3 +200,4 @@ }];

const expected = [{
column: 22,
column: 18,
line: 1,
message: 'Operators should not be preceded nor followed by any space.'

@@ -211,3 +216,4 @@ }];

const expected = [{
column: 16,
column: 14,
line: 1,
message: 'Operators should not be preceded nor followed by any space.'

@@ -214,0 +220,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