Comparing version 0.7.0-beta2 to 0.7.0-beta3
@@ -57,2 +57,9 @@ { | ||
"importPath": { | ||
"enabled": true, | ||
"exclude": [], | ||
"filenameExtension": false, | ||
"leadingUnderscore": false | ||
}, | ||
"leadingZero": { | ||
@@ -63,2 +70,17 @@ "enabled": true, | ||
"propertyUnits": { | ||
"enabled": true, | ||
"global": [ | ||
"ch", "em", "ex", "rem", // Font-relative lengths | ||
"cm", "in", "mm", "pc", "pt", "px", "q", // Absolute lengths | ||
"vh", "vw", "vmin", "vmax", // Viewport-percentage lengths | ||
"deg", "grad", "rad", "turn", // Angle | ||
"ms", "s", // Duration | ||
"Hz", "kHz", // Frequency | ||
"dpi", "dpcm", "dppx", // Resolution | ||
"%" // Other | ||
], | ||
"properties": {} | ||
}, | ||
"qualifyingElement": { | ||
@@ -71,2 +93,7 @@ "enabled": true, | ||
"spaceAfterComma": { | ||
"enabled": true, | ||
"style": "one_space" | ||
}, | ||
"spaceAfterPropertyColon": { | ||
@@ -92,2 +119,12 @@ "enabled": true, | ||
"spaceBeforeComma": { | ||
"enabled": true, | ||
"style": "no_space" | ||
}, | ||
"spaceBetweenParens": { | ||
"enabled": true, | ||
"style": "no_space" | ||
}, | ||
"stringQuotes": { | ||
@@ -94,0 +131,0 @@ "enabled": true, |
@@ -17,5 +17,8 @@ 'use strict'; | ||
require('./linters/id_selector'), | ||
require('./linters/import_path'), | ||
require('./linters/important_rule'), | ||
require('./linters/leading_zero'), | ||
require('./linters/property_units'), | ||
require('./linters/qualifying_element'), | ||
require('./linters/space_after_comma'), | ||
require('./linters/space_after_property_colon'), | ||
@@ -25,2 +28,4 @@ require('./linters/space_after_property_name'), | ||
require('./linters/space_before_brace'), | ||
require('./linters/space_before_comma'), | ||
require('./linters/space_between_parens'), | ||
require('./linters/string_quotes'), | ||
@@ -38,3 +43,3 @@ require('./linters/trailing_semicolon'), | ||
ast.map(function (node) { | ||
ast.traverse(function (node) { | ||
var i; | ||
@@ -53,3 +58,3 @@ | ||
errors = errors.filter(function (error) { | ||
return error !== null && error !== true; | ||
return error !== null; | ||
}); | ||
@@ -56,0 +61,0 @@ |
@@ -54,3 +54,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -20,3 +20,3 @@ 'use strict'; | ||
// Not applicable, bail | ||
if (node.type !== 'declaration') { | ||
if (!node.is('declaration')) { | ||
return null; | ||
@@ -28,3 +28,3 @@ } | ||
// Not a border* property, bail | ||
if (properties.indexOf(property.content[0].content) === -1) { | ||
if (properties.indexOf(property.first().content) === -1) { | ||
return null; | ||
@@ -36,3 +36,3 @@ } | ||
// Bail if it's an actual border | ||
if ((value.content[0].content !== '0' && value.content[0].content !== 'none')) { | ||
if (value.first().content !== '0' && value.first().content !== 'none') { | ||
return null; | ||
@@ -43,3 +43,3 @@ } | ||
case 'none': | ||
if (value.content[0].content === '0') { | ||
if (value.first().content === '0') { | ||
message = 'Border properties should use "none" instead of 0.'; | ||
@@ -50,3 +50,3 @@ } | ||
case 'zero': | ||
if (value.content[0].content === 'none') { | ||
if (value.first().content === 'none') { | ||
message = 'Border properties should use 0 instead of "none".'; | ||
@@ -72,3 +72,3 @@ } | ||
return true; | ||
return null; | ||
}; |
@@ -35,3 +35,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -53,3 +53,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -22,4 +22,5 @@ 'use strict'; | ||
block = node.first('block') || {}; | ||
block.content = block.content || []; | ||
if (block.content && (!block.content.length || (block.content.length === 1 && block.content[0].type === 'space'))) { | ||
if (!block.content.length || (block.content.length === 1 && block.content[0].type === 'space')) { | ||
return { | ||
@@ -34,3 +35,3 @@ column: node.start.column, | ||
return true; | ||
return null; | ||
}; |
@@ -33,3 +33,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -58,3 +58,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -56,3 +56,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -32,3 +32,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -53,3 +53,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -9,3 +9,2 @@ 'use strict'; | ||
var node = options.node; | ||
var message; | ||
var value; | ||
@@ -28,6 +27,2 @@ | ||
if (value) { | ||
message = '!important should not be used.'; | ||
} | ||
if (message) { | ||
return { | ||
@@ -38,7 +33,7 @@ column: value.start.column, | ||
linter: 'importantRule', | ||
message: message | ||
message: '!important should not be used.' | ||
}; | ||
} | ||
return true; | ||
return null; | ||
}; |
@@ -24,7 +24,3 @@ 'use strict'; | ||
node.content.forEach(function (element) { | ||
if (element.type !== 'value') { | ||
return; | ||
} | ||
node.forEach('value', function (element) { | ||
value = element.first('dimension'); | ||
@@ -70,3 +66,3 @@ value = value && value.first('number'); | ||
return true; | ||
return null; | ||
}; |
@@ -76,3 +76,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -18,4 +18,7 @@ # Available linters | ||
* [importantRule](#importantrule) | ||
* [importPath](#importpath) | ||
* [leadingZero](#leadingzero) | ||
* [propertyUnits](#propertyunits) | ||
* [qualifyingElement](#qualifyingelement) | ||
* [spaceAfterComma](#spaceaftercomma) | ||
* [spaceAfterPropertyColon](#spaceafterpropertycolon) | ||
@@ -25,2 +28,4 @@ * [spaceAfterPropertyName](#spaceafterpropertyname) | ||
* [spaceBeforeBrace](#spacebeforebrace) | ||
* [spaceBeforeComma](#spacebeforecomma) | ||
* [spaceBetweenParens](#spacebetweenparens) | ||
* [stringQuotes](#stringquotes) | ||
@@ -259,2 +264,24 @@ * [trailingSemicolon](#trailingsemicolon) | ||
## importPath | ||
Imported files should not include a leading underscore or the filename extension. | ||
The filename extension isn't required and underscores should be reserved for usage with config-files, such as `_vars.less`. | ||
Option | Description | ||
-------------------- | ---------- | ||
`filenameExtension` | `false` (**default**), `true` | ||
`leadingUnderscore` | `false` (**default**), `true` | ||
`exclude` | Array of files to exclude | ||
### invalid | ||
```css | ||
@import 'foo.less'; | ||
@import '_bar'; | ||
``` | ||
### valid | ||
```css | ||
@import 'foo'; | ||
@import 'bar'; | ||
``` | ||
## leadingZero | ||
@@ -281,2 +308,32 @@ Numbers should be written with a leading zero. | ||
## propertyUnits | ||
Specify which units are allowed for property values. | ||
By default all properties can have any value. | ||
The `global` option can be used to specify global units that are allowed | ||
and the `properties` option can be used to fine tune units for each property. | ||
*Note: Shorthands are not supported by the `properties` option. For example, to specify units for `margin`, all margin-* properties must be specified.* | ||
Option | Description | ||
------------ | ---------- | ||
`global` | Allowed units (by default all units are allowed) | ||
`properties` | Object with property names and allowed units (empty by default) | ||
```js | ||
"propertyUnits": { | ||
"global": ["rem", "vw"], // These units are allowed for all properties | ||
"properties": { | ||
"line-height": [] // No units are allowed for line-height | ||
} | ||
} | ||
``` | ||
```css | ||
.foo { | ||
font-size: 1.5rem; // Allowed | ||
line-height: 30px; // Not allowed | ||
} | ||
``` | ||
## qualifyingElement | ||
@@ -321,2 +378,23 @@ Selectors should not include a qualifying element since this will just add unnecessary specificity. | ||
## spaceAfterComma | ||
Each comma in functions, mixins, etc. should be followed by a space to aid readability. | ||
Option | Description | ||
---------- | ---------- | ||
`style` | `no_space`, `one_space` (**default**) | ||
### no_space | ||
```css | ||
.foo { | ||
color: rgb(255,255,255); | ||
} | ||
``` | ||
### one_space | ||
```css | ||
.foo { | ||
color: rgb(255, 255, 255); | ||
} | ||
``` | ||
## spaceAfterPropertyColon | ||
@@ -414,2 +492,44 @@ Each colon in property declarations should be followed by a space to aid readability. | ||
## spaceBeforeComma | ||
Each comma in functions, mixins, etc. shouldn't be preceded by any space. | ||
Option | Description | ||
---------- | ---------- | ||
`style` | `no_space` (**default**), `one_space` | ||
### no_space | ||
```css | ||
.foo { | ||
color: rgb(255, 255, 255); | ||
} | ||
``` | ||
### one_space | ||
```css | ||
.foo { | ||
color: rgb(255 , 255 , 255); | ||
} | ||
``` | ||
## spaceBetweenParens | ||
There shouldn't be any space before or after parentheses. | ||
Option | Description | ||
---------- | ---------- | ||
`style` | `no_space` (**default**), `one_space` | ||
### no_space | ||
```css | ||
.foo { | ||
color: rgb(255, 255, 255); | ||
} | ||
``` | ||
### one_space | ||
```css | ||
.foo { | ||
color: rgb( 255, 255, 255 ); | ||
} | ||
``` | ||
## stringQuotes | ||
@@ -416,0 +536,0 @@ All strings should use single quotes since they are often easier to type since the `Shift` key doesn't need to be pressed. |
@@ -32,3 +32,3 @@ 'use strict'; | ||
case 'no_space': | ||
if (maybeSpace && maybeSpace.type === 'space') { | ||
if (maybeSpace.type === 'space') { | ||
message = 'Colon after property name should not be followed by any spaces.'; | ||
@@ -39,3 +39,3 @@ } | ||
case 'one_space': | ||
if (maybeSpace && (maybeSpace.type !== 'space' || (maybeSpace.type === 'space' && maybeSpace.content !== ' '))) { | ||
if (maybeSpace.type !== 'space' || (maybeSpace.type === 'space' && maybeSpace.content !== ' ')) { | ||
message = 'Colon after property name should be followed by one space.'; | ||
@@ -61,3 +61,3 @@ } | ||
return true; | ||
return null; | ||
}; |
@@ -32,3 +32,3 @@ 'use strict'; | ||
case 'no_space': | ||
if (maybeSpace && maybeSpace.type === 'space') { | ||
if (maybeSpace.type === 'space') { | ||
message = 'Colon after property should not be preceded by any space.'; | ||
@@ -39,3 +39,3 @@ } | ||
case 'one_space': | ||
if (maybeSpace && (maybeSpace.type !== 'space' || (maybeSpace.type === 'space' && maybeSpace.content !== ' '))) { | ||
if (maybeSpace.type !== 'space' || (maybeSpace.type === 'space' && maybeSpace.content !== ' ')) { | ||
message = 'Colon after property should be preceded by one space.'; | ||
@@ -61,3 +61,3 @@ } | ||
return true; | ||
return null; | ||
}; |
'use strict'; | ||
var findIndex = require('lodash.findindex'); | ||
var path = require('path'); | ||
@@ -10,5 +9,3 @@ | ||
var node = options.node; | ||
var checkIndex; | ||
var maybeSpace; | ||
var message; | ||
var errors = []; | ||
@@ -25,38 +22,46 @@ // Bail if the linter isn't wanted | ||
// Find the colon | ||
checkIndex = findIndex(node.content, function (element) { | ||
return (element.type === 'declarationDelimiter'); | ||
}); | ||
node.forEach('declarationDelimiter', function (element, index) { | ||
var maybeSpace = node.get(index - 1); | ||
maybeSpace = node.content[checkIndex - 1]; | ||
switch (config.spaceAfterPropertyValue.style) { | ||
case 'no_space': | ||
if (maybeSpace && maybeSpace.type === 'space') { | ||
message = 'Semicolon after property value should not be preceded by any space.'; | ||
} | ||
switch (config.spaceAfterPropertyValue.style) { | ||
case 'no_space': | ||
if (maybeSpace.type === 'space') { | ||
errors.push({ | ||
column: maybeSpace.start.column, | ||
line: maybeSpace.start.line, | ||
message: 'Semicolon after property value should not be preceded by any space.' | ||
}); | ||
} | ||
break; | ||
case 'one_space': | ||
if (maybeSpace && (maybeSpace.type !== 'space' || (maybeSpace.type === 'space' && maybeSpace.content !== ' '))) { | ||
message = 'Semicolon after property value should be preceded by one space.'; | ||
} | ||
break; | ||
case 'one_space': | ||
if (maybeSpace.type !== 'space' || (maybeSpace.type === 'space' && maybeSpace.content !== ' ')) { | ||
errors.push({ | ||
column: maybeSpace.start.column, | ||
line: maybeSpace.start.line, | ||
message: 'Semicolon after property value should be preceded by one space.' | ||
}); | ||
} | ||
break; | ||
default: | ||
throw new Error( | ||
'Invalid setting value for spaceAfterPropertyValue: ' + config.spaceAfterPropertyValue.style | ||
); | ||
} | ||
break; | ||
default: | ||
throw new Error( | ||
'Invalid setting value for spaceAfterPropertyValue: ' + config.spaceAfterPropertyValue.style | ||
); | ||
} | ||
}); | ||
if (message) { | ||
return { | ||
column: maybeSpace.start.column, | ||
file: filename, | ||
line: maybeSpace.start.line, | ||
linter: 'spaceAfterPropertyValue', | ||
message: message | ||
}; | ||
if (errors.length) { | ||
return errors.map(function (error) { | ||
return { | ||
column: error.column, | ||
file: filename, | ||
line: error.line, | ||
linter: 'spaceAfterPropertyValue', | ||
message: error.message | ||
}; | ||
}); | ||
} | ||
return true; | ||
return null; | ||
}; |
@@ -65,3 +65,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
node.map(function (element) { | ||
node.traverse(function (element) { | ||
if (element.type !== 'string') { | ||
@@ -67,3 +67,3 @@ return; | ||
return true; | ||
return null; | ||
}; |
@@ -11,3 +11,2 @@ 'use strict'; | ||
var checkIndex; | ||
var property; | ||
var start; | ||
@@ -30,8 +29,3 @@ | ||
// No declarations found, bail | ||
if (checkIndex === -1) { | ||
return null; | ||
} | ||
if (!node.first('declarationDelimiter')) { | ||
if (checkIndex !== -1 && !node.first('declarationDelimiter')) { | ||
start = node.content[node.content.length - 1].start; | ||
@@ -48,3 +42,3 @@ | ||
return true; | ||
return null; | ||
}; |
@@ -24,7 +24,3 @@ 'use strict'; | ||
node.content.forEach(function (element) { | ||
if (element.type !== 'value') { | ||
return; | ||
} | ||
node.forEach('value', function (element) { | ||
value = element.first('dimension'); | ||
@@ -70,3 +66,3 @@ value = value && value.first('number'); | ||
return true; | ||
return null; | ||
}; |
@@ -64,3 +64,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -44,3 +44,3 @@ 'use strict'; | ||
return true; | ||
return null; | ||
}; |
@@ -25,7 +25,3 @@ 'use strict'; | ||
node.content.forEach(function (element) { | ||
if (element.type !== 'value') { | ||
return; | ||
} | ||
node.forEach('value', function (element) { | ||
value = element.first('dimension'); | ||
@@ -84,3 +80,3 @@ | ||
return true; | ||
return null; | ||
}; |
{ | ||
"name": "lesshint", | ||
"description": "A tool to aid you in writing clean and consistent Less.", | ||
"version": "0.7.0-beta2", | ||
"version": "0.7.0-beta3", | ||
"main": "./lib/lesshint.js", | ||
@@ -23,3 +23,3 @@ "author": { | ||
"exit": "^0.1.2", | ||
"gonzales-pe": "3.0.0-29", | ||
"gonzales-pe": "3.0.0-30", | ||
"lodash.findindex": "^3.2.1", | ||
@@ -49,3 +49,3 @@ "lodash.flatten": "^3.0.2", | ||
"cover": "istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec test/specs && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"pretest": "jshint lib && jscs lib", | ||
"pretest": "jshint lib test && jscs lib test", | ||
"test": "mocha" | ||
@@ -52,0 +52,0 @@ }, |
@@ -61,3 +61,3 @@ # lesshint | ||
``` | ||
```js | ||
"fileExtensions": [".less", ".css"] // Allow ".less" and ".css" files. Can be passed with or without a dot. | ||
@@ -71,3 +71,3 @@ | ||
``` | ||
```js | ||
"excludedFiles": ["vendor/*.less"] // Ignore all files in "vendor/" | ||
@@ -94,3 +94,4 @@ | ||
* Not all forms of `:extend()` rules are supported. Related [issue](https://github.com/tonyganch/gonzales-pe/issues/15). | ||
* Using variables in `@media` directives are not supported. Related [issue](https://github.com/tonyganch/gonzales-pe/issues/17). | ||
* Using variables in selectors are not supported. Related [issue](https://github.com/tonyganch/gonzales-pe/issues/75). | ||
* Using double parentheses around calculations etc. are not supported. Related [issue](https://github.com/tonyganch/gonzales-pe/issues/76). |
@@ -9,3 +9,3 @@ var assert = require('assert'); | ||
beforeEach(function() { | ||
beforeEach(function () { | ||
sinon.stub(process.stdout, 'write'); | ||
@@ -12,0 +12,0 @@ sinon.stub(process.stderr, 'write'); |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, attributeQuotes({ | ||
assert.strictEqual(null, attributeQuotes({ | ||
config: options, | ||
@@ -107,3 +107,3 @@ node: ast | ||
assert.strictEqual(true, attributeQuotes({ | ||
assert.strictEqual(null, attributeQuotes({ | ||
config: options, | ||
@@ -110,0 +110,0 @@ node: ast |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, borderZero({ | ||
assert.strictEqual(null, borderZero({ | ||
config: options, | ||
@@ -43,3 +43,3 @@ node: ast | ||
assert.strictEqual(true, borderZero({ | ||
assert.strictEqual(null, borderZero({ | ||
config: options, | ||
@@ -128,3 +128,3 @@ node: ast | ||
assert.strictEqual(true, borderZero({ | ||
assert.strictEqual(null, borderZero({ | ||
config: options, | ||
@@ -149,3 +149,3 @@ node: ast | ||
assert.strictEqual(true, borderZero({ | ||
assert.strictEqual(null, borderZero({ | ||
config: options, | ||
@@ -170,3 +170,3 @@ node: ast | ||
assert.strictEqual(true, borderZero({ | ||
assert.strictEqual(null, borderZero({ | ||
config: options, | ||
@@ -191,3 +191,3 @@ node: ast | ||
assert.strictEqual(true, borderZero({ | ||
assert.strictEqual(null, borderZero({ | ||
config: options, | ||
@@ -194,0 +194,0 @@ node: ast |
@@ -9,3 +9,3 @@ var assert = require('assert'); | ||
it('should allow single line comments', function () { | ||
var source = "// Hello world"; | ||
var source = '// Hello world'; | ||
var ast; | ||
@@ -58,3 +58,3 @@ | ||
it('should allow comments matching "allowed" option regexp', function () { | ||
var source = "/*! Hello world */"; | ||
var source = '/*! Hello world */'; | ||
var ast; | ||
@@ -71,3 +71,3 @@ | ||
assert.strictEqual(true, comment({ | ||
assert.strictEqual(null, comment({ | ||
config: options, | ||
@@ -74,0 +74,0 @@ node: ast |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, duplicateProperty({ | ||
assert.strictEqual(null, duplicateProperty({ | ||
config: options, | ||
@@ -75,3 +75,3 @@ node: ast | ||
assert.strictEqual(true, duplicateProperty({ | ||
assert.strictEqual(null, duplicateProperty({ | ||
config: options, | ||
@@ -78,0 +78,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, emptyRule({ | ||
assert.strictEqual(null, emptyRule({ | ||
config: options, | ||
@@ -59,2 +59,33 @@ node: ast | ||
it('should not allow empty rules with a space', function () { | ||
var source = '.foo { }'; | ||
var actual; | ||
var ast; | ||
var expected = { | ||
column: 1, | ||
file: 'test.less', | ||
line: 1, | ||
linter: 'emptyRule', | ||
message: 'There shouldn\'t be any empty rules present.' | ||
}; | ||
var options = { | ||
emptyRule: { | ||
enabled: true | ||
} | ||
}; | ||
ast = linter.parseAST(source); | ||
ast = ast.first(); | ||
actual = emptyRule({ | ||
config: options, | ||
node: ast, | ||
path: 'test.less' | ||
}); | ||
assert.deepEqual(actual, expected); | ||
}); | ||
it('should allow rules with only mixins (#16)', function () { | ||
@@ -73,3 +104,3 @@ var source = '.foo { .mixin(); }'; | ||
assert.strictEqual(true, emptyRule({ | ||
assert.strictEqual(null, emptyRule({ | ||
config: options, | ||
@@ -76,0 +107,0 @@ node: ast |
@@ -20,3 +20,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, finalNewline({ | ||
assert.strictEqual(null, finalNewline({ | ||
config: options, | ||
@@ -23,0 +23,0 @@ node: ast |
@@ -54,3 +54,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, hexLength({ | ||
assert.strictEqual(null, hexLength({ | ||
config: options, | ||
@@ -107,3 +107,3 @@ node: ast | ||
assert.strictEqual(true, hexLength({ | ||
assert.strictEqual(null, hexLength({ | ||
config: options, | ||
@@ -128,3 +128,3 @@ node: ast | ||
assert.strictEqual(true, hexLength({ | ||
assert.strictEqual(null, hexLength({ | ||
config: options, | ||
@@ -264,3 +264,3 @@ node: ast | ||
assert.strictEqual(true, hexLength({ | ||
assert.strictEqual(null, hexLength({ | ||
config: options, | ||
@@ -267,0 +267,0 @@ node: ast |
@@ -54,3 +54,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, hexNotation({ | ||
assert.strictEqual(null, hexNotation({ | ||
config: options, | ||
@@ -107,3 +107,3 @@ node: ast | ||
assert.strictEqual(true, hexNotation({ | ||
assert.strictEqual(null, hexNotation({ | ||
config: options, | ||
@@ -243,3 +243,3 @@ node: ast | ||
assert.strictEqual(true, hexNotation({ | ||
assert.strictEqual(null, hexNotation({ | ||
config: options, | ||
@@ -264,3 +264,3 @@ node: ast | ||
assert.strictEqual(true, hexNotation({ | ||
assert.strictEqual(null, hexNotation({ | ||
config: options, | ||
@@ -267,0 +267,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, hexValidation({ | ||
assert.strictEqual(null, hexValidation({ | ||
config: options, | ||
@@ -24,0 +24,0 @@ node: ast |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, idSelector({ | ||
assert.strictEqual(null, idSelector({ | ||
config: options, | ||
@@ -75,3 +75,3 @@ node: ast | ||
assert.strictEqual(true, idSelector({ | ||
assert.strictEqual(null, idSelector({ | ||
config: options, | ||
@@ -96,3 +96,3 @@ node: ast | ||
assert.strictEqual(true, idSelector({ | ||
assert.strictEqual(null, idSelector({ | ||
config: options, | ||
@@ -99,0 +99,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, importantRule({ | ||
assert.strictEqual(null, importantRule({ | ||
config: options, | ||
@@ -24,0 +24,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.equal(true, leadingZero({ | ||
assert.equal(null, leadingZero({ | ||
config: options, | ||
@@ -73,3 +73,3 @@ node: ast | ||
assert.equal(true, leadingZero({ | ||
assert.equal(null, leadingZero({ | ||
config: options, | ||
@@ -76,0 +76,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, qualifyingElement({ | ||
assert.strictEqual(null, qualifyingElement({ | ||
config: options, | ||
@@ -135,3 +135,3 @@ node: ast | ||
assert.strictEqual(true, qualifyingElement({ | ||
assert.strictEqual(null, qualifyingElement({ | ||
config: options, | ||
@@ -156,3 +156,3 @@ node: ast | ||
assert.strictEqual(true, qualifyingElement({ | ||
assert.strictEqual(null, qualifyingElement({ | ||
config: options, | ||
@@ -177,3 +177,3 @@ node: ast | ||
assert.strictEqual(true, qualifyingElement({ | ||
assert.strictEqual(null, qualifyingElement({ | ||
config: options, | ||
@@ -180,0 +180,0 @@ node: ast |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, spaceAfterPropertyColon({ | ||
assert.strictEqual(null, spaceAfterPropertyColon({ | ||
config: options, | ||
@@ -107,3 +107,3 @@ node: ast | ||
assert.strictEqual(true, spaceAfterPropertyColon({ | ||
assert.strictEqual(null, spaceAfterPropertyColon({ | ||
config: options, | ||
@@ -218,3 +218,3 @@ node: ast | ||
enabled: true, | ||
style: "invalid" | ||
style: 'invalid' | ||
} | ||
@@ -221,0 +221,0 @@ }; |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, spaceAfterPropertyName({ | ||
assert.strictEqual(null, spaceAfterPropertyName({ | ||
config: options, | ||
@@ -75,3 +75,3 @@ node: ast | ||
assert.strictEqual(true, spaceAfterPropertyName({ | ||
assert.strictEqual(null, spaceAfterPropertyName({ | ||
config: options, | ||
@@ -154,3 +154,3 @@ node: ast | ||
enabled: true, | ||
style: "invalid" | ||
style: 'invalid' | ||
} | ||
@@ -157,0 +157,0 @@ }; |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, spaceAfterPropertyValue({ | ||
assert.strictEqual(null, spaceAfterPropertyValue({ | ||
config: options, | ||
@@ -34,3 +34,3 @@ node: ast | ||
var expected = { | ||
var expected = [{ | ||
column: 18, | ||
@@ -41,3 +41,3 @@ file: 'test.less', | ||
message: 'Semicolon after property value should not be preceded by any space.' | ||
}; | ||
}]; | ||
@@ -77,3 +77,3 @@ var options = { | ||
assert.strictEqual(true, spaceAfterPropertyValue({ | ||
assert.strictEqual(null, spaceAfterPropertyValue({ | ||
config: options, | ||
@@ -89,3 +89,3 @@ node: ast | ||
var expected = { | ||
var expected = [{ | ||
column: 8, | ||
@@ -96,7 +96,85 @@ file: 'test.less', | ||
message: 'Semicolon after property value should be preceded by one space.' | ||
}]; | ||
var options = { | ||
spaceAfterPropertyValue: { | ||
enabled: true, | ||
style: 'one_space' | ||
} | ||
}; | ||
ast = linter.parseAST(source); | ||
ast = ast.first().first('block'); | ||
actual = spaceAfterPropertyValue({ | ||
config: options, | ||
node: ast, | ||
path: 'test.less' | ||
}); | ||
assert.deepEqual(actual, expected); | ||
}); | ||
it('should not allow any space on multiple property values when "style" is "no_space"', function () { | ||
var source = '.foo { color: red ; margin-right: 10px ; }'; | ||
var actual; | ||
var ast; | ||
var expected = [{ | ||
column: 18, | ||
file: 'test.less', | ||
line: 1, | ||
linter: 'spaceAfterPropertyValue', | ||
message: 'Semicolon after property value should not be preceded by any space.', | ||
}, | ||
{ | ||
column: 39, | ||
file: 'test.less', | ||
line: 1, | ||
linter: 'spaceAfterPropertyValue', | ||
message: 'Semicolon after property value should not be preceded by any space.' | ||
}]; | ||
var options = { | ||
spaceAfterPropertyValue: { | ||
enabled: true, | ||
style: 'no_space' | ||
} | ||
}; | ||
ast = linter.parseAST(source); | ||
ast = ast.first().first('block'); | ||
actual = spaceAfterPropertyValue({ | ||
config: options, | ||
node: ast, | ||
path: 'test.less' | ||
}); | ||
assert.deepEqual(actual, expected); | ||
}); | ||
it('should not allow a missing space on multiple property values when "style" is "one_space"', function () { | ||
var source = '.foo { color: red; margin-right: 10px; }'; | ||
var actual; | ||
var ast; | ||
var expected = [{ | ||
column: 8, | ||
file: 'test.less', | ||
line: 1, | ||
linter: 'spaceAfterPropertyValue', | ||
message: 'Semicolon after property value should be preceded by one space.' | ||
}, | ||
{ | ||
column: 20, | ||
file: 'test.less', | ||
line: 1, | ||
linter: 'spaceAfterPropertyValue', | ||
message: 'Semicolon after property value should be preceded by one space.' | ||
}]; | ||
var options = { | ||
spaceAfterPropertyValue: { | ||
enabled: true, | ||
style: 'one_space' | ||
@@ -158,3 +236,3 @@ } | ||
enabled: true, | ||
style: "invalid" | ||
style: 'invalid' | ||
} | ||
@@ -161,0 +239,0 @@ }; |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, spaceBeforeBrace({ | ||
assert.strictEqual(null, spaceBeforeBrace({ | ||
config: options, | ||
@@ -167,3 +167,3 @@ node: ast | ||
assert.strictEqual(true, spaceBeforeBrace({ | ||
assert.strictEqual(null, spaceBeforeBrace({ | ||
config: options, | ||
@@ -219,3 +219,3 @@ node: ast | ||
assert.strictEqual(true, spaceBeforeBrace({ | ||
assert.strictEqual(null, spaceBeforeBrace({ | ||
config: options, | ||
@@ -333,3 +333,3 @@ node: ast | ||
assert.strictEqual(true, spaceBeforeBrace({ | ||
assert.strictEqual(null, spaceBeforeBrace({ | ||
config: options, | ||
@@ -354,3 +354,3 @@ node: ast | ||
assert.strictEqual(true, spaceBeforeBrace({ | ||
assert.strictEqual(null, spaceBeforeBrace({ | ||
config: options, | ||
@@ -437,3 +437,3 @@ node: ast | ||
assert.strictEqual(true, spaceBeforeBrace({ | ||
assert.strictEqual(null, spaceBeforeBrace({ | ||
config: options, | ||
@@ -484,3 +484,3 @@ node: ast | ||
enabled: true, | ||
style: "invalid" | ||
style: 'invalid' | ||
} | ||
@@ -487,0 +487,0 @@ }; |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, stringQuotes({ | ||
assert.strictEqual(null, stringQuotes({ | ||
config: options, | ||
@@ -72,3 +72,3 @@ node: ast | ||
assert.strictEqual(true, stringQuotes({ | ||
assert.strictEqual(null, stringQuotes({ | ||
config: options, | ||
@@ -123,3 +123,3 @@ node: ast | ||
assert.strictEqual(true, stringQuotes({ | ||
assert.strictEqual(null, stringQuotes({ | ||
config: options, | ||
@@ -143,3 +143,3 @@ node: ast | ||
assert.strictEqual(true, stringQuotes({ | ||
assert.strictEqual(null, stringQuotes({ | ||
config: options, | ||
@@ -163,3 +163,3 @@ node: ast | ||
assert.strictEqual(true, stringQuotes({ | ||
assert.strictEqual(null, stringQuotes({ | ||
config: options, | ||
@@ -214,3 +214,3 @@ node: ast | ||
assert.strictEqual(true, stringQuotes({ | ||
assert.strictEqual(null, stringQuotes({ | ||
config: options, | ||
@@ -217,0 +217,0 @@ node: ast |
@@ -51,3 +51,3 @@ var assert = require('assert'); | ||
assert.equal(true, trailingSemicolon({ | ||
assert.equal(null, trailingSemicolon({ | ||
config: options, | ||
@@ -106,3 +106,3 @@ node: ast | ||
assert.equal(true, trailingSemicolon({ | ||
assert.equal(null, trailingSemicolon({ | ||
config: options, | ||
@@ -125,3 +125,3 @@ node: ast | ||
assert.equal(true, trailingSemicolon({ | ||
assert.equal(null, trailingSemicolon({ | ||
config: options, | ||
@@ -128,0 +128,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.equal(true, trailingZero({ | ||
assert.equal(null, trailingZero({ | ||
config: options, | ||
@@ -73,3 +73,3 @@ node: ast | ||
assert.equal(true, trailingZero({ | ||
assert.equal(null, trailingZero({ | ||
config: options, | ||
@@ -125,3 +125,3 @@ node: ast | ||
assert.equal(true, trailingZero({ | ||
assert.equal(null, trailingZero({ | ||
config: options, | ||
@@ -128,0 +128,0 @@ node: ast |
@@ -22,3 +22,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -75,3 +75,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -160,3 +160,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -181,3 +181,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -202,3 +202,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -223,3 +223,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -244,3 +244,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -265,3 +265,3 @@ node: ast | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -273,3 +273,3 @@ node: ast | ||
it('should handle unquoted URLs surrounded by spaces (#22)', function () { | ||
var source = ".foo { background-image: url( img/image.jpg ); }"; | ||
var source = '.foo { background-image: url( img/image.jpg ); }'; | ||
var ast; | ||
@@ -287,3 +287,3 @@ | ||
assert.strictEqual(true, urlFormat({ | ||
assert.strictEqual(null, urlFormat({ | ||
config: options, | ||
@@ -290,0 +290,0 @@ node: ast |
@@ -21,3 +21,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, urlQuotes({ | ||
assert.strictEqual(null, urlQuotes({ | ||
config: options, | ||
@@ -41,3 +41,3 @@ node: ast | ||
assert.strictEqual(true, urlQuotes({ | ||
assert.strictEqual(null, urlQuotes({ | ||
config: options, | ||
@@ -92,3 +92,3 @@ node: ast | ||
assert.strictEqual(true, urlQuotes({ | ||
assert.strictEqual(null, urlQuotes({ | ||
config: options, | ||
@@ -95,0 +95,0 @@ node: ast |
@@ -54,3 +54,3 @@ var assert = require('assert'); | ||
assert.strictEqual(true, zeroUnit({ | ||
assert.strictEqual(null, zeroUnit({ | ||
config: options, | ||
@@ -75,3 +75,3 @@ node: ast | ||
assert.strictEqual(true, zeroUnit({ | ||
assert.strictEqual(null, zeroUnit({ | ||
config: options, | ||
@@ -78,0 +78,0 @@ node: ast |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
313935
87
8137
95
+ Addedgonzales-pe@3.0.0-30(transitive)
- Removedgonzales-pe@3.0.0-29(transitive)
Updatedgonzales-pe@3.0.0-30