From cbd8cc33d5cdcfdcb37274dcec8c13e89dd55d5b Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Fri, 10 Feb 2017 17:50:12 +0300 Subject: [PATCH] Fixed: `max-line-length` rule is now reported correct column for `SASS` comments. --- lib/rules/max-line-length/__tests__/index.js | 18 ++++++++++++++++++ lib/rules/max-line-length/index.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/rules/max-line-length/__tests__/index.js b/lib/rules/max-line-length/__tests__/index.js index 0a1530a247..3ddad70e3d 100644 --- a/lib/rules/max-line-length/__tests__/index.js +++ b/lib/rules/max-line-length/__tests__/index.js @@ -97,9 +97,27 @@ testRule(rule, { message: messages.expected(20), line: 1, column: 48, + }, { + code: "a {\n /* Lorem ipsum dolor sit amet. The comment Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium officia fugiat unde deserunt sit, tenetur! Incidunt similique blanditiis placeat ad quia possimus libero, reiciendis excepturi non esse deserunt a odit. */\n}", + message: messages.expected(20), + line: 2, + column: 272, } ], }) +testRule(rule, { + ruleName, + syntax: "scss", + config: [20], + + reject: [{ + code: "a {\n // Lorem ipsum dolor sit amet. The comment Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium officia fugiat unde deserunt sit, tenetur! Incidunt similique blanditiis placeat ad quia possimus libero, reiciendis excepturi non esse deserunt a odit.\n}", + message: messages.expected(20), + line: 2, + column: 269, + }], +}) + testRule(rule, { ruleName, config: [30], diff --git a/lib/rules/max-line-length/index.js b/lib/rules/max-line-length/index.js index e0ec94db35..128317d904 100644 --- a/lib/rules/max-line-length/index.js +++ b/lib/rules/max-line-length/index.js @@ -33,7 +33,7 @@ const rule = function (maxLength, options) { return } - const rootString = root.toString() + const rootString = root.source.input.css const ignoreNonComments = optionsMatches(options, "ignore", "non-comments") const ignoreComments = optionsMatches(options, "ignore", "comments")