@markuplint/ml-core 3.0.0-rc.1 → 3.0.0-rc.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.
Files changed (39) hide show
  1. package/lib/index.d.ts +1 -11
  2. package/lib/ml-core.d.ts +11 -22
  3. package/lib/ml-dom/helper/create-node.d.ts +1 -4
  4. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  5. package/lib/ml-dom/helper/walkers.d.ts +3 -11
  6. package/lib/ml-dom/manipulations/child-node-methods.d.ts +5 -18
  7. package/lib/ml-dom/manipulations/get-children.d.ts +1 -3
  8. package/lib/ml-dom/node/attr.d.ts +89 -89
  9. package/lib/ml-dom/node/block.d.ts +30 -30
  10. package/lib/ml-dom/node/character-data.d.ts +52 -59
  11. package/lib/ml-dom/node/child-node.d.ts +1 -6
  12. package/lib/ml-dom/node/comment.d.ts +12 -15
  13. package/lib/ml-dom/node/document-fragment.d.ts +19 -22
  14. package/lib/ml-dom/node/document-type.d.ts +31 -34
  15. package/lib/ml-dom/node/document.d.ts +1582 -1596
  16. package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
  17. package/lib/ml-dom/node/element.d.ts +1888 -1894
  18. package/lib/ml-dom/node/named-node-map.d.ts +39 -44
  19. package/lib/ml-dom/node/node-list.d.ts +3 -9
  20. package/lib/ml-dom/node/node-store.d.ts +3 -3
  21. package/lib/ml-dom/node/node.d.ts +471 -491
  22. package/lib/ml-dom/node/parent-node.d.ts +57 -66
  23. package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
  24. package/lib/ml-dom/node/text.d.ts +46 -49
  25. package/lib/ml-dom/node/types.d.ts +10 -66
  26. package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -1
  27. package/lib/ml-dom/token/token.d.ts +44 -44
  28. package/lib/ml-rule/create-test-rule.d.ts +3 -5
  29. package/lib/ml-rule/ml-rule-context.d.ts +47 -55
  30. package/lib/ml-rule/ml-rule.d.ts +22 -24
  31. package/lib/ml-rule/ml-rule.js +7 -8
  32. package/lib/ml-rule/types.d.ts +12 -18
  33. package/lib/plugin/types.d.ts +5 -5
  34. package/lib/ruleset/index.d.ts +4 -4
  35. package/lib/test/index.d.ts +7 -19
  36. package/lib/types.d.ts +7 -7
  37. package/lib/utils/get-location-from-chars.d.ts +4 -9
  38. package/package.json +10 -10
  39. package/tsconfig.tsbuildinfo +1 -1
@@ -44,7 +44,7 @@ class MLRule {
44
44
  disabled: !configSettings,
45
45
  severity: this.defaultSeverity,
46
46
  value: this.defaultValue,
47
- option: this.defaultOptions,
47
+ options: this.defaultOptions,
48
48
  reason: undefined,
49
49
  };
50
50
  }
@@ -53,8 +53,8 @@ class MLRule {
53
53
  disabled: false,
54
54
  severity: configSettings.severity || this.defaultSeverity,
55
55
  value: configSettings.value !== undefined ? configSettings.value : this.defaultValue,
56
- option: Array.isArray(this.defaultOptions)
57
- ? configSettings.option
56
+ options: Array.isArray(this.defaultOptions)
57
+ ? configSettings.options
58
58
  ? // prettier-ignore
59
59
  // @ts-ignore for "as" casting
60
60
  this.defaultOptions.concat(configSettings.option)
@@ -62,18 +62,17 @@ class MLRule {
62
62
  : this.defaultOptions !== null &&
63
63
  typeof this.defaultOptions === 'object' &&
64
64
  // for example `configSettings.option === true`
65
- (configSettings.option == null || typeof configSettings.option === 'object')
66
- ? { ...this.defaultOptions, ...(configSettings.option || {}) }
67
- : configSettings.option || this.defaultOptions,
65
+ (configSettings.options == null || typeof configSettings.options === 'object')
66
+ ? { ...this.defaultOptions, ...(configSettings.options || {}) }
67
+ : configSettings.options || this.defaultOptions,
68
68
  reason: configSettings.reason,
69
69
  };
70
70
  }
71
71
  return {
72
72
  disabled: false,
73
73
  severity: this.defaultSeverity,
74
- // @ts-ignore TODO: Wait for fix to bug of type guards in TypeScript
75
74
  value: configSettings == null ? this.defaultValue : configSettings,
76
- option: this.defaultOptions,
75
+ options: this.defaultOptions,
77
76
  reason: undefined,
78
77
  };
79
78
  }
@@ -3,24 +3,18 @@ import type { MLRuleContext } from './ml-rule-context';
3
3
  import type { Translator } from '@markuplint/i18n';
4
4
  import type { Report, RuleConfigValue, Severity } from '@markuplint/ml-config';
5
5
  export type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
6
- defaultSeverity?: Severity;
7
- defaultValue?: T;
8
- defaultOptions?: O;
9
- verify(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
10
- fix?(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
6
+ defaultSeverity?: Severity;
7
+ defaultValue?: T;
8
+ defaultOptions?: O;
9
+ verify(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
10
+ fix?(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
11
11
  };
12
- export type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
13
- params: P,
14
- ) => CheckerReport<T, O>;
15
- export type ElementChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
16
- params: P & {
17
- el: Element<T, O>;
18
- },
19
- ) => CheckerReport<T, O>;
20
- export type AttrChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
21
- params: P & {
22
- attr: Attr<T, O>;
23
- },
24
- ) => CheckerReport<T, O>;
12
+ export type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P) => CheckerReport<T, O>;
13
+ export type ElementChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
14
+ el: Element<T, O>;
15
+ }) => CheckerReport<T, O>;
16
+ export type AttrChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
17
+ attr: Attr<T, O>;
18
+ }) => CheckerReport<T, O>;
25
19
  export type CheckerReport<T extends RuleConfigValue, O = null> = (t: Translator) => Report<T, O> | undefined | null;
