eslint-markdown 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/core/utils/index.d.ts +2 -1
- package/build/core/utils/index.js +2 -1
- package/build/core/utils/normalize-regex-pattern.d.ts +11 -0
- package/build/core/utils/normalize-regex-pattern.js +16 -0
- package/build/index.d.ts +100 -20
- package/build/rules/allow-heading.d.ts +74 -14
- package/build/rules/allow-heading.js +8 -12
- package/build/rules/allow-image-url.d.ts +14 -4
- package/build/rules/allow-image-url.js +13 -5
- package/build/rules/allow-link-url.d.ts +14 -4
- package/build/rules/allow-link-url.js +13 -5
- package/build/rules/index.d.ts +100 -20
- package/build/rules/index.js +0 -2
- package/package.json +1 -1
- package/build/rules/no-bold-paragraph.d.ts +0 -30
- package/build/rules/no-bold-paragraph.js +0 -48
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import escapeStringRegexp from './escape-string-regexp.js';
|
|
2
2
|
import getElementsByTagName from './html.js';
|
|
3
3
|
import isBlankLine from './is-blank-line.js';
|
|
4
|
+
import normalizeRegexPattern from './normalize-regex-pattern.js';
|
|
4
5
|
import SkipRanges from './skip-ranges.js';
|
|
5
6
|
import testRegexStateless from './test-regex-stateless.js';
|
|
6
|
-
export { escapeStringRegexp, getElementsByTagName, isBlankLine, SkipRanges, testRegexStateless, };
|
|
7
|
+
export { escapeStringRegexp, getElementsByTagName, isBlankLine, normalizeRegexPattern, SkipRanges, testRegexStateless, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import escapeStringRegexp from './escape-string-regexp.js';
|
|
2
2
|
import getElementsByTagName from './html.js';
|
|
3
3
|
import isBlankLine from './is-blank-line.js';
|
|
4
|
+
import normalizeRegexPattern from './normalize-regex-pattern.js';
|
|
4
5
|
import SkipRanges from './skip-ranges.js';
|
|
5
6
|
import testRegexStateless from './test-regex-stateless.js';
|
|
6
|
-
export { escapeStringRegexp, getElementsByTagName, isBlankLine, SkipRanges, testRegexStateless, };
|
|
7
|
+
export { escapeStringRegexp, getElementsByTagName, isBlankLine, normalizeRegexPattern, SkipRanges, testRegexStateless, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Utility to normalize a pattern option into a `RegExp`.
|
|
3
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v73.0.0/rules/filename-case.js#L276-L282
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes a pattern option into a `RegExp`.
|
|
7
|
+
* String patterns are compiled with the `u` flag.
|
|
8
|
+
* @param pattern `RegExp` or string pattern to normalize.
|
|
9
|
+
* @returns The normalized `RegExp`.
|
|
10
|
+
*/
|
|
11
|
+
export default function normalizeRegexPattern(pattern: RegExp | string): RegExp;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Utility to normalize a pattern option into a `RegExp`.
|
|
3
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v73.0.0/rules/filename-case.js#L276-L282
|
|
4
|
+
*/
|
|
5
|
+
// --------------------------------------------------------------------------------
|
|
6
|
+
// Export
|
|
7
|
+
// --------------------------------------------------------------------------------
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes a pattern option into a `RegExp`.
|
|
10
|
+
* String patterns are compiled with the `u` flag.
|
|
11
|
+
* @param pattern `RegExp` or string pattern to normalize.
|
|
12
|
+
* @returns The normalized `RegExp`.
|
|
13
|
+
*/
|
|
14
|
+
export default function normalizeRegexPattern(pattern) {
|
|
15
|
+
return typeof pattern === 'string' ? new RegExp(pattern, 'u') : pattern;
|
|
16
|
+
}
|
package/build/index.d.ts
CHANGED
|
@@ -26,14 +26,24 @@ declare const plugin: {
|
|
|
26
26
|
readonly allow: {
|
|
27
27
|
readonly type: "array";
|
|
28
28
|
readonly items: {
|
|
29
|
-
readonly
|
|
29
|
+
readonly oneOf: readonly [{
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
readonly additionalProperties: false;
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
}];
|
|
30
35
|
};
|
|
31
36
|
readonly uniqueItems: true;
|
|
32
37
|
};
|
|
33
38
|
readonly disallow: {
|
|
34
39
|
readonly type: "array";
|
|
35
40
|
readonly items: {
|
|
36
|
-
readonly
|
|
41
|
+
readonly oneOf: readonly [{
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly additionalProperties: false;
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
}];
|
|
37
47
|
};
|
|
38
48
|
readonly uniqueItems: true;
|
|
39
49
|
};
|
|
@@ -46,14 +56,24 @@ declare const plugin: {
|
|
|
46
56
|
readonly allow: {
|
|
47
57
|
readonly type: "array";
|
|
48
58
|
readonly items: {
|
|
49
|
-
readonly
|
|
59
|
+
readonly oneOf: readonly [{
|
|
60
|
+
readonly type: "object";
|
|
61
|
+
readonly additionalProperties: false;
|
|
62
|
+
}, {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
}];
|
|
50
65
|
};
|
|
51
66
|
readonly uniqueItems: true;
|
|
52
67
|
};
|
|
53
68
|
readonly disallow: {
|
|
54
69
|
readonly type: "array";
|
|
55
70
|
readonly items: {
|
|
56
|
-
readonly
|
|
71
|
+
readonly oneOf: readonly [{
|
|
72
|
+
readonly type: "object";
|
|
73
|
+
readonly additionalProperties: false;
|
|
74
|
+
}, {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
}];
|
|
57
77
|
};
|
|
58
78
|
readonly uniqueItems: true;
|
|
59
79
|
};
|
|
@@ -66,14 +86,24 @@ declare const plugin: {
|
|
|
66
86
|
readonly allow: {
|
|
67
87
|
readonly type: "array";
|
|
68
88
|
readonly items: {
|
|
69
|
-
readonly
|
|
89
|
+
readonly oneOf: readonly [{
|
|
90
|
+
readonly type: "object";
|
|
91
|
+
readonly additionalProperties: false;
|
|
92
|
+
}, {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
}];
|
|
70
95
|
};
|
|
71
96
|
readonly uniqueItems: true;
|
|
72
97
|
};
|
|
73
98
|
readonly disallow: {
|
|
74
99
|
readonly type: "array";
|
|
75
100
|
readonly items: {
|
|
76
|
-
readonly
|
|
101
|
+
readonly oneOf: readonly [{
|
|
102
|
+
readonly type: "object";
|
|
103
|
+
readonly additionalProperties: false;
|
|
104
|
+
}, {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
}];
|
|
77
107
|
};
|
|
78
108
|
readonly uniqueItems: true;
|
|
79
109
|
};
|
|
@@ -86,14 +116,24 @@ declare const plugin: {
|
|
|
86
116
|
readonly allow: {
|
|
87
117
|
readonly type: "array";
|
|
88
118
|
readonly items: {
|
|
89
|
-
readonly
|
|
119
|
+
readonly oneOf: readonly [{
|
|
120
|
+
readonly type: "object";
|
|
121
|
+
readonly additionalProperties: false;
|
|
122
|
+
}, {
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
}];
|
|
90
125
|
};
|
|
91
126
|
readonly uniqueItems: true;
|
|
92
127
|
};
|
|
93
128
|
readonly disallow: {
|
|
94
129
|
readonly type: "array";
|
|
95
130
|
readonly items: {
|
|
96
|
-
readonly
|
|
131
|
+
readonly oneOf: readonly [{
|
|
132
|
+
readonly type: "object";
|
|
133
|
+
readonly additionalProperties: false;
|
|
134
|
+
}, {
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
}];
|
|
97
137
|
};
|
|
98
138
|
readonly uniqueItems: true;
|
|
99
139
|
};
|
|
@@ -106,14 +146,24 @@ declare const plugin: {
|
|
|
106
146
|
readonly allow: {
|
|
107
147
|
readonly type: "array";
|
|
108
148
|
readonly items: {
|
|
109
|
-
readonly
|
|
149
|
+
readonly oneOf: readonly [{
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly additionalProperties: false;
|
|
152
|
+
}, {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
}];
|
|
110
155
|
};
|
|
111
156
|
readonly uniqueItems: true;
|
|
112
157
|
};
|
|
113
158
|
readonly disallow: {
|
|
114
159
|
readonly type: "array";
|
|
115
160
|
readonly items: {
|
|
116
|
-
readonly
|
|
161
|
+
readonly oneOf: readonly [{
|
|
162
|
+
readonly type: "object";
|
|
163
|
+
readonly additionalProperties: false;
|
|
164
|
+
}, {
|
|
165
|
+
readonly type: "string";
|
|
166
|
+
}];
|
|
117
167
|
};
|
|
118
168
|
readonly uniqueItems: true;
|
|
119
169
|
};
|
|
@@ -126,14 +176,24 @@ declare const plugin: {
|
|
|
126
176
|
readonly allow: {
|
|
127
177
|
readonly type: "array";
|
|
128
178
|
readonly items: {
|
|
129
|
-
readonly
|
|
179
|
+
readonly oneOf: readonly [{
|
|
180
|
+
readonly type: "object";
|
|
181
|
+
readonly additionalProperties: false;
|
|
182
|
+
}, {
|
|
183
|
+
readonly type: "string";
|
|
184
|
+
}];
|
|
130
185
|
};
|
|
131
186
|
readonly uniqueItems: true;
|
|
132
187
|
};
|
|
133
188
|
readonly disallow: {
|
|
134
189
|
readonly type: "array";
|
|
135
190
|
readonly items: {
|
|
136
|
-
readonly
|
|
191
|
+
readonly oneOf: readonly [{
|
|
192
|
+
readonly type: "object";
|
|
193
|
+
readonly additionalProperties: false;
|
|
194
|
+
}, {
|
|
195
|
+
readonly type: "string";
|
|
196
|
+
}];
|
|
137
197
|
};
|
|
138
198
|
readonly uniqueItems: true;
|
|
139
199
|
};
|
|
@@ -201,14 +261,24 @@ declare const plugin: {
|
|
|
201
261
|
readonly allowUrls: {
|
|
202
262
|
readonly type: "array";
|
|
203
263
|
readonly items: {
|
|
204
|
-
readonly
|
|
264
|
+
readonly oneOf: [{
|
|
265
|
+
readonly type: "object";
|
|
266
|
+
readonly additionalProperties: false;
|
|
267
|
+
}, {
|
|
268
|
+
readonly type: "string";
|
|
269
|
+
}];
|
|
205
270
|
};
|
|
206
271
|
readonly uniqueItems: true;
|
|
207
272
|
};
|
|
208
273
|
readonly disallowUrls: {
|
|
209
274
|
readonly type: "array";
|
|
210
275
|
readonly items: {
|
|
211
|
-
readonly
|
|
276
|
+
readonly oneOf: [{
|
|
277
|
+
readonly type: "object";
|
|
278
|
+
readonly additionalProperties: false;
|
|
279
|
+
}, {
|
|
280
|
+
readonly type: "string";
|
|
281
|
+
}];
|
|
212
282
|
};
|
|
213
283
|
readonly uniqueItems: true;
|
|
214
284
|
};
|
|
@@ -238,8 +308,8 @@ declare const plugin: {
|
|
|
238
308
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
239
309
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
240
310
|
RuleOptions: [{
|
|
241
|
-
allowUrls: RegExp[];
|
|
242
|
-
disallowUrls: RegExp[];
|
|
311
|
+
allowUrls: (RegExp | string)[];
|
|
312
|
+
disallowUrls: (RegExp | string)[];
|
|
243
313
|
allowDefinitions: string[];
|
|
244
314
|
}];
|
|
245
315
|
Node: import("mdast").Node;
|
|
@@ -267,14 +337,24 @@ declare const plugin: {
|
|
|
267
337
|
readonly allowUrls: {
|
|
268
338
|
readonly type: "array";
|
|
269
339
|
readonly items: {
|
|
270
|
-
readonly
|
|
340
|
+
readonly oneOf: [{
|
|
341
|
+
readonly type: "object";
|
|
342
|
+
readonly additionalProperties: false;
|
|
343
|
+
}, {
|
|
344
|
+
readonly type: "string";
|
|
345
|
+
}];
|
|
271
346
|
};
|
|
272
347
|
readonly uniqueItems: true;
|
|
273
348
|
};
|
|
274
349
|
readonly disallowUrls: {
|
|
275
350
|
readonly type: "array";
|
|
276
351
|
readonly items: {
|
|
277
|
-
readonly
|
|
352
|
+
readonly oneOf: [{
|
|
353
|
+
readonly type: "object";
|
|
354
|
+
readonly additionalProperties: false;
|
|
355
|
+
}, {
|
|
356
|
+
readonly type: "string";
|
|
357
|
+
}];
|
|
278
358
|
};
|
|
279
359
|
readonly uniqueItems: true;
|
|
280
360
|
};
|
|
@@ -304,8 +384,8 @@ declare const plugin: {
|
|
|
304
384
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
305
385
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
306
386
|
RuleOptions: [{
|
|
307
|
-
allowUrls: RegExp[];
|
|
308
|
-
disallowUrls: RegExp[];
|
|
387
|
+
allowUrls: (RegExp | string)[];
|
|
388
|
+
disallowUrls: (RegExp | string)[];
|
|
309
389
|
allowDefinitions: string[];
|
|
310
390
|
}];
|
|
311
391
|
Node: import("mdast").Node;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Heading } from 'mdast';
|
|
6
6
|
export interface HeadingOptions {
|
|
7
|
-
allow: RegExp[];
|
|
8
|
-
disallow: RegExp[];
|
|
7
|
+
allow: (RegExp | string)[];
|
|
8
|
+
disallow: (RegExp | string)[];
|
|
9
9
|
}
|
|
10
10
|
type RuleOptions = [Record<`h${Heading['depth']}`, HeadingOptions>];
|
|
11
11
|
type MessageIds = 'allowHeading' | 'disallowHeading';
|
|
@@ -27,14 +27,24 @@ declare const _default: {
|
|
|
27
27
|
readonly allow: {
|
|
28
28
|
readonly type: "array";
|
|
29
29
|
readonly items: {
|
|
30
|
-
readonly
|
|
30
|
+
readonly oneOf: readonly [{
|
|
31
|
+
readonly type: "object";
|
|
32
|
+
readonly additionalProperties: false;
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
}];
|
|
31
36
|
};
|
|
32
37
|
readonly uniqueItems: true;
|
|
33
38
|
};
|
|
34
39
|
readonly disallow: {
|
|
35
40
|
readonly type: "array";
|
|
36
41
|
readonly items: {
|
|
37
|
-
readonly
|
|
42
|
+
readonly oneOf: readonly [{
|
|
43
|
+
readonly type: "object";
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
}, {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
}];
|
|
38
48
|
};
|
|
39
49
|
readonly uniqueItems: true;
|
|
40
50
|
};
|
|
@@ -47,14 +57,24 @@ declare const _default: {
|
|
|
47
57
|
readonly allow: {
|
|
48
58
|
readonly type: "array";
|
|
49
59
|
readonly items: {
|
|
50
|
-
readonly
|
|
60
|
+
readonly oneOf: readonly [{
|
|
61
|
+
readonly type: "object";
|
|
62
|
+
readonly additionalProperties: false;
|
|
63
|
+
}, {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
}];
|
|
51
66
|
};
|
|
52
67
|
readonly uniqueItems: true;
|
|
53
68
|
};
|
|
54
69
|
readonly disallow: {
|
|
55
70
|
readonly type: "array";
|
|
56
71
|
readonly items: {
|
|
57
|
-
readonly
|
|
72
|
+
readonly oneOf: readonly [{
|
|
73
|
+
readonly type: "object";
|
|
74
|
+
readonly additionalProperties: false;
|
|
75
|
+
}, {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
}];
|
|
58
78
|
};
|
|
59
79
|
readonly uniqueItems: true;
|
|
60
80
|
};
|
|
@@ -67,14 +87,24 @@ declare const _default: {
|
|
|
67
87
|
readonly allow: {
|
|
68
88
|
readonly type: "array";
|
|
69
89
|
readonly items: {
|
|
70
|
-
readonly
|
|
90
|
+
readonly oneOf: readonly [{
|
|
91
|
+
readonly type: "object";
|
|
92
|
+
readonly additionalProperties: false;
|
|
93
|
+
}, {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
}];
|
|
71
96
|
};
|
|
72
97
|
readonly uniqueItems: true;
|
|
73
98
|
};
|
|
74
99
|
readonly disallow: {
|
|
75
100
|
readonly type: "array";
|
|
76
101
|
readonly items: {
|
|
77
|
-
readonly
|
|
102
|
+
readonly oneOf: readonly [{
|
|
103
|
+
readonly type: "object";
|
|
104
|
+
readonly additionalProperties: false;
|
|
105
|
+
}, {
|
|
106
|
+
readonly type: "string";
|
|
107
|
+
}];
|
|
78
108
|
};
|
|
79
109
|
readonly uniqueItems: true;
|
|
80
110
|
};
|
|
@@ -87,14 +117,24 @@ declare const _default: {
|
|
|
87
117
|
readonly allow: {
|
|
88
118
|
readonly type: "array";
|
|
89
119
|
readonly items: {
|
|
90
|
-
readonly
|
|
120
|
+
readonly oneOf: readonly [{
|
|
121
|
+
readonly type: "object";
|
|
122
|
+
readonly additionalProperties: false;
|
|
123
|
+
}, {
|
|
124
|
+
readonly type: "string";
|
|
125
|
+
}];
|
|
91
126
|
};
|
|
92
127
|
readonly uniqueItems: true;
|
|
93
128
|
};
|
|
94
129
|
readonly disallow: {
|
|
95
130
|
readonly type: "array";
|
|
96
131
|
readonly items: {
|
|
97
|
-
readonly
|
|
132
|
+
readonly oneOf: readonly [{
|
|
133
|
+
readonly type: "object";
|
|
134
|
+
readonly additionalProperties: false;
|
|
135
|
+
}, {
|
|
136
|
+
readonly type: "string";
|
|
137
|
+
}];
|
|
98
138
|
};
|
|
99
139
|
readonly uniqueItems: true;
|
|
100
140
|
};
|
|
@@ -107,14 +147,24 @@ declare const _default: {
|
|
|
107
147
|
readonly allow: {
|
|
108
148
|
readonly type: "array";
|
|
109
149
|
readonly items: {
|
|
110
|
-
readonly
|
|
150
|
+
readonly oneOf: readonly [{
|
|
151
|
+
readonly type: "object";
|
|
152
|
+
readonly additionalProperties: false;
|
|
153
|
+
}, {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
}];
|
|
111
156
|
};
|
|
112
157
|
readonly uniqueItems: true;
|
|
113
158
|
};
|
|
114
159
|
readonly disallow: {
|
|
115
160
|
readonly type: "array";
|
|
116
161
|
readonly items: {
|
|
117
|
-
readonly
|
|
162
|
+
readonly oneOf: readonly [{
|
|
163
|
+
readonly type: "object";
|
|
164
|
+
readonly additionalProperties: false;
|
|
165
|
+
}, {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
}];
|
|
118
168
|
};
|
|
119
169
|
readonly uniqueItems: true;
|
|
120
170
|
};
|
|
@@ -127,14 +177,24 @@ declare const _default: {
|
|
|
127
177
|
readonly allow: {
|
|
128
178
|
readonly type: "array";
|
|
129
179
|
readonly items: {
|
|
130
|
-
readonly
|
|
180
|
+
readonly oneOf: readonly [{
|
|
181
|
+
readonly type: "object";
|
|
182
|
+
readonly additionalProperties: false;
|
|
183
|
+
}, {
|
|
184
|
+
readonly type: "string";
|
|
185
|
+
}];
|
|
131
186
|
};
|
|
132
187
|
readonly uniqueItems: true;
|
|
133
188
|
};
|
|
134
189
|
readonly disallow: {
|
|
135
190
|
readonly type: "array";
|
|
136
191
|
readonly items: {
|
|
137
|
-
readonly
|
|
192
|
+
readonly oneOf: readonly [{
|
|
193
|
+
readonly type: "object";
|
|
194
|
+
readonly additionalProperties: false;
|
|
195
|
+
}, {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
}];
|
|
138
198
|
};
|
|
139
199
|
readonly uniqueItems: true;
|
|
140
200
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce the use of allowed or disallowed headings.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
import { testRegexStateless } from '../core/utils/index.js';
|
|
5
|
+
import { normalizeRegexPattern, testRegexStateless } from '../core/utils/index.js';
|
|
6
6
|
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
// Helper
|
|
@@ -13,14 +13,14 @@ const headingOptionsSchema = {
|
|
|
13
13
|
allow: {
|
|
14
14
|
type: 'array',
|
|
15
15
|
items: {
|
|
16
|
-
type: 'object',
|
|
16
|
+
oneOf: [{ type: 'object', additionalProperties: false }, { type: 'string' }],
|
|
17
17
|
},
|
|
18
18
|
uniqueItems: true,
|
|
19
19
|
},
|
|
20
20
|
disallow: {
|
|
21
21
|
type: 'array',
|
|
22
22
|
items: {
|
|
23
|
-
type: 'object',
|
|
23
|
+
oneOf: [{ type: 'object', additionalProperties: false }, { type: 'string' }],
|
|
24
24
|
},
|
|
25
25
|
uniqueItems: true,
|
|
26
26
|
},
|
|
@@ -73,18 +73,14 @@ export default {
|
|
|
73
73
|
create(context) {
|
|
74
74
|
const { sourceCode } = context;
|
|
75
75
|
const [{ h1, h2, h3, h4, h5, h6 }] = context.options;
|
|
76
|
-
const headingMap = {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
4: h4,
|
|
81
|
-
5: h5,
|
|
82
|
-
6: h6,
|
|
83
|
-
};
|
|
76
|
+
const headingMap = [h1, h2, h3, h4, h5, h6].map(({ allow, disallow }) => ({
|
|
77
|
+
allow: allow.map(normalizeRegexPattern),
|
|
78
|
+
disallow: disallow.map(normalizeRegexPattern),
|
|
79
|
+
}));
|
|
84
80
|
return {
|
|
85
81
|
heading(node) {
|
|
86
82
|
const { depth } = node;
|
|
87
|
-
const { allow, disallow } = headingMap[depth];
|
|
83
|
+
const { allow, disallow } = headingMap[depth - 1];
|
|
88
84
|
const headingText = sourceCode.getText(node);
|
|
89
85
|
if (!allow.some(regex => testRegexStateless(regex, headingText))) {
|
|
90
86
|
context.report({
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import type { Definition } from 'mdast';
|
|
6
6
|
type RuleOptions = [
|
|
7
7
|
{
|
|
8
|
-
allowUrls: RegExp[];
|
|
9
|
-
disallowUrls: RegExp[];
|
|
8
|
+
allowUrls: (RegExp | string)[];
|
|
9
|
+
disallowUrls: (RegExp | string)[];
|
|
10
10
|
allowDefinitions: string[];
|
|
11
11
|
}
|
|
12
12
|
];
|
|
@@ -26,14 +26,24 @@ declare const _default: {
|
|
|
26
26
|
readonly allowUrls: {
|
|
27
27
|
readonly type: "array";
|
|
28
28
|
readonly items: {
|
|
29
|
-
readonly
|
|
29
|
+
readonly oneOf: [{
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
readonly additionalProperties: false;
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
}];
|
|
30
35
|
};
|
|
31
36
|
readonly uniqueItems: true;
|
|
32
37
|
};
|
|
33
38
|
readonly disallowUrls: {
|
|
34
39
|
readonly type: "array";
|
|
35
40
|
readonly items: {
|
|
36
|
-
readonly
|
|
41
|
+
readonly oneOf: [{
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly additionalProperties: false;
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
}];
|
|
37
47
|
};
|
|
38
48
|
readonly uniqueItems: true;
|
|
39
49
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import { normalizeIdentifier } from 'micromark-util-normalize-identifier';
|
|
6
|
-
import { getElementsByTagName, testRegexStateless } from '../core/utils/index.js';
|
|
6
|
+
import { getElementsByTagName, normalizeRegexPattern, testRegexStateless, } from '../core/utils/index.js';
|
|
7
7
|
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
8
8
|
// --------------------------------------------------------------------------------
|
|
9
9
|
// Rule Definition
|
|
@@ -24,14 +24,20 @@ export default {
|
|
|
24
24
|
allowUrls: {
|
|
25
25
|
type: 'array',
|
|
26
26
|
items: {
|
|
27
|
-
|
|
27
|
+
oneOf: [
|
|
28
|
+
{ type: 'object', additionalProperties: false },
|
|
29
|
+
{ type: 'string' },
|
|
30
|
+
],
|
|
28
31
|
},
|
|
29
32
|
uniqueItems: true,
|
|
30
33
|
},
|
|
31
34
|
disallowUrls: {
|
|
32
35
|
type: 'array',
|
|
33
36
|
items: {
|
|
34
|
-
|
|
37
|
+
oneOf: [
|
|
38
|
+
{ type: 'object', additionalProperties: false },
|
|
39
|
+
{ type: 'string' },
|
|
40
|
+
],
|
|
35
41
|
},
|
|
36
42
|
uniqueItems: true,
|
|
37
43
|
},
|
|
@@ -62,8 +68,10 @@ export default {
|
|
|
62
68
|
},
|
|
63
69
|
create(context) {
|
|
64
70
|
const { sourceCode } = context;
|
|
65
|
-
const [{ allowUrls, disallowUrls }] = context.options;
|
|
66
|
-
const
|
|
71
|
+
const [{ allowUrls: allowUrlsOption, disallowUrls: disallowUrlsOption, allowDefinitions: allowDefinitionsOption, },] = context.options;
|
|
72
|
+
const allowUrls = allowUrlsOption.map(normalizeRegexPattern);
|
|
73
|
+
const disallowUrls = disallowUrlsOption.map(normalizeRegexPattern);
|
|
74
|
+
const allowDefinitions = new Set(allowDefinitionsOption.map(identifier => normalizeIdentifier(identifier).toLowerCase()));
|
|
67
75
|
const images = new Set();
|
|
68
76
|
const imageReferenceIdentifiers = new Set();
|
|
69
77
|
const definitions = new Set();
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import type { Definition } from 'mdast';
|
|
6
6
|
type RuleOptions = [
|
|
7
7
|
{
|
|
8
|
-
allowUrls: RegExp[];
|
|
9
|
-
disallowUrls: RegExp[];
|
|
8
|
+
allowUrls: (RegExp | string)[];
|
|
9
|
+
disallowUrls: (RegExp | string)[];
|
|
10
10
|
allowDefinitions: string[];
|
|
11
11
|
}
|
|
12
12
|
];
|
|
@@ -26,14 +26,24 @@ declare const _default: {
|
|
|
26
26
|
readonly allowUrls: {
|
|
27
27
|
readonly type: "array";
|
|
28
28
|
readonly items: {
|
|
29
|
-
readonly
|
|
29
|
+
readonly oneOf: [{
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
readonly additionalProperties: false;
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
}];
|
|
30
35
|
};
|
|
31
36
|
readonly uniqueItems: true;
|
|
32
37
|
};
|
|
33
38
|
readonly disallowUrls: {
|
|
34
39
|
readonly type: "array";
|
|
35
40
|
readonly items: {
|
|
36
|
-
readonly
|
|
41
|
+
readonly oneOf: [{
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly additionalProperties: false;
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
}];
|
|
37
47
|
};
|
|
38
48
|
readonly uniqueItems: true;
|
|
39
49
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import { normalizeIdentifier } from 'micromark-util-normalize-identifier';
|
|
6
|
-
import { getElementsByTagName, testRegexStateless } from '../core/utils/index.js';
|
|
6
|
+
import { getElementsByTagName, normalizeRegexPattern, testRegexStateless, } from '../core/utils/index.js';
|
|
7
7
|
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
8
8
|
// --------------------------------------------------------------------------------
|
|
9
9
|
// Rule Definition
|
|
@@ -24,14 +24,20 @@ export default {
|
|
|
24
24
|
allowUrls: {
|
|
25
25
|
type: 'array',
|
|
26
26
|
items: {
|
|
27
|
-
|
|
27
|
+
oneOf: [
|
|
28
|
+
{ type: 'object', additionalProperties: false },
|
|
29
|
+
{ type: 'string' },
|
|
30
|
+
],
|
|
28
31
|
},
|
|
29
32
|
uniqueItems: true,
|
|
30
33
|
},
|
|
31
34
|
disallowUrls: {
|
|
32
35
|
type: 'array',
|
|
33
36
|
items: {
|
|
34
|
-
|
|
37
|
+
oneOf: [
|
|
38
|
+
{ type: 'object', additionalProperties: false },
|
|
39
|
+
{ type: 'string' },
|
|
40
|
+
],
|
|
35
41
|
},
|
|
36
42
|
uniqueItems: true,
|
|
37
43
|
},
|
|
@@ -62,8 +68,10 @@ export default {
|
|
|
62
68
|
},
|
|
63
69
|
create(context) {
|
|
64
70
|
const { sourceCode } = context;
|
|
65
|
-
const [{ allowUrls, disallowUrls }] = context.options;
|
|
66
|
-
const
|
|
71
|
+
const [{ allowUrls: allowUrlsOption, disallowUrls: disallowUrlsOption, allowDefinitions: allowDefinitionsOption, },] = context.options;
|
|
72
|
+
const allowUrls = allowUrlsOption.map(normalizeRegexPattern);
|
|
73
|
+
const disallowUrls = disallowUrlsOption.map(normalizeRegexPattern);
|
|
74
|
+
const allowDefinitions = new Set(allowDefinitionsOption.map(identifier => normalizeIdentifier(identifier).toLowerCase()));
|
|
67
75
|
const links = new Set();
|
|
68
76
|
const linkReferenceIdentifiers = new Set();
|
|
69
77
|
const definitions = new Set();
|
package/build/rules/index.d.ts
CHANGED
|
@@ -17,14 +17,24 @@ declare const _default: {
|
|
|
17
17
|
readonly allow: {
|
|
18
18
|
readonly type: "array";
|
|
19
19
|
readonly items: {
|
|
20
|
-
readonly
|
|
20
|
+
readonly oneOf: readonly [{
|
|
21
|
+
readonly type: "object";
|
|
22
|
+
readonly additionalProperties: false;
|
|
23
|
+
}, {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
}];
|
|
21
26
|
};
|
|
22
27
|
readonly uniqueItems: true;
|
|
23
28
|
};
|
|
24
29
|
readonly disallow: {
|
|
25
30
|
readonly type: "array";
|
|
26
31
|
readonly items: {
|
|
27
|
-
readonly
|
|
32
|
+
readonly oneOf: readonly [{
|
|
33
|
+
readonly type: "object";
|
|
34
|
+
readonly additionalProperties: false;
|
|
35
|
+
}, {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
}];
|
|
28
38
|
};
|
|
29
39
|
readonly uniqueItems: true;
|
|
30
40
|
};
|
|
@@ -37,14 +47,24 @@ declare const _default: {
|
|
|
37
47
|
readonly allow: {
|
|
38
48
|
readonly type: "array";
|
|
39
49
|
readonly items: {
|
|
40
|
-
readonly
|
|
50
|
+
readonly oneOf: readonly [{
|
|
51
|
+
readonly type: "object";
|
|
52
|
+
readonly additionalProperties: false;
|
|
53
|
+
}, {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
}];
|
|
41
56
|
};
|
|
42
57
|
readonly uniqueItems: true;
|
|
43
58
|
};
|
|
44
59
|
readonly disallow: {
|
|
45
60
|
readonly type: "array";
|
|
46
61
|
readonly items: {
|
|
47
|
-
readonly
|
|
62
|
+
readonly oneOf: readonly [{
|
|
63
|
+
readonly type: "object";
|
|
64
|
+
readonly additionalProperties: false;
|
|
65
|
+
}, {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
}];
|
|
48
68
|
};
|
|
49
69
|
readonly uniqueItems: true;
|
|
50
70
|
};
|
|
@@ -57,14 +77,24 @@ declare const _default: {
|
|
|
57
77
|
readonly allow: {
|
|
58
78
|
readonly type: "array";
|
|
59
79
|
readonly items: {
|
|
60
|
-
readonly
|
|
80
|
+
readonly oneOf: readonly [{
|
|
81
|
+
readonly type: "object";
|
|
82
|
+
readonly additionalProperties: false;
|
|
83
|
+
}, {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
}];
|
|
61
86
|
};
|
|
62
87
|
readonly uniqueItems: true;
|
|
63
88
|
};
|
|
64
89
|
readonly disallow: {
|
|
65
90
|
readonly type: "array";
|
|
66
91
|
readonly items: {
|
|
67
|
-
readonly
|
|
92
|
+
readonly oneOf: readonly [{
|
|
93
|
+
readonly type: "object";
|
|
94
|
+
readonly additionalProperties: false;
|
|
95
|
+
}, {
|
|
96
|
+
readonly type: "string";
|
|
97
|
+
}];
|
|
68
98
|
};
|
|
69
99
|
readonly uniqueItems: true;
|
|
70
100
|
};
|
|
@@ -77,14 +107,24 @@ declare const _default: {
|
|
|
77
107
|
readonly allow: {
|
|
78
108
|
readonly type: "array";
|
|
79
109
|
readonly items: {
|
|
80
|
-
readonly
|
|
110
|
+
readonly oneOf: readonly [{
|
|
111
|
+
readonly type: "object";
|
|
112
|
+
readonly additionalProperties: false;
|
|
113
|
+
}, {
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
}];
|
|
81
116
|
};
|
|
82
117
|
readonly uniqueItems: true;
|
|
83
118
|
};
|
|
84
119
|
readonly disallow: {
|
|
85
120
|
readonly type: "array";
|
|
86
121
|
readonly items: {
|
|
87
|
-
readonly
|
|
122
|
+
readonly oneOf: readonly [{
|
|
123
|
+
readonly type: "object";
|
|
124
|
+
readonly additionalProperties: false;
|
|
125
|
+
}, {
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
}];
|
|
88
128
|
};
|
|
89
129
|
readonly uniqueItems: true;
|
|
90
130
|
};
|
|
@@ -97,14 +137,24 @@ declare const _default: {
|
|
|
97
137
|
readonly allow: {
|
|
98
138
|
readonly type: "array";
|
|
99
139
|
readonly items: {
|
|
100
|
-
readonly
|
|
140
|
+
readonly oneOf: readonly [{
|
|
141
|
+
readonly type: "object";
|
|
142
|
+
readonly additionalProperties: false;
|
|
143
|
+
}, {
|
|
144
|
+
readonly type: "string";
|
|
145
|
+
}];
|
|
101
146
|
};
|
|
102
147
|
readonly uniqueItems: true;
|
|
103
148
|
};
|
|
104
149
|
readonly disallow: {
|
|
105
150
|
readonly type: "array";
|
|
106
151
|
readonly items: {
|
|
107
|
-
readonly
|
|
152
|
+
readonly oneOf: readonly [{
|
|
153
|
+
readonly type: "object";
|
|
154
|
+
readonly additionalProperties: false;
|
|
155
|
+
}, {
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
}];
|
|
108
158
|
};
|
|
109
159
|
readonly uniqueItems: true;
|
|
110
160
|
};
|
|
@@ -117,14 +167,24 @@ declare const _default: {
|
|
|
117
167
|
readonly allow: {
|
|
118
168
|
readonly type: "array";
|
|
119
169
|
readonly items: {
|
|
120
|
-
readonly
|
|
170
|
+
readonly oneOf: readonly [{
|
|
171
|
+
readonly type: "object";
|
|
172
|
+
readonly additionalProperties: false;
|
|
173
|
+
}, {
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
}];
|
|
121
176
|
};
|
|
122
177
|
readonly uniqueItems: true;
|
|
123
178
|
};
|
|
124
179
|
readonly disallow: {
|
|
125
180
|
readonly type: "array";
|
|
126
181
|
readonly items: {
|
|
127
|
-
readonly
|
|
182
|
+
readonly oneOf: readonly [{
|
|
183
|
+
readonly type: "object";
|
|
184
|
+
readonly additionalProperties: false;
|
|
185
|
+
}, {
|
|
186
|
+
readonly type: "string";
|
|
187
|
+
}];
|
|
128
188
|
};
|
|
129
189
|
readonly uniqueItems: true;
|
|
130
190
|
};
|
|
@@ -192,14 +252,24 @@ declare const _default: {
|
|
|
192
252
|
readonly allowUrls: {
|
|
193
253
|
readonly type: "array";
|
|
194
254
|
readonly items: {
|
|
195
|
-
readonly
|
|
255
|
+
readonly oneOf: [{
|
|
256
|
+
readonly type: "object";
|
|
257
|
+
readonly additionalProperties: false;
|
|
258
|
+
}, {
|
|
259
|
+
readonly type: "string";
|
|
260
|
+
}];
|
|
196
261
|
};
|
|
197
262
|
readonly uniqueItems: true;
|
|
198
263
|
};
|
|
199
264
|
readonly disallowUrls: {
|
|
200
265
|
readonly type: "array";
|
|
201
266
|
readonly items: {
|
|
202
|
-
readonly
|
|
267
|
+
readonly oneOf: [{
|
|
268
|
+
readonly type: "object";
|
|
269
|
+
readonly additionalProperties: false;
|
|
270
|
+
}, {
|
|
271
|
+
readonly type: "string";
|
|
272
|
+
}];
|
|
203
273
|
};
|
|
204
274
|
readonly uniqueItems: true;
|
|
205
275
|
};
|
|
@@ -229,8 +299,8 @@ declare const _default: {
|
|
|
229
299
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
230
300
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
231
301
|
RuleOptions: [{
|
|
232
|
-
allowUrls: RegExp[];
|
|
233
|
-
disallowUrls: RegExp[];
|
|
302
|
+
allowUrls: (RegExp | string)[];
|
|
303
|
+
disallowUrls: (RegExp | string)[];
|
|
234
304
|
allowDefinitions: string[];
|
|
235
305
|
}];
|
|
236
306
|
Node: import("mdast").Node;
|
|
@@ -258,14 +328,24 @@ declare const _default: {
|
|
|
258
328
|
readonly allowUrls: {
|
|
259
329
|
readonly type: "array";
|
|
260
330
|
readonly items: {
|
|
261
|
-
readonly
|
|
331
|
+
readonly oneOf: [{
|
|
332
|
+
readonly type: "object";
|
|
333
|
+
readonly additionalProperties: false;
|
|
334
|
+
}, {
|
|
335
|
+
readonly type: "string";
|
|
336
|
+
}];
|
|
262
337
|
};
|
|
263
338
|
readonly uniqueItems: true;
|
|
264
339
|
};
|
|
265
340
|
readonly disallowUrls: {
|
|
266
341
|
readonly type: "array";
|
|
267
342
|
readonly items: {
|
|
268
|
-
readonly
|
|
343
|
+
readonly oneOf: [{
|
|
344
|
+
readonly type: "object";
|
|
345
|
+
readonly additionalProperties: false;
|
|
346
|
+
}, {
|
|
347
|
+
readonly type: "string";
|
|
348
|
+
}];
|
|
269
349
|
};
|
|
270
350
|
readonly uniqueItems: true;
|
|
271
351
|
};
|
|
@@ -295,8 +375,8 @@ declare const _default: {
|
|
|
295
375
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
296
376
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
297
377
|
RuleOptions: [{
|
|
298
|
-
allowUrls: RegExp[];
|
|
299
|
-
disallowUrls: RegExp[];
|
|
378
|
+
allowUrls: (RegExp | string)[];
|
|
379
|
+
disallowUrls: (RegExp | string)[];
|
|
300
380
|
allowDefinitions: string[];
|
|
301
381
|
}];
|
|
302
382
|
Node: import("mdast").Node;
|
package/build/rules/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import consistentStrongStyle from './consistent-strong-style.js';
|
|
|
12
12
|
import consistentThematicBreakStyle from './consistent-thematic-break-style.js';
|
|
13
13
|
import consistentUnorderedListStyle from './consistent-unordered-list-style.js';
|
|
14
14
|
// import enCapitalization from './en-capitalization.js';
|
|
15
|
-
// import noBoldParagraph from './no-bold-paragraph.js';
|
|
16
15
|
import noConsecutiveBlankLine from './no-consecutive-blank-line.js';
|
|
17
16
|
import noControlCharacter from './no-control-character.js';
|
|
18
17
|
import noCurlyQuote from './no-curly-quote.js';
|
|
@@ -41,7 +40,6 @@ export default {
|
|
|
41
40
|
'consistent-thematic-break-style': consistentThematicBreakStyle,
|
|
42
41
|
'consistent-unordered-list-style': consistentUnorderedListStyle,
|
|
43
42
|
// 'en-capitalization': enCapitalization,
|
|
44
|
-
// 'no-bold-paragraph': noBoldParagraph,
|
|
45
43
|
'no-consecutive-blank-line': noConsecutiveBlankLine,
|
|
46
44
|
'no-control-character': noControlCharacter,
|
|
47
45
|
'no-curly-quote': noCurlyQuote,
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Rule to disallow using fully bolded paragraphs as headings.
|
|
3
|
-
* @author lumir(lumirlumir)
|
|
4
|
-
*/
|
|
5
|
-
declare const _default: {
|
|
6
|
-
readonly meta: {
|
|
7
|
-
readonly type: "problem";
|
|
8
|
-
readonly docs: {
|
|
9
|
-
readonly description: "Disallow using fully bolded paragraphs as headings";
|
|
10
|
-
readonly url: string;
|
|
11
|
-
readonly recommended: true;
|
|
12
|
-
readonly stylistic: false;
|
|
13
|
-
};
|
|
14
|
-
readonly messages: {
|
|
15
|
-
readonly noBoldParagraph: "Fully bolded paragraphs should not be used as headings. Please use a heading instead.";
|
|
16
|
-
};
|
|
17
|
-
readonly language: "markdown";
|
|
18
|
-
readonly dialects: ["commonmark", "gfm"];
|
|
19
|
-
};
|
|
20
|
-
readonly create: (context: import("@eslint/core").RuleContext<{
|
|
21
|
-
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
22
|
-
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
23
|
-
RuleOptions: [];
|
|
24
|
-
Node: import("mdast").Node;
|
|
25
|
-
MessageIds: "noBoldParagraph";
|
|
26
|
-
}>) => {
|
|
27
|
-
strong(node: import("mdast").Strong): void;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export default _default;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Rule to disallow using fully bolded paragraphs as headings.
|
|
3
|
-
* @author lumir(lumirlumir)
|
|
4
|
-
*/
|
|
5
|
-
// eslint-disable-next-line -- TODO: This rule is not fully migrated to TypeScript yet.
|
|
6
|
-
// @ts-nocheck -- TODO
|
|
7
|
-
// --------------------------------------------------------------------------------
|
|
8
|
-
// Import
|
|
9
|
-
// --------------------------------------------------------------------------------
|
|
10
|
-
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
11
|
-
// --------------------------------------------------------------------------------
|
|
12
|
-
// Rule Definition
|
|
13
|
-
// --------------------------------------------------------------------------------
|
|
14
|
-
export default {
|
|
15
|
-
meta: {
|
|
16
|
-
type: 'problem',
|
|
17
|
-
docs: {
|
|
18
|
-
description: 'Disallow using fully bolded paragraphs as headings',
|
|
19
|
-
url: URL_RULE_DOCS('no-bold-paragraph'),
|
|
20
|
-
recommended: true,
|
|
21
|
-
stylistic: false,
|
|
22
|
-
},
|
|
23
|
-
messages: {
|
|
24
|
-
noBoldParagraph: 'Fully bolded paragraphs should not be used as headings. Please use a heading instead.',
|
|
25
|
-
},
|
|
26
|
-
language: 'markdown',
|
|
27
|
-
dialects: ['commonmark', 'gfm'],
|
|
28
|
-
},
|
|
29
|
-
create(context) {
|
|
30
|
-
return {
|
|
31
|
-
strong(node) {
|
|
32
|
-
const parentNode = context.sourceCode.getParent(node);
|
|
33
|
-
const ancestorNode = context.sourceCode.getParent(parentNode);
|
|
34
|
-
if (parentNode.type === 'paragraph' &&
|
|
35
|
-
ancestorNode.type !== 'listItem' &&
|
|
36
|
-
parentNode.position.start.line === parentNode.position.end.line && // Should be a single line.
|
|
37
|
-
parentNode.position.start.offset === node.position.start.offset && // Should have the same start offset.
|
|
38
|
-
parentNode.position.end.offset === node.position.end.offset // Should have the same end offset.
|
|
39
|
-
) {
|
|
40
|
-
context.report({
|
|
41
|
-
node,
|
|
42
|
-
messageId: 'noBoldParagraph',
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
};
|