Skip to content

Commit

Permalink
Fix no-global-function-names end positions (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Dec 13, 2023
1 parent 29e1da3 commit 9716542
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/rules/no-global-function-names/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ testRule({
`,
line: 3,
column: 21,
endLine: 3,
endColumn: 24,
message: messages.rejected("red"),
description: "red"
},
Expand Down Expand Up @@ -471,7 +473,9 @@ testRule({
}
`,
line: 3,
column: 21,
column: 23,
endLine: 3,
endColumn: 35,
message: messages.rejected("change-color"),
description: "change-color"
},
Expand Down
5 changes: 2 additions & 3 deletions src/rules/no-global-function-names/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const valueParser = require("postcss-value-parser");
const { utils } = require("stylelint");
const declarationValueIndex = require("../../utils/declarationValueIndex");
const namespace = require("../../utils/namespace");
const ruleUrl = require("../../utils/ruleUrl");

Expand Down Expand Up @@ -182,11 +181,11 @@ function rule(value) {
return;
}

if (Object.keys(rules).includes(cleanValue)) {
if (rules[cleanValue]) {
utils.report({
message: messages.rejected(cleanValue),
node: decl,
index: declarationValueIndex(decl) + node.sourceIndex,
word: cleanValue,
result,
ruleName
});
Expand Down

0 comments on commit 9716542

Please sign in to comment.