Skip to content

Commit 1b75a7a

Browse files
committed
fix: add deprecation warning
1 parent 3d9d7cd commit 1b75a7a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sentence-length.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const defaultOptions: Required<Options> = {
4949

5050
const reporter: TextlintRuleReporter<Options> = (context, options = {}) => {
5151
const maxLength = options.max ?? defaultOptions.max;
52-
const skipPatterns = options.skipPatterns ?? options.exclusionPatterns ?? defaultOptions.skipPatterns;
52+
const skipPatterns = options.skipPatterns ?? options.skipPatterns ?? defaultOptions.skipPatterns;
5353
const skipUrlStringLink = options.skipUrlStringLink ?? defaultOptions.skipUrlStringLink;
5454
const helper = new RuleHelper(context);
5555
const { Syntax, RuleError, report } = context;
@@ -61,9 +61,13 @@ const reporter: TextlintRuleReporter<Options> = (context, options = {}) => {
6161
const nodeText = new StringSource(linkNode).toString();
6262
return node.url === nodeText;
6363
};
64-
6564
// toPlainText
6665
return {
66+
[Syntax.Document](node) {
67+
if (options.exclusionPatterns) {
68+
report(node, new RuleError("exclusionPatterns is deprecated. Use skipPatterns instead."));
69+
}
70+
},
6771
[Syntax.Paragraph](node) {
6872
if (helper.isChildNode(node, [Syntax.BlockQuote])) {
6973
return;

0 commit comments

Comments
 (0)