eslint-markdown 0.19.0 → 0.19.1
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/README.md +47 -31
- package/build/core/constants.d.ts +5 -0
- package/build/core/constants.js +5 -0
- package/build/core/utils/html.d.ts +1 -1
- package/build/rules/en-capitalization.js +1 -1
- package/build/rules/no-trailing-heading-punctuation.js +3 -1
- package/package.json +3 -3
- package/build/rules/endline-punctuation.d.ts +0 -1
- package/build/rules/endline-punctuation.js +0 -2
- package/build/rules/glossary.d.ts +0 -1
- package/build/rules/glossary.js +0 -7
- package/build/rules/no-unmatched-pair.d.ts +0 -1
- package/build/rules/no-unmatched-pair.js +0 -2
package/README.md
CHANGED
|
@@ -1,21 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- eslint-disable markdown/no-html -->
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-

|
|
3
|
+
<p align="center">
|
|
4
|
+
<img alt="ESLint Markdown Logo" src="https://eslint-markdown.lumir.page/logo.svg" width="150">
|
|
5
|
+
</p>
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<h1 align="center">ESLint Markdown</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://eslint-markdown.lumir.page">Documentation</a> |
|
|
11
|
+
<a href="https://eslint-markdown.lumir.page/docs/rules/">Rules</a> |
|
|
12
|
+
<a href="https://eslint-markdown.lumir.page/docs/get-started/configurations">Configurations</a> |
|
|
13
|
+
<a href="https://eslint-markdown.lumir.page/docs/get-started/migration">Migration</a> |
|
|
14
|
+
<a href="https://eslint-markdown.lumir.page/docs/packages">Packages</a> |
|
|
15
|
+
<a href="https://github.com/eslint-markdown/eslint-markdown">Repository</a> |
|
|
16
|
+
<a href="https://github.com/eslint-markdown/eslint-markdown/discussions">Discussions</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
Community-Maintained ESLint Tools, Rules, and Configurations for High-Quality and Performant Markdown Linting.
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="https://github.com/eslint-markdown/eslint-markdown/actions/workflows/ci.yml"><img alt="ci" src="https://img.shields.io/github/actions/workflow/status/eslint-markdown/eslint-markdown/ci.yml?label=ci&color=341bab&labelColor=1a1a1a&logo=github"></a>
|
|
25
|
+
<a href="https://github.com/eslint-markdown/eslint-markdown/actions/workflows/test.yml"><img alt="test" src="https://img.shields.io/github/actions/workflow/status/eslint-markdown/eslint-markdown/test.yml?label=test&color=341bab&labelColor=1a1a1a&logo=github"></a>
|
|
26
|
+
<a href="https://codecov.io/gh/eslint-markdown/eslint-markdown"><img alt="codecov" src="https://img.shields.io/codecov/c/gh/eslint-markdown/eslint-markdown?token=LJMUst9eR3&label=Codecov&color=341bab&labelColor=1a1a1a&logo=codecov"></a>
|
|
27
|
+
<img alt="Node Current" src="https://img.shields.io/node/v/eslint-markdown?color=341bab&labelColor=1a1a1a&logo=node.js">
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<!-- eslint-enable markdown/no-html -->
|
|
11
31
|
|
|
12
32
|
> [!IMPORTANT]
|
|
13
33
|
>
|
|
14
34
|
> If you like this package, please give it a star on [GitHub](https://github.com/eslint-markdown/eslint-markdown)!⭐<br/>
|
|
15
35
|
> Your support helps us improve and maintain the project.
|
|
16
36
|
|
|
37
|
+
## `eslint-markdown`
|
|
38
|
+
|
|
39
|
+
[](https://www.npmjs.com/package/eslint-markdown)
|
|
40
|
+
[](https://www.npmjs.com/package/eslint-markdown)
|
|
41
|
+
[](https://www.npmjs.com/package/eslint-markdown)
|
|
42
|
+
|
|
17
43
|
Lint your Markdown with ESLint. Additional rules for use with `@eslint/markdown`.🛠️
|
|
18
44
|
|
|
45
|
+
> [!IMPORTANT]
|
|
46
|
+
>
|
|
47
|
+
> **Compatibility**: This [`eslint-markdown`](https://github.com/eslint-markdown/eslint-markdown#readme) plugin does not include any rules that overlap with ESLint's built-in Markdown rules provided by [`@eslint/markdown`](https://github.com/eslint/markdown#readme).
|
|
48
|
+
>
|
|
49
|
+
> So, we **highly recommend** using the `eslint-markdown` plugin alongside ESLint's built-in Markdown support, `@eslint/markdown`.
|
|
50
|
+
|
|
19
51
|
## Documentation
|
|
20
52
|
|
|
21
53
|
For full documentation, see the [official documentation of the `eslint-markdown`](https://eslint-markdown.lumir.page).
|
|
@@ -23,30 +55,14 @@ For full documentation, see the [official documentation of the `eslint-markdown`
|
|
|
23
55
|
- [Installation](https://eslint-markdown.lumir.page/docs/get-started/installation)
|
|
24
56
|
- [Configurations](https://eslint-markdown.lumir.page/docs/get-started/configurations)
|
|
25
57
|
- [Migration Guide](https://eslint-markdown.lumir.page/docs/get-started/migration)
|
|
58
|
+
- [Migrating from `markdownlint`](https://eslint-markdown.lumir.page/docs/get-started/migration#migrating-from-markdownlint)
|
|
59
|
+
- [Migrating from `remark-lint`](https://eslint-markdown.lumir.page/docs/get-started/migration#migrating-from-remark-lint)
|
|
60
|
+
- [Migrating from `textlint`](https://eslint-markdown.lumir.page/docs/get-started/migration#migrating-from-textlint)
|
|
26
61
|
- [Rules](https://eslint-markdown.lumir.page/docs/rules)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
This [`eslint-markdown`](https://github.com/eslint-markdown/eslint-markdown#readme) plugin does not include any rules that overlap with ESLint's built-in Markdown rules provided by [`@eslint/markdown`](https://github.com/eslint/markdown#readme).
|
|
31
|
-
|
|
32
|
-
So, we **highly recommend** using the `eslint-markdown` plugin alongside ESLint's built-in Markdown support, `@eslint/markdown`.
|
|
33
|
-
|
|
34
|
-
## Code of Conduct
|
|
35
|
-
|
|
36
|
-
See [Code of Conduct](https://github.com/eslint-markdown/eslint-markdown/blob/main/CODE_OF_CONDUCT.md).
|
|
37
|
-
|
|
38
|
-
## Change Log
|
|
39
|
-
|
|
40
|
-
See [Change Log](https://github.com/eslint-markdown/eslint-markdown/blob/main/CHANGELOG.md).
|
|
41
|
-
|
|
42
|
-
## Versioning
|
|
43
|
-
|
|
44
|
-
See [Versioning](https://eslint-markdown.lumir.page/docs/get-started/versioning).
|
|
45
|
-
|
|
46
|
-
## Security
|
|
47
|
-
|
|
48
|
-
See [Security](https://github.com/eslint-markdown/eslint-markdown/blob/main/SECURITY.md).
|
|
62
|
+
- [Packages](https://eslint-markdown.lumir.page/docs/packages)
|
|
63
|
+
- [`eslint-markdown`](https://eslint-markdown.lumir.page/docs/packages/eslint-markdown)
|
|
64
|
+
- [`eslint-lumir`](https://eslint-markdown.lumir.page/docs/packages/eslint-lumir)
|
|
49
65
|
|
|
50
66
|
## License
|
|
51
67
|
|
|
52
|
-
[MIT](https://github.com/eslint-markdown/eslint-markdown/blob/main/LICENSE.md)
|
|
68
|
+
[MIT](https://github.com/eslint-markdown/eslint-markdown/blob/main/packages/eslint-markdown/LICENSE.md)
|
|
@@ -30,6 +30,11 @@ export declare const punctuation: readonly [".", ",", ";", ":", "!", "。", ",
|
|
|
30
30
|
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#parameters
|
|
31
31
|
*/
|
|
32
32
|
export declare const punctuationWithQuestionMark: readonly [".", ",", ";", ":", "!", "?", "。", ",", ";", ":", "!", "?"];
|
|
33
|
+
/**
|
|
34
|
+
* Matches a single ASCII punctuation character as defined by CommonMark.
|
|
35
|
+
* @see https://spec.commonmark.org/0.31.2/#ascii-punctuation-character
|
|
36
|
+
*/
|
|
37
|
+
export declare const asciiPunctuationRegex: RegExp;
|
|
33
38
|
/**
|
|
34
39
|
* Regular expression for identifying an odd-length run of backslashes at the end of a string.
|
|
35
40
|
*/
|
package/build/core/constants.js
CHANGED
|
@@ -49,6 +49,11 @@ export const punctuationWithQuestionMark = [
|
|
|
49
49
|
// --------------------------------------------------------------------------------
|
|
50
50
|
// --------------------------------------------------------------------------------
|
|
51
51
|
// #region regex
|
|
52
|
+
/**
|
|
53
|
+
* Matches a single ASCII punctuation character as defined by CommonMark.
|
|
54
|
+
* @see https://spec.commonmark.org/0.31.2/#ascii-punctuation-character
|
|
55
|
+
*/
|
|
56
|
+
export const asciiPunctuationRegex = /^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]$/;
|
|
52
57
|
/**
|
|
53
58
|
* Regular expression for identifying an odd-length run of backslashes at the end of a string.
|
|
54
59
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview HTML AST utilities.
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type DefaultTreeAdapterTypes } from 'parse5';
|
|
5
5
|
/**
|
|
6
6
|
* Mimics the behavior of `getElementsByTagName` in the DOM API.
|
|
7
7
|
* @param html The HTML string to parse.
|
|
@@ -11,7 +11,7 @@ const lowercaseRegex = /^[a-z]/u;
|
|
|
11
11
|
* Traverses the Markdown AST using a DFS pre-order approach to find the first text node.
|
|
12
12
|
* @param node The node to start searching from.
|
|
13
13
|
* @returns The first text node, if present.
|
|
14
|
-
*/ // eslint-disable-next-line
|
|
14
|
+
*/ // eslint-disable-next-line typescript/no-explicit-any -- TODO: This rule is not fully migrated to TypeScript yet.
|
|
15
15
|
function findFirstLeafTextNode(node) {
|
|
16
16
|
// Base case: if this is a text node, return it
|
|
17
17
|
if (node.type === 'text')
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// Import
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
import { escapeStringRegexp } from '../core/utils/index.js';
|
|
9
|
-
import { URL_RULE_DOCS, punctuation as defaultPunctuation, escapedTrailingBackslashRegex, gemojiRegex, htmlEntityRegex, } from '../core/constants.js';
|
|
9
|
+
import { URL_RULE_DOCS, punctuation as defaultPunctuation, asciiPunctuationRegex, escapedTrailingBackslashRegex, gemojiRegex, htmlEntityRegex, } from '../core/constants.js';
|
|
10
10
|
// --------------------------------------------------------------------------------
|
|
11
11
|
// Helper
|
|
12
12
|
// --------------------------------------------------------------------------------
|
|
@@ -174,6 +174,8 @@ export default {
|
|
|
174
174
|
Number(
|
|
175
175
|
// When `leadingSpaces` is `''` (empty string), check for an escaped trailing backslash.
|
|
176
176
|
!leadingSpaces &&
|
|
177
|
+
// The preceding backslash is an escape only when the punctuation is escapable.
|
|
178
|
+
asciiPunctuationRegex.test(trailingPunctuation[0]) &&
|
|
177
179
|
escapedTrailingBackslashRegex.test(lastChildText.slice(0, -trailingPunctuation.length))),
|
|
178
180
|
endOffset,
|
|
179
181
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-markdown",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Lint your Markdown with ESLint. Additional rules for use with `@eslint/markdown`.🛠️",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"prepublishOnly": "npm run build",
|
|
60
|
-
"build": "tsc -b tsconfig.build.json && node ../../scripts/build-config.js && tsc -b tsconfig.build.json
|
|
60
|
+
"build": "tsc -b tsconfig.build.json && node ../../scripts/build-config.js && tsc -b tsconfig.build.json",
|
|
61
61
|
"test": "npm run test:types && npm run test:unit",
|
|
62
62
|
"test:types": "tsc -b ./tsconfig.test-d.json",
|
|
63
63
|
"test:unit": "vitest run"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@eslint/markdown": "^8.0.3",
|
|
80
80
|
"@types/mdast": "^4.0.4",
|
|
81
81
|
"@types/unist": "^3.0.3",
|
|
82
|
-
"eslint": "^
|
|
82
|
+
"eslint": "^10.13.0",
|
|
83
83
|
"vitest": "^4.1.9"
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/rules/glossary.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|