26
20
  export 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 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 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 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 childNodeRules: ReadonlyArray<ChildNodeRule>;
4
- readonly nodeRules: ReadonlyArray<NodeRule>;
5
- readonly rules: Readonly<Rules>;
6
- constructor(config: Config);
3
+ readonly childNodeRules: ReadonlyArray<ChildNodeRule>;
4
+ readonly nodeRules: ReadonlyArray<NodeRule>;
5
+ readonly rules: Readonly<Rules>;
6
+ constructor(config: Config);
7
7
  }
@@ -3,26 +3,14 @@ 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 type CreateTestOptions = {
6
- config?: Config;
7
- parser?: MLMarkupLanguageParser;
8
- specs?: MLMLSpec;
6
+ config?: Config;
7
+ parser?: MLMarkupLanguageParser;
8
+ specs?: MLMLSpec;
9
9
  };
10
- export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(
11
- sourceCode: string,
12
- options?: CreateTestOptions,
13
- ): Document<T, O>;
14
- export declare function createTestNodeList(
15
- sourceCode: string,
16
- options?: CreateTestOptions,
17
- ): readonly import('../ml-dom/node/node').MLNode<any, any, import('@markuplint/ml-ast').MLASTAbstractNode>[];
18
- export declare function createTestTokenList(
19
- sourceCode: string,
20
- options?: CreateTestOptions,
21
- ): readonly import('../ml-dom/token/token').MLToken<import('@markuplint/ml-ast').MLToken>[];
22
- export declare function createTestElement(
23
- sourceCode: string,
24
- options?: CreateTestOptions,
25
- ): import('../ml-dom').Element<any, any>;
10
+ export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(sourceCode: string, options?: CreateTestOptions): Document<T, O>;
11
+ export declare function createTestNodeList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/node/node").MLNode<any, any, import("@markuplint/ml-ast").MLASTAbstractNode>[];
12
+ export declare function createTestTokenList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/token/token").MLToken<import("@markuplint/ml-ast").MLToken>[];
13
+ export declare function createTestElement(sourceCode: string, options?: CreateTestOptions): import("../ml-dom").Element<any, any>;
26
14
  /**
27
15
  * for test suite
28
16
  */
package/lib/types.d.ts CHANGED
@@ -6,11 +6,11 @@ import type { Pretender } from '@markuplint/ml-config';
6
6
  import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
7
7
  export type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
8
8
  export type MLFabric = {
9
- parser: MLMarkupLanguageParser;
10
- ruleset: Partial<Ruleset>;
11
- rules: AnyMLRule[];
12
- locale: LocaleSet;
13
- schemas: MLSchema;
14
- parserOptions: ParserOptions;
15
- pretenders: Pretender[];
9
+ parser: MLMarkupLanguageParser;
10
+ ruleset: Partial<Ruleset>;
11
+ rules: AnyMLRule[];
12
+ locale: LocaleSet;
13
+ schemas: MLSchema;
14
+ parserOptions: ParserOptions;
15
+ pretenders: Pretender[];
16
16
  };
@@ -1,12 +1,7 @@
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(
7
- searches: string[],
8
- text: string,
9
- currentLine: number,
10
- currentCol: number,
11
- ): Location[];
6
+ export declare function getLocationFromChars(searches: string[], text: string, currentLine: number, currentCol: number): Location[];
12
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-core",
3
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0-rc.2",
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,19 +17,19 @@
17
17
  "clean": "tsc --build --clean"
18
18
  },
19
19
  "dependencies": {
20
- "@markuplint/config-presets": "3.0.0-rc.1",
21
- "@markuplint/i18n": "3.0.0-rc.1",
22
- "@markuplint/ml-ast": "3.0.0-rc.1",
23
- "@markuplint/ml-config": "3.0.0-rc.1",
24
- "@markuplint/ml-spec": "3.0.0-rc.1",
25
- "@markuplint/parser-utils": "3.0.0-rc.1",
26
- "@markuplint/selector": "3.0.0-rc.1",
20
+ "@markuplint/config-presets": "3.0.0-rc.2",
21
+ "@markuplint/i18n": "3.0.0-rc.2",
22
+ "@markuplint/ml-ast": "3.0.0-rc.2",
23
+ "@markuplint/ml-config": "3.0.0-rc.2",
24
+ "@markuplint/ml-spec": "3.0.0-rc.2",
25
+ "@markuplint/parser-utils": "3.0.0-rc.2",
26
+ "@markuplint/selector": "3.0.0-rc.2",
27
27
  "debug": "^4.3.4",
28
28
  "tslib": "^2.4.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@markuplint/html-parser": "3.0.0-rc.1",
31
+ "@markuplint/html-parser": "3.0.0-rc.2",
32
32
  "@types/debug": "^4.1.7"
33
33
  },
34
- "gitHead": "f0d1cd3216c171949c6e6be0d4388a760bd5d37b"
34
+ "gitHead": "27a5c8d136f4b0cf8452552cff529dd0a4db6bba"
35
35
  }