@markuplint/ml-core 2.0.0-rc.6 → 2.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.
Files changed (38) hide show
  1. package/README.md +0 -15
  2. package/lib/ml-core.d.ts +11 -11
  3. package/lib/ml-dom/document.d.ts +66 -57
  4. package/lib/ml-dom/helper/create-node.d.ts +5 -1
  5. package/lib/ml-dom/helper/debug.d.ts +4 -1
  6. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  7. package/lib/ml-dom/helper/mapped-nodes.d.ts +51 -3
  8. package/lib/ml-dom/helper/match-selector.d.ts +10 -6
  9. package/lib/ml-dom/helper/node-store.d.ts +6 -3
  10. package/lib/ml-dom/helper/selector.d.ts +3 -3
  11. package/lib/ml-dom/helper/walkers.d.ts +7 -2
  12. package/lib/ml-dom/index.d.ts +10 -1
  13. package/lib/ml-dom/rule-mapper.d.ts +7 -7
  14. package/lib/ml-dom/tokens/abstract-element.d.ts +40 -36
  15. package/lib/ml-dom/tokens/attribute.d.ts +36 -36
  16. package/lib/ml-dom/tokens/comment.d.ts +5 -2
  17. package/lib/ml-dom/tokens/doctype.d.ts +10 -7
  18. package/lib/ml-dom/tokens/element-close-tag.d.ts +19 -16
  19. package/lib/ml-dom/tokens/element.d.ts +18 -15
  20. package/lib/ml-dom/tokens/node.d.ts +23 -16
  21. package/lib/ml-dom/tokens/omitted-element.d.ts +7 -4
  22. package/lib/ml-dom/tokens/preprocessor-specific-attribute.d.ts +20 -20
  23. package/lib/ml-dom/tokens/preprocessor-specific-block.d.ts +8 -5
  24. package/lib/ml-dom/tokens/text.d.ts +9 -6
  25. package/lib/ml-dom/tokens/token.d.ts +13 -13
  26. package/lib/ml-dom/types.d.ts +35 -13
  27. package/lib/ml-error/ml-parse-error.d.ts +5 -5
  28. package/lib/ml-rule/create-test-rule.d.ts +5 -3
  29. package/lib/ml-rule/ml-rule-context.d.ts +52 -44
  30. package/lib/ml-rule/ml-rule.d.ts +33 -23
  31. package/lib/ml-rule/types.d.ts +5 -5
  32. package/lib/plugin/types.d.ts +5 -5
  33. package/lib/ruleset/index.d.ts +4 -4
  34. package/lib/test/index.d.ts +14 -5
  35. package/lib/types.d.ts +6 -6
  36. package/lib/utils/get-location-from-chars.d.ts +9 -4
  37. package/package.json +10 -10
  38. package/tsconfig.tsbuildinfo +1 -1
@@ -5,19 +5,22 @@ import type { MLASTElement, MLToken } from '@markuplint/ml-ast';
5
5
  import type { RuleConfigValue } from '@markuplint/ml-config';
6
6
  import MLDOMAbstractElement from './abstract-element';
7
7
  import MLDOMToken from './token';
