@diplodoc/yfmlint 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 YANDEX LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ [![NPM version](https://img.shields.io/npm/v/@diplodoc/yfmlint.svg?style=flat)](https://www.npmjs.org/package/@diplodoc/yfmlint)
2
+
3
+ # YFM syntax linter
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ npm install @diplodoc/yfmlint
9
+ ```
10
+
11
+ ```javascript
12
+ import {yfmlint, log} from '@diplodoc/yfmlint';
13
+
14
+ const errors = await yfmlint(content, path, options);
15
+
16
+ if (errors) {
17
+ resourcemap(errors);
18
+ log(errors, logger);
19
+ }
20
+ ```
21
+
22
+ ## YFM rules
23
+
24
+ [All markdownlint rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md)
25
+
26
+ ### YFM001 - Inline code line length
27
+
28
+ Tags: line_length
29
+
30
+ Aliases: inline-code-length
31
+
32
+ Parameters: maximum
33
+
34
+ This rule is triggered when there are lines that are longer than the
35
+ configured `value` (default: 100 characters).
36
+
37
+ ### YFM002 - No header found in the file for the link text
38
+
39
+ Tags: links
40
+
41
+ Aliases: no-header-found-for-link
42
+
43
+ This rule is triggered when there are no headers in the file referenced by the link.
44
+
45
+ ### YFM003 - Link is unreachable
46
+
47
+ Tags: links
48
+
49
+ Aliases: unreachable-link
50
+
51
+ This rule is triggered when there is no file referenced by the link.
52
+
53
+ ### YFM004 - Table not closed
54
+
55
+ Tags: table
56
+
57
+ Aliases: table-not-closed
58
+
59
+ This rule is triggered when table don't have close token.
60
+
61
+ ### YFM005 - Tab list not closed
62
+
63
+ Tags: tab
64
+
65
+ Aliases: tab-list-not-closed
66
+
67
+ This rule is triggered when tab list don't have close token.
@@ -0,0 +1,17 @@
1
+ import { LogLevels } from './utils';
2
+ declare const _default: {
3
+ default: boolean;
4
+ YFM001: {
5
+ level: LogLevels;
6
+ maximum: number;
7
+ };
8
+ YFM002: LogLevels;
9
+ YFM003: LogLevels;
10
+ YFM004: LogLevels;
11
+ YFM005: LogLevels;
12
+ YFM006: LogLevels;
13
+ YFM007: LogLevels;
14
+ YFM008: LogLevels;
15
+ YFM009: LogLevels;
16
+ };
17
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { LintError, Options } from './typings';
2
+ export { LogLevels, log } from './utils';
3
+ export declare function yfmlint(content: string, path: string, opts: Options): Promise<LintError[] | undefined>;