@markuplint/ml-config 5.0.0-alpha.0 → 5.0.0-alpha.2
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/CHANGELOG.md +10 -0
- package/lib/types.d.ts +44 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-alpha.2](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-02-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **ml-config:** add autofix type definitions ([d7149c3](https://github.com/markuplint/markuplint/commit/d7149c319fe5f24dc96bfcbd5d83206c0f8e61ed))
|
|
11
|
+
|
|
12
|
+
# [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @markuplint/ml-config
|
|
15
|
+
|
|
6
16
|
# [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/lib/types.d.ts
CHANGED
|
@@ -431,6 +431,7 @@ export type Report<T extends RuleConfigValue, O extends PlainData = undefined> =
|
|
|
431
431
|
export type Report1<T extends RuleConfigValue, O extends PlainData = undefined> = {
|
|
432
432
|
readonly message: string;
|
|
433
433
|
readonly scope: Scope<T, O>;
|
|
434
|
+
readonly fix?: (fixer: IRuleFixer) => TextEdit | readonly TextEdit[];
|
|
434
435
|
};
|
|
435
436
|
/**
|
|
436
437
|
* A coordinate-based violation report with explicit line, column, and raw text.
|
|
@@ -440,6 +441,7 @@ export type Report2 = {
|
|
|
440
441
|
readonly line: number;
|
|
441
442
|
readonly col: number;
|
|
442
443
|
readonly raw: string;
|
|
444
|
+
readonly fix?: (fixer: IRuleFixer) => TextEdit | readonly TextEdit[];
|
|
443
445
|
};
|
|
444
446
|
/**
|
|
445
447
|
* Identifies the location and rule context of a reported violation.
|
|
@@ -453,6 +455,46 @@ export type Scope<T extends RuleConfigValue, O extends PlainData = undefined> =
|
|
|
453
455
|
readonly startCol: number;
|
|
454
456
|
readonly raw: string;
|
|
455
457
|
};
|
|
458
|
+
/**
|
|
459
|
+
* A text range replacement on the source code.
|
|
460
|
+
* Used by the autofix system to describe edits.
|
|
461
|
+
*/
|
|
462
|
+
export type TextEdit = {
|
|
463
|
+
/** 0-based character offsets (UTF-16 code units): [start, end) */
|
|
464
|
+
readonly range: readonly [start: number, end: number];
|
|
465
|
+
/** Replacement text (empty string = deletion) */
|
|
466
|
+
readonly text: string;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Fix information attached to a {@link Violation}.
|
|
470
|
+
* Contains one or more {@link TextEdit}s to apply to the source.
|
|
471
|
+
*/
|
|
472
|
+
export type FixData = {
|
|
473
|
+
readonly edits: readonly TextEdit[];
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* A helper interface for building {@link TextEdit}s inside a fix callback.
|
|
477
|
+
* Passed to the `fix` function on {@link Report1} and {@link Report2}.
|
|
478
|
+
*/
|
|
479
|
+
export interface IRuleFixer {
|
|
480
|
+
replaceText(token: {
|
|
481
|
+
readonly startOffset: number;
|
|
482
|
+
readonly raw: string;
|
|
483
|
+
}, text: string): TextEdit;
|
|
484
|
+
replaceRange(range: readonly [number, number], text: string): TextEdit;
|
|
485
|
+
insertBefore(token: {
|
|
486
|
+
readonly startOffset: number;
|
|
487
|
+
}, text: string): TextEdit;
|
|
488
|
+
insertAfter(token: {
|
|
489
|
+
readonly startOffset: number;
|
|
490
|
+
readonly raw: string;
|
|
491
|
+
}, text: string): TextEdit;
|
|
492
|
+
remove(token: {
|
|
493
|
+
readonly startOffset: number;
|
|
494
|
+
readonly raw: string;
|
|
495
|
+
}): TextEdit;
|
|
496
|
+
removeRange(range: readonly [number, number]): TextEdit;
|
|
497
|
+
}
|
|
456
498
|
/**
|
|
457
499
|
* A fully resolved lint violation with all information needed for reporting.
|
|
458
500
|
*/
|
|
@@ -472,6 +514,8 @@ export type Violation = {
|
|
|
472
514
|
readonly line: number;
|
|
473
515
|
readonly col: number;
|
|
474
516
|
readonly raw: string;
|
|
517
|
+
/** Fix information for autofix. Present only when the rule provides a fix callback. */
|
|
518
|
+
readonly fix?: FixData;
|
|
475
519
|
};
|
|
476
520
|
/**
|
|
477
521
|
* Resolved rule information after configuration merging, used at runtime by rules.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-config",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
4
4
|
"description": "JSON Schema and TypeScript types of markuplint configure JSON",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"clean": "tsc --build --clean tsconfig.build.json"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@markuplint/ml-ast": "5.0.0-alpha.
|
|
31
|
-
"@markuplint/ml-spec": "5.0.0-alpha.
|
|
32
|
-
"@markuplint/selector": "5.0.0-alpha.
|
|
33
|
-
"@markuplint/shared": "5.0.0-alpha.
|
|
30
|
+
"@markuplint/ml-ast": "5.0.0-alpha.2",
|
|
31
|
+
"@markuplint/ml-spec": "5.0.0-alpha.2",
|
|
32
|
+
"@markuplint/selector": "5.0.0-alpha.2",
|
|
33
|
+
"@markuplint/shared": "5.0.0-alpha.2",
|
|
34
34
|
"@types/mustache": "4.2.6",
|
|
35
35
|
"is-plain-object": "5.0.0",
|
|
36
36
|
"mustache": "4.2.0",
|
|
37
37
|
"type-fest": "5.4.4"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "31ccf1e81443ea3f93597d287595211f1823ddcf"
|
|
40
40
|
}
|