8
- export default class MLDOMElement<T extends RuleConfigValue, O = null> extends MLDOMAbstractElement<T, O, MLASTElement> implements IMLDOMElement {
9
- #private;
10
- readonly type = "Element";
11
- readonly hasSpreadAttr: boolean;
12
- readonly closeTag: MLDOMElementCloseTag<T, O> | null;
13
- readonly selfClosingSolidus: MLDOMToken<MLToken> | null;
14
- readonly endSpace: MLDOMToken<MLToken> | null;
15
- constructor(astNode: MLASTElement, document: Document<T, O>);
16
- get raw(): string;
17
- querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
18
- getNameLocation(): {
19
- offset: number;
20
- line: number;
21
- col: number;
22
- };
8
+ export default class MLDOMElement<T extends RuleConfigValue, O = null>
9
+ extends MLDOMAbstractElement<T, O, MLASTElement>
10
+ implements IMLDOMElement
11
+ {
12
+ #private;
13
+ readonly type = 'Element';
14
+ readonly hasSpreadAttr: boolean;
15
+ readonly closeTag: MLDOMElementCloseTag<T, O> | null;
16
+ readonly selfClosingSolidus: MLDOMToken<MLToken> | null;
17
+ readonly endSpace: MLDOMToken<MLToken> | null;
18
+ constructor(astNode: MLASTElement, document: Document<T, O>);
19
+ get raw(): string;
20
+ querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
21
+ getNameLocation(): {
22
+ offset: number;
23
+ line: number;
24
+ col: number;
25
+ };
23
26
  }
@@ -5,20 +5,27 @@ import type { MLDOMElement, MLDOMOmittedElement, MLDOMPreprocessorSpecificBlock
5
5
  import type { MLASTAbstructNode } from '@markuplint/ml-ast';
6
6
  import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config';
7
7
  import MLDOMToken from './token';
8
- export default abstract class MLDOMNode<T extends RuleConfigValue, O = null, A extends MLASTAbstructNode = MLASTAbstructNode> extends MLDOMToken<A> implements IMLDOMNode {
9
- #private;
10
- readonly type: NodeType;
11
- readonly rules: Record<string, AnyRule>;
12
- protected _astToken: A;
13
- constructor(astNode: A, document: Document<T, O>);
14
- get parentNode(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
15
- get prevNode(): AnonymousNode<T, O> | null;
16
- get nextNode(): AnonymousNode<T, O> | null;
17
- get syntaxicalParentNode(): MLDOMElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
18
- get prevToken(): AnonymousNode<T, O> | null;
19
- get nodeStore(): import("../helper").NodeStore;
20
- get rule(): RuleInfo<T, O>;
21
- getParentElement(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
22
- is(type: NodeType): boolean;
23
- toString(): string;
8
+ export default abstract class MLDOMNode<
9
+ T extends RuleConfigValue,
10
+ O = null,
11
+ A extends MLASTAbstructNode = MLASTAbstructNode,
12
+ >
13
+ extends MLDOMToken<A>
14
+ implements IMLDOMNode
15
+ {
16
+ #private;
17
+ readonly type: NodeType;
18
+ readonly rules: Record<string, AnyRule>;
19
+ protected _astToken: A;
20
+ constructor(astNode: A, document: Document<T, O>);
21
+ get parentNode(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
22
+ get prevNode(): AnonymousNode<T, O> | null;
23
+ get nextNode(): AnonymousNode<T, O> | null;
24
+ get syntaxicalParentNode(): MLDOMElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
25
+ get prevToken(): AnonymousNode<T, O> | null;
26
+ get nodeStore(): import('../helper').NodeStore;
27
+ get rule(): RuleInfo<T, O>;
28
+ getParentElement(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
29
+ is(type: NodeType): boolean;
30
+ toString(): string;
24
31
  }
@@ -3,8 +3,11 @@ import type { IMLDOMOmittedElement } from '../types';
3
3
  import type { MLASTOmittedElement } from '@markuplint/ml-ast';
4
4
  import type { RuleConfigValue } from '@markuplint/ml-config';
5
5
  import MLDOMAbstractElement from './abstract-element';
6
- export default class MLDOMOmittedElement<T extends RuleConfigValue, O = null> extends MLDOMAbstractElement<T, O, MLASTOmittedElement> implements IMLDOMOmittedElement {
7
- readonly type = "OmittedElement";
8
- obsolete: boolean;
9
- constructor(astNode: MLASTOmittedElement, document: Document<T, O>);
6
+ export default class MLDOMOmittedElement<T extends RuleConfigValue, O = null>
7
+ extends MLDOMAbstractElement<T, O, MLASTOmittedElement>
8
+ implements IMLDOMOmittedElement
9
+ {
10
+ readonly type = 'OmittedElement';
11
+ obsolete: boolean;
12
+ constructor(astNode: MLASTOmittedElement, document: Document<T, O>);
10
13
  }
@@ -1,24 +1,24 @@
1
1
  import type { MLASTPreprocessorSpecificAttr } from '@markuplint/ml-ast';
2
2
  import MLDOMToken from './token';
3
3
  export default class MLDOMPreprocessorSpecificAttribute extends MLDOMToken<MLASTPreprocessorSpecificAttr> {
4
- readonly attrType = "ps-attr";
5
- readonly potentialName: string;
6
- readonly potentialValue: string;
7
- readonly valueType: 'string' | 'number' | 'boolean' | 'code';
8
- readonly isDuplicatable: boolean;
9
- constructor(astToken: MLASTPreprocessorSpecificAttr);
10
- getName(): {
11
- line: number;
12
- col: number;
13
- potential: string;
14
- raw: string;
15
- };
16
- getValue(): {
17
- line: number;
18
- col: number;
19
- potential: string;
20
- raw: string;
21
- };
22
- toString(): string;
23
- toNormalizeString(): string;
4
+ readonly attrType = 'ps-attr';
5
+ readonly potentialName: string;
6
+ readonly potentialValue: string;
7
+ readonly valueType: 'string' | 'number' | 'boolean' | 'code';
8
+ readonly isDuplicatable: boolean;
9
+ constructor(astToken: MLASTPreprocessorSpecificAttr);
10
+ getName(): {
11
+ line: number;
12
+ col: number;
13
+ potential: string;
14
+ raw: string;
15
+ };
16
+ getValue(): {
17
+ line: number;
18
+ col: number;
19
+ potential: string;
20
+ raw: string;
21
+ };
22
+ toString(): string;
23
+ toNormalizeString(): string;
24
24
  }
@@ -3,9 +3,12 @@ import type { IMLDOMPreprocessorSpecificBlock } from '../types';
3
3
  import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
4
4
  import type { RuleConfigValue } from '@markuplint/ml-config';
5
5
  import MLDOMNode from './node';
6
- export default class MLDOMPreprocessorSpecificBlock<T extends RuleConfigValue, O = null> extends MLDOMNode<T, O, MLASTPreprocessorSpecificBlock> implements IMLDOMPreprocessorSpecificBlock {
7
- readonly type = "PSBlock";
8
- readonly nodeName: string;
9
- constructor(astNode: MLASTPreprocessorSpecificBlock, document: Document<T, O>);
10
- get childNodes(): AnonymousNode<T, O>[];
6
+ export default class MLDOMPreprocessorSpecificBlock<T extends RuleConfigValue, O = null>
7
+ extends MLDOMNode<T, O, MLASTPreprocessorSpecificBlock>
8
+ implements IMLDOMPreprocessorSpecificBlock
9
+ {
10
+ readonly type = 'PSBlock';
11
+ readonly nodeName: string;
12
+ constructor(astNode: MLASTPreprocessorSpecificBlock, document: Document<T, O>);
13
+ get childNodes(): AnonymousNode<T, O>[];
11
14
  }
@@ -4,10 +4,13 @@ import type { MLASTText } from '@markuplint/ml-ast';
4
4
  import type { RuleConfigValue } from '@markuplint/ml-config';
5
5
  import type { ContentModel } from '@markuplint/ml-spec';
6
6
  import MLDOMNode from './node';
7
- export default class MLDOMText<T extends RuleConfigValue, O = null> extends MLDOMNode<T, O, MLASTText> implements IMLDOMText {
8
- readonly type = "Text";
9
- readonly isRawText: boolean;
10
- readonly ownModels: Set<ContentModel>;
11
- constructor(astNode: MLASTText, document: Document<T, O>);
12
- isWhitespace(): boolean;
7
+ export default class MLDOMText<T extends RuleConfigValue, O = null>
8
+ extends MLDOMNode<T, O, MLASTText>
9
+ implements IMLDOMText
10
+ {
11
+ readonly type = 'Text';
12
+ readonly isRawText: boolean;
13
+ readonly ownModels: Set<ContentModel>;
14
+ constructor(astNode: MLASTText, document: Document<T, O>);
15
+ isWhitespace(): boolean;
13
16
  }
@@ -1,16 +1,16 @@
1
1
  import type { MLToken } from '@markuplint/ml-ast';
2
2
  export default class MLDOMToken<A extends MLToken> {
3
- #private;
4
- readonly uuid: string;
5
- protected readonly _astToken: A;
6
- constructor(astToken: A);
7
- get originRaw(): string;
8
- get raw(): string;
9
- get startOffset(): number;
10
- get endOffset(): number;
11
- get startLine(): number;
12
- get endLine(): number;
13
- get startCol(): number;
14
- get endCol(): number;
15
- fix(raw: string): void;
3
+ #private;
4
+ readonly uuid: string;
5
+ protected readonly _astToken: A;
6
+ constructor(astToken: A);
7
+ get originRaw(): string;
8
+ get raw(): string;
9
+ get startOffset(): number;
10
+ get endOffset(): number;
11
+ get startLine(): number;
12
+ get endLine(): number;
13
+ get startCol(): number;
14
+ get endCol(): number;
15
+ fix(raw: string): void;
16
16
  }
@@ -1,27 +1,49 @@
1
- import type { MLDOMComment, MLDOMDoctype, MLDOMElement, MLDOMElementCloseTag, MLDOMOmittedElement, MLDOMPreprocessorSpecificBlock, MLDOMText } from './tokens';
1
+ import type {
2
+ MLDOMComment,
3
+ MLDOMDoctype,
4
+ MLDOMElement,
5
+ MLDOMElementCloseTag,
6
+ MLDOMOmittedElement,
7
+ MLDOMPreprocessorSpecificBlock,
8
+ MLDOMText,
9
+ } from './tokens';
2
10
  import type { RuleConfigValue } from '@markuplint/ml-config';
3
11
  export interface IMLDOMDoctype extends IMLDOMNode {
4
- type: 'Doctype';
12
+ type: 'Doctype';
5
13
  }
6
14
  export interface IMLDOMElement extends IMLDOMNode {
7
- type: 'Element';
15
+ type: 'Element';
8
16
  }
9
17
  export interface IMLDOMElementCloseTag extends IMLDOMNode {
10
- type: 'ElementCloseTag';
18
+ type: 'ElementCloseTag';
11
19
  }
12
20
  export interface IMLDOMOmittedElement extends IMLDOMNode {
13
- type: 'OmittedElement';
21
+ type: 'OmittedElement';
14
22
  }
15
23
  export interface IMLDOMComment extends IMLDOMNode {
16
- type: 'Comment';
24
+ type: 'Comment';
17
25
  }
18
26
  export interface IMLDOMText extends IMLDOMNode {
19
- type: 'Text';
27
+ type: 'Text';
20
28
  }
21
29
  export interface IMLDOMPreprocessorSpecificBlock extends IMLDOMNode {
22
- type: 'PSBlock';
23
- }
24
- export interface IMLDOMNode {
25
- }
26
- export declare type AnonymousNode<T extends RuleConfigValue, O = null> = MLDOMDoctype<T, O> | MLDOMElement<T, O> | MLDOMElementCloseTag<T, O> | MLDOMOmittedElement<T, O> | MLDOMComment<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | MLDOMText<T, O>;
27
- export declare type NodeType = 'Doctype' | 'Element' | 'ElementCloseTag' | 'OmittedElement' | 'Comment' | 'Text' | 'Node' | 'PSBlock';
30
+ type: 'PSBlock';
31
+ }
32
+ export interface IMLDOMNode {}
33
+ export declare type AnonymousNode<T extends RuleConfigValue, O = null> =
34
+ | MLDOMDoctype<T, O>
35
+ | MLDOMElement<T, O>
36
+ | MLDOMElementCloseTag<T, O>
37
+ | MLDOMOmittedElement<T, O>
38
+ | MLDOMComment<T, O>
39
+ | MLDOMPreprocessorSpecificBlock<T, O>
40
+ | MLDOMText<T, O>;
41
+ export declare type NodeType =
42
+ | 'Doctype'
43
+ | 'Element'
44
+ | 'ElementCloseTag'
45
+ | 'OmittedElement'
46
+ | 'Comment'
47
+ | 'Text'
48
+ | 'Node'
49
+ | 'PSBlock';
@@ -1,7 +1,7 @@
1
1
  export default class MLParseError extends Error {
2
- readonly line: number;
3
- readonly col: number;
4
- readonly raw: string;
5
- readonly nodeName: string;
6
- constructor(line: number, col: number, raw: string, nodeName: string);
2
+ readonly line: number;
3
+ readonly col: number;
4
+ readonly raw: string;
5
+ readonly nodeName: string;
6
+ constructor(line: number, col: number, raw: string, nodeName: string);
7
7
  }
@@ -1,6 +1,8 @@
1
1
  import type { RuleSeed } from './types';
2
2
  import type { RuleConfigValue } from '@markuplint/ml-config';
3
3
  import { MLRule } from './ml-rule';
4
- export declare function createRule<T extends RuleConfigValue, O = null>(seed: RuleSeed<T, O> & {
5
- name: string;
6
- }): MLRule<T, O>;
4
+ export declare function createRule<T extends RuleConfigValue, O = null>(
5
+ seed: RuleSeed<T, O> & {
6
+ name: string;
7
+ },
8
+ ): MLRule<T, O>;
@@ -2,48 +2,56 @@ import type Document from '../ml-dom/document';
2
2
  import type { LocaleSet, Translator } from '@markuplint/i18n';
3
3
  import type { Report, RuleConfigValue, RuleInfo } from '@markuplint/ml-config';
4
4
  export declare class MLRuleContext<T extends RuleConfigValue, O = null> {
5
- #private;
6
- readonly document: Document<T, O>;
7
- readonly globalRule: RuleInfo<T, O>;
8
- readonly translate: Translator;
9
- readonly locale: string;
10
- constructor(document: Document<T, O>, locale: LocaleSet, rule: RuleInfo<T, O>);
11
- get reports(): ({
12
- message: string;
13
- line: number;
14
- col: number;
15
- raw: string;
16
- } | {
17
- message: string;
18
- scope: import("@markuplint/ml-config").Scope<T, O>;
19
- } | {
20
- message: string;
21
- scope: import("@markuplint/ml-config").Scope<T, O>;
22
- line: number;
23
- col: number;
24
- raw: string;
25
- })[];
26
- report(report: Report<T, O>): void;
27
- provide(): {
28
- document: Document<T, O>;
29
- translate: Translator;
30
- t: Translator;
31
- globalRule: RuleInfo<T, O>;
32
- reports: ({
33
- message: string;
34
- line: number;
35
- col: number;
36
- raw: string;
37
- } | {
38
- message: string;
39
- scope: import("@markuplint/ml-config").Scope<T, O>;
40
- } | {
41
- message: string;
42
- scope: import("@markuplint/ml-config").Scope<T, O>;
43
- line: number;
44
- col: number;
45
- raw: string;
46
- })[];
47
- report: (report: Report<T, O>) => void;
48
- };
5
+ #private;
6
+ readonly document: Document<T, O>;
7
+ readonly globalRule: RuleInfo<T, O>;
8
+ readonly translate: Translator;
9
+ readonly locale: string;
10
+ constructor(document: Document<T, O>, locale: LocaleSet, rule: RuleInfo<T, O>);
11
+ get reports(): (
12
+ | {
13
+ message: string;
14
+ line: number;
15
+ col: number;
16
+ raw: string;
17
+ }
18
+ | {
19
+ message: string;
20
+ scope: import('@markuplint/ml-config').Scope<T, O>;
21
+ }
22
+ | {
23
+ message: string;
24
+ scope: import('@markuplint/ml-config').Scope<T, O>;
25
+ line: number;
26
+ col: number;
27
+ raw: string;
28
+ }
29
+ )[];
30
+ report(report: Report<T, O>): void;
31
+ provide(): {
32
+ document: Document<T, O>;
33
+ translate: Translator;
34
+ t: Translator;
35
+ globalRule: RuleInfo<T, O>;
36
+ reports: (
37
+ | {
38
+ message: string;
39
+ line: number;
40
+ col: number;
41
+ raw: string;
42
+ }
43
+ | {
44
+ message: string;
45
+ scope: import('@markuplint/ml-config').Scope<T, O>;
46
+ }
47
+ | {
48
+ message: string;
49
+ scope: import('@markuplint/ml-config').Scope<T, O>;
50
+ line: number;
51
+ col: number;
52
+ raw: string;
53
+ }
54
+ )[];
55
+ report: (report: Report<T, O>) => void;
56
+ };
49
57
  }
@@ -2,29 +2,39 @@ import type { Ruleset } from '..';
2
2
  import type Document from '../ml-dom/document';
3
3
  import type { RuleSeed } from './types';
4
4
  import type { LocaleSet } from '@markuplint/i18n';
5
- import type { GlobalRuleInfo, RuleConfig, RuleConfigValue, RuleInfo, Rules, Severity, Violation } from '@markuplint/ml-config';
5
+ import type {
6
+ GlobalRuleInfo,
7
+ RuleConfig,
8
+ RuleConfigValue,
9
+ RuleInfo,
10
+ Rules,
11
+ Severity,
12
+ Violation,
13
+ } from '@markuplint/ml-config';
6
14
  export declare class MLRule<T extends RuleConfigValue, O = null> {
7
- #private;
8
- readonly name: string;
9
- readonly defaultServerity: Severity;
10
- readonly defaultValue: T;
11
- readonly defaultOptions: O;
12
- /**
13
- * The following getter is unused internally,
14
- * only for extending from 3rd party library
15
- */
16
- protected get v(): RuleSeed<T, O>['verify'];
17
- /**
18
- * The following getter is unused internally,
19
- * only for extending from 3rd party library
20
- */
21
- protected get f(): RuleSeed<T, O>['fix'];
22
- constructor(o: RuleSeed<T, O> & {
23
- name: string;
24
- });
25
- verify(document: Document<T, O>, locale: LocaleSet, globalRule: RuleInfo<T, O>, fix: boolean): Promise<Violation[]>;
26
- getRuleInfo(ruleSet: Ruleset, ruleName: string): GlobalRuleInfo<T, O>;
27
- _optimize(rules: Rules | undefined, ruleName: string): RuleInfo<T, O>;
28
- optimizeOption(configSettings: T | RuleConfig<T, O> | undefined): RuleInfo<T, O>;
15
+ #private;
16
+ readonly name: string;
17
+ readonly defaultServerity: Severity;
18
+ readonly defaultValue: T;
19
+ readonly defaultOptions: O;
20
+ /**
21
+ * The following getter is unused internally,
22
+ * only for extending from 3rd party library
23
+ */
24
+ protected get v(): RuleSeed<T, O>['verify'];
25
+ /**
26
+ * The following getter is unused internally,
27
+ * only for extending from 3rd party library
28
+ */
29
+ protected get f(): RuleSeed<T, O>['fix'];
30
+ constructor(
31
+ o: RuleSeed<T, O> & {
32
+ name: string;
33
+ },
34
+ );
35
+ verify(document: Document<T, O>, locale: LocaleSet, globalRule: RuleInfo<T, O>, fix: boolean): Promise<Violation[]>;
36
+ getRuleInfo(ruleSet: Ruleset, ruleName: string): GlobalRuleInfo<T, O>;
37
+ _optimize(rules: Rules | undefined, ruleName: string): RuleInfo<T, O>;
38
+ optimizeOption(configSettings: T | RuleConfig<T, O> | undefined): RuleInfo<T, O>;
29
39
  }
30
40
  export declare type AnyMLRule = MLRule<RuleConfigValue, unknown>;
@@ -1,10 +1,10 @@
1
1
  import type { MLRuleContext } from './ml-rule-context';
2
2
  import type { RuleConfigValue, Severity } from '@markuplint/ml-config';
3
3
  export declare type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
4
- defaultServerity?: Severity;
5
- defaultValue?: T;
6
- defaultOptions?: O;
7
- verify(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
8
- fix?(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
4
+ defaultServerity?: Severity;
5
+ defaultValue?: T;
6
+ defaultOptions?: O;
7
+ verify(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
8
+ fix?(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
9
9
  };
10
10
  export declare type AnyRuleSeed = RuleSeed<any, any>;
@@ -1,12 +1,12 @@
1
1
  import type { AnyRuleSeed } from '../ml-rule';
2
2
  import type { Config } from '@markuplint/ml-config';
3
3
  export declare type Plugin = {
4
- name: string;
5
- rules?: Record<string, AnyRuleSeed>;
6
- configs?: Record<string, Config>;
4
+ name: string;
5
+ rules?: Record<string, AnyRuleSeed>;
6
+ configs?: Record<string, Config>;
7
7
  };
8
8
  export declare type PluginCreator<S extends CreatePluginSettings> = {
9
- name: string;
10
- create(setting: S): Omit<Plugin, 'name'>;
9
+ name: string;
10
+ create(setting: S): Omit<Plugin, 'name'>;
11
11
  };
12
12
  export declare type CreatePluginSettings = Record<string, unknown>;
@@ -1,7 +1,7 @@
1
1
  import type { ChildNodeRule, Config, NodeRule, Rules } from '@markuplint/ml-config';
2
2
  export default class Ruleset {
3
- readonly rules: Readonly<Rules>;
4
- readonly nodeRules: ReadonlyArray<NodeRule>;
5
- readonly childNodeRules: ReadonlyArray<ChildNodeRule>;
6
- constructor(config: Config);
3
+ readonly rules: Readonly<Rules>;
4
+ readonly nodeRules: ReadonlyArray<NodeRule>;
5
+ readonly childNodeRules: ReadonlyArray<ChildNodeRule>;
6
+ constructor(config: Config);
7
7
  }
@@ -3,12 +3,21 @@ import type { Config, RuleConfigValue } from '@markuplint/ml-config';
3
3
  import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
4
4
  import { Document } from '../ml-dom';
5
5
  export declare type CreateTestOptions = {
6
- config?: Config;
7
- parser?: MLMarkupLanguageParser;
6
+ config?: Config;
7
+ parser?: MLMarkupLanguageParser;
8
8
  };
9
- export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(sourceCode: string, options?: CreateTestOptions): Document<T, O>;
10
- export declare function createTestNodeList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom").AnonymousNode<any, any>[];
11
- export declare function createTestElement(sourceCode: string, options?: CreateTestOptions): import("../ml-dom").Element<any, any>;
9
+ export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(
10
+ sourceCode: string,
11
+ options?: CreateTestOptions,
12
+ ): Document<T, O>;
13
+ export declare function createTestNodeList(
14
+ sourceCode: string,
15
+ options?: CreateTestOptions,
16
+ ): readonly import('../ml-dom').AnonymousNode<any, any>[];
17
+ export declare function createTestElement(
18
+ sourceCode: string,
19
+ options?: CreateTestOptions,
20
+ ): import('../ml-dom').Element<any, any>;
12
21
  /**
13
22
  * for test suite
14
23
  */
package/lib/types.d.ts CHANGED
@@ -6,10 +6,10 @@ import type { ParserOptions } from '@markuplint/ml-config';
6
6
  import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
7
7
  export declare type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
8
8
  export declare type MLFabric = {
9
- parser: MLMarkupLanguageParser;
10
- ruleset: Partial<Ruleset>;
11
- rules: AnyMLRule[];
12
- locale: LocaleSet;
13
- schemas: MLSchema;
14
- parserOptions: ParserOptions;
9
+ parser: MLMarkupLanguageParser;
10
+ ruleset: Partial<Ruleset>;
11
+ rules: AnyMLRule[];
12
+ locale: LocaleSet;
13
+ schemas: MLSchema;
14
+ parserOptions: ParserOptions;
15
15
  };
@@ -1,7 +1,12 @@
1
1
  interface Location {
2
- line: number;
3
- col: number;
4
- raw: string;
2
+ line: number;
3
+ col: number;
4
+ raw: string;
5
5
  }
6
- export declare function getLocationFromChars(searches: string[], text: string, currentLine: number, currentCol: number): Location[];
6
+ export declare function getLocationFromChars(
7
+ searches: string[],
8
+ text: string,
9
+ currentLine: number,
10
+ currentCol: number,
11
+ ): Location[];
7
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-core",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.0.0",
4
4
  "description": "The core module of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -17,18 +17,18 @@
17
17
  "clean": "tsc --build --clean"
18
18
  },
19
19
  "dependencies": {
20
- "@markuplint/i18n": "2.0.0-rc.5",
21
- "@markuplint/ml-ast": "2.0.0-rc.6",
22
- "@markuplint/ml-config": "2.0.0-rc.5",
23
- "@markuplint/ml-spec": "2.0.0-rc.6",
24
- "@markuplint/parser-utils": "2.0.0-rc.6",
25
- "debug": "^4.3.2",
26
- "postcss-selector-parser": "^6.0.6",
20
+ "@markuplint/i18n": "2.0.0",
21
+ "@markuplint/ml-ast": "2.0.0",
22
+ "@markuplint/ml-config": "2.0.0",
23
+ "@markuplint/ml-spec": "2.0.0",
24
+ "@markuplint/parser-utils": "2.0.0",
25
+ "debug": "^4.3.3",
26
+ "postcss-selector-parser": "^6.0.9",
27
27
  "tslib": "^2.3.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@markuplint/html-parser": "2.0.0-rc.6",
30
+ "@markuplint/html-parser": "2.0.0",
31
31
  "@types/debug": "^4.1.7"
32
32
  },
33
- "gitHead": "7c93367a86f935f6b94780b1fa14f3293f900b87"
33
+ "gitHead": "de81fc514acdf472f87184e3499e9364258f9b66"
34
34
  }