diff --git a/src/rules/at-function-pattern/__tests__/index.js b/src/rules/at-function-pattern/__tests__/index.js index e86f724d..c48bfddf 100644 --- a/src/rules/at-function-pattern/__tests__/index.js +++ b/src/rules/at-function-pattern/__tests__/index.js @@ -77,6 +77,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: sequence part. Example: symbol in between." } @@ -120,6 +123,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "String: sequence part. Example: symbol in between." }, @@ -129,6 +135,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "String: sequence part. Example: not a full sequence." } @@ -191,6 +200,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: matches at the end." }, @@ -200,6 +212,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: matches at the beginning." }, @@ -209,6 +224,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: symbol in between." }, @@ -220,6 +238,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: function name divided by newlines." @@ -258,6 +279,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: pattern at the beginning. Example: matches at the end." @@ -268,6 +292,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: pattern at the beginning. Example: symbol in between." @@ -296,6 +323,9 @@ testRule({ { code: "@function boo-Foo-bar ( $p) {}", line: 1, + column: 1, + endLine: 2, + endColumn: 0, message: messages.expected, description: "Regexp: SUIT component. Example: starts with lowercase, two elements" @@ -303,12 +333,18 @@ testRule({ { code: "@function foo-bar ($p) {}", line: 1, + column: 1, + endLine: 2, + endColumn: 0, message: messages.expected, description: "Regexp: SUIT component. Example: starts with lowercase" }, { code: "@function Foo-Bar ($p) {}", line: 1, + column: 1, + endLine: 2, + endColumn: 0, message: messages.expected, description: "Regexp: SUIT component. Example: element starts with uppercase" diff --git a/src/rules/at-function-pattern/index.js b/src/rules/at-function-pattern/index.js index 68e33f8b..882e1eb2 100644 --- a/src/rules/at-function-pattern/index.js +++ b/src/rules/at-function-pattern/index.js @@ -37,11 +37,16 @@ export default function rule(pattern) { return; } + const funcTopLine = Object.assign({}, decl.source.start); + funcTopLine.line += 1; + funcTopLine.column = 0; + utils.report({ message: messages.expected, node: decl, result, - ruleName + ruleName, + end: funcTopLine }); }); }; diff --git a/src/rules/at-mixin-pattern/__tests__/index.js b/src/rules/at-mixin-pattern/__tests__/index.js index 588ee581..29ee1654 100644 --- a/src/rules/at-mixin-pattern/__tests__/index.js +++ b/src/rules/at-mixin-pattern/__tests__/index.js @@ -75,6 +75,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: sequence part. Example: symbol in between." } @@ -118,6 +121,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "String: sequence part. Example: symbol in between." }, @@ -127,6 +133,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "String: sequence part. Example: not a full sequence." } @@ -198,6 +207,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: matches at the end." }, @@ -207,6 +219,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: matches at the beginning." }, @@ -216,6 +231,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: symbol in between." }, @@ -227,6 +245,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: strict match. Example: mixin name divided by newlines." @@ -265,6 +286,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: pattern at the beginning. Example: matches at the end." @@ -275,6 +299,9 @@ testRule({ } `, line: 2, + column: 7, + endLine: 3, + endColumn: 0, message: messages.expected, description: "Regexp: pattern at the beginning. Example: symbol in between." @@ -303,6 +330,9 @@ testRule({ { code: "@mixin boo-Foo-bar ( $p) {}", line: 1, + column: 1, + endLine: 2, + endColumn: 0, message: messages.expected, description: "Regexp: SUIT component. Example: starts with lowercase, two elements" @@ -310,12 +340,18 @@ testRule({ { code: "@mixin foo-bar ($p) {}", line: 1, + column: 1, + endLine: 2, + endColumn: 0, message: messages.expected, description: "Regexp: SUIT component. Example: starts with lowercase" }, { code: "@mixin Foo-Bar ($p) {}", line: 1, + column: 1, + endLine: 2, + endColumn: 0, message: messages.expected, description: "Regexp: SUIT component. Example: element starts with uppercase" diff --git a/src/rules/at-mixin-pattern/index.js b/src/rules/at-mixin-pattern/index.js index f054707b..96d804a5 100644 --- a/src/rules/at-mixin-pattern/index.js +++ b/src/rules/at-mixin-pattern/index.js @@ -37,11 +37,16 @@ export default function rule(pattern) { return; } + const mixinTopLine = Object.assign({}, decl.source.start); + mixinTopLine.line += 1; + mixinTopLine.column = 0; + utils.report({ message: messages.expected, node: decl, result, - ruleName + ruleName, + end: mixinTopLine }); }); };