Skip to content

Commit

Permalink
fix: use locator
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Feb 23, 2023
1 parent bd8ee1e commit 84dd56d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/textlint-rule-max-comma.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const defaultOptions = {
};
export default function (context, options = defaultOptions) {
const maxComma = options.max || defaultOptions.max;
const { Syntax, RuleError, report } = context;
const { Syntax, RuleError, report, locator } = context;
return {
[Syntax.Paragraph](node) {
const paragraphSentence = splitAST(node)
Expand All @@ -34,7 +34,7 @@ export default function (context, options = defaultOptions) {
if (count > maxComma) {
const lastCommandIndex = sentenceValue.lastIndexOf(",");
report(node, new RuleError(`This sentence exceeds the maximum count of comma. Maximum is ${maxComma}.`, {
index: source.originalIndexFromIndex(lastCommandIndex)
padding: locator.at(source.originalIndexFromIndex(lastCommandIndex))
}));
}
});
Expand Down

0 comments on commit 84dd56d

Please sign in to comment.