Skip to content

Commit

Permalink
fix: add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Feb 12, 2023
1 parent 3d9d7cd commit 1b75a7a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sentence-length.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const defaultOptions: Required<Options> = {

const reporter: TextlintRuleReporter<Options> = (context, options = {}) => {
const maxLength = options.max ?? defaultOptions.max;
const skipPatterns = options.skipPatterns ?? options.exclusionPatterns ?? defaultOptions.skipPatterns;
const skipPatterns = options.skipPatterns ?? options.skipPatterns ?? defaultOptions.skipPatterns;
const skipUrlStringLink = options.skipUrlStringLink ?? defaultOptions.skipUrlStringLink;
const helper = new RuleHelper(context);
const { Syntax, RuleError, report } = context;
Expand All @@ -61,9 +61,13 @@ const reporter: TextlintRuleReporter<Options> = (context, options = {}) => {
const nodeText = new StringSource(linkNode).toString();
return node.url === nodeText;
};

// toPlainText
return {
[Syntax.Document](node) {
if (options.exclusionPatterns) {
report(node, new RuleError("exclusionPatterns is deprecated. Use skipPatterns instead."));
}
},
[Syntax.Paragraph](node) {
if (helper.isChildNode(node, [Syntax.BlockQuote])) {
return;
Expand Down

0 comments on commit 1b75a7a

Please sign in to comment.