Skip to content

Commit

Permalink
Include property name in propertyOrdering message (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiross authored and jwilsson committed Oct 24, 2018
1 parent 585b4af commit 23d1324
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
10 changes: 2 additions & 8 deletions lib/linters/property_ordering.js
Expand Up @@ -6,7 +6,7 @@ const util = require('util');
module.exports = {
name: 'propertyOrdering',
nodeTypes: ['atrule', 'rule'],
message: 'Property ordering is not %s',
message: '"%s" should be before "%s"',

lint: function propertyOrderingLinter (config, node) {
let ordering;
Expand Down Expand Up @@ -49,16 +49,10 @@ module.exports = {
}

if (report) {
let mode = config.style;

if (config.style === 'alpha') {
mode = 'alphabetized';
}

results.push({
column: child.source.start.column,
line: child.source.start.line,
message: util.format(this.message, mode)
message: util.format(this.message, currentProperty, previousProp)
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/specs/linter.js
Expand Up @@ -119,7 +119,7 @@ describe('linter', function () {
fullPath: testPath,
line: 3,
linter: 'propertyOrdering',
message: 'Property ordering is not alphabetized',
message: '"color" should be before "margin-right"',
position: 50,
severity: 'warning',
source: 'color: red;'
Expand Down
12 changes: 6 additions & 6 deletions test/specs/linters/property_ordering.js
Expand Up @@ -60,7 +60,7 @@ describe('lesshint', function () {
const expected = [{
column: 26,
line: 1,
message: 'Property ordering is not alphabetized'
message: '"color" should be before "padding-top"'
}];

return spec.parse(source, function (ast) {
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('lesshint', function () {
const expected = [{
column: 31,
line: 1,
message: 'Property ordering is not alphabetized'
message: '"color" should be before "opacity"'
}];

return spec.parse(source, function (ast) {
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('lesshint', function () {
const expected = [{
column: 37,
line: 1,
message: 'Property ordering is not concentric',
message: '"right" should be before "color"',
}];

return spec.parse(source, function (ast) {
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('lesshint', function () {
const expected = [{
column: 31,
line: 1,
message: 'Property ordering is not concentric',
message: '"opacity" should be before "color"',
}];

return spec.parse(source, function (ast) {
Expand All @@ -222,7 +222,7 @@ describe('lesshint', function () {
const expected = [{
column: 31,
line: 1,
message: 'Property ordering is not concentric',
message: '"bar" should be before "foo"',
}];

return spec.parse(source, function (ast) {
Expand All @@ -237,7 +237,7 @@ describe('lesshint', function () {
const expected = [{
column: 17,
line: 1,
message: 'Property ordering is not concentric',
message: '"display" should be before "foo"',
}];

return spec.parse(source, function (ast) {
Expand Down

0 comments on commit 23d1324

Please sign in to comment.