@markuplint/ml-config
Advanced tools
Comparing version 3.13.0 to 3.14.0
@@ -6,82 +6,90 @@ import type { ParserOptions } from '@markuplint/ml-ast'; | ||
export type Config = { | ||
readonly $schema?: string; | ||
readonly extends?: string | readonly string[]; | ||
readonly plugins?: readonly (PluginConfig | string)[]; | ||
readonly parser?: ParserConfig; | ||
readonly parserOptions?: ParserOptions; | ||
readonly specs?: SpecConfig; | ||
readonly excludeFiles?: readonly string[]; | ||
readonly pretenders?: readonly Pretender[]; | ||
readonly rules?: Rules; | ||
readonly nodeRules?: readonly NodeRule[]; | ||
readonly childNodeRules?: readonly ChildNodeRule[]; | ||
readonly overrides?: Readonly<Record<string, OverrideConfig>>; | ||
readonly $schema?: string; | ||
readonly extends?: string | readonly string[]; | ||
readonly plugins?: readonly (PluginConfig | string)[]; | ||
readonly parser?: ParserConfig; | ||
readonly parserOptions?: ParserOptions; | ||
readonly specs?: SpecConfig; | ||
readonly excludeFiles?: readonly string[]; | ||
readonly pretenders?: readonly Pretender[]; | ||
readonly rules?: Rules; | ||
readonly nodeRules?: readonly NodeRule[]; | ||
readonly childNodeRules?: readonly ChildNodeRule[]; | ||
readonly overrides?: Readonly<Record<string, OverrideConfig>>; | ||
}; | ||
export type PrimitiveScalar = string | number | boolean; | ||
export type PlainData = Nullable<PrimitiveScalar> | readonly PlainData[] | { | ||
readonly [key: string]: PlainData | any; | ||
}; | ||
export type NonNullablePlainData = PrimitiveScalar | readonly NonNullablePlainData[] | { | ||
readonly [key: string]: NonNullablePlainData; | ||
}; | ||
export type PlainData = | ||
| Nullable<PrimitiveScalar> | ||
| readonly PlainData[] | ||
| { | ||
readonly [key: string]: PlainData | any; | ||
}; | ||
export type NonNullablePlainData = | ||
| PrimitiveScalar | ||
| readonly NonNullablePlainData[] | ||
| { | ||
readonly [key: string]: NonNullablePlainData; | ||
}; | ||
export type OverrideConfig = Omit<Config, '$schema' | 'extends' | 'overrides'>; | ||
export type PluginConfig = { | ||
readonly name: string; | ||
readonly settings: Readonly<Record<string, NonNullablePlainData>>; | ||
readonly name: string; | ||
readonly settings: Readonly<Record<string, NonNullablePlainData>>; | ||
}; | ||
export type ParserConfig = { | ||
readonly [extensionPattern: string]: string; | ||
readonly [extensionPattern: string]: string; | ||
}; | ||
export type SpecConfig = { | ||
readonly [extensionPattern: string]: string; | ||
readonly [extensionPattern: string]: string; | ||
}; | ||
export type Pretender = { | ||
/** | ||
* Target node selectors | ||
*/ | ||
readonly selector: string; | ||
/** | ||
* If it is a string, it is resolved as an element name. | ||
* An element has the same attributes as the pretended custom element | ||
* because attributes are just inherited. | ||
* | ||
* If it is an Object, It creates the element by that. | ||
*/ | ||
readonly as: string | OriginalNode; | ||
/** | ||
* Target node selectors | ||
*/ | ||
readonly selector: string; | ||
/** | ||
* If it is a string, it is resolved as an element name. | ||
* An element has the same attributes as the pretended custom element | ||
* because attributes are just inherited. | ||
* | ||
* If it is an Object, It creates the element by that. | ||
*/ | ||
readonly as: string | OriginalNode; | ||
}; | ||
export type OriginalNode = { | ||
/** | ||
* Element name | ||
*/ | ||
readonly element: string; | ||
/** | ||
* Namespace | ||
* | ||
* Supports `"svg"` and `undefined` only. | ||
* If it is `undefined`, the namespace is HTML. | ||
*/ | ||
readonly namespace?: 'svg'; | ||
/** | ||
* Attributes | ||
*/ | ||
readonly attrs?: readonly { | ||
/** | ||
* Attribute name | ||
*/ | ||
readonly name: string; | ||
/** | ||
* If it omits this property, the attribute is resolved as a boolean. | ||
*/ | ||
readonly value?: string | { | ||
readonly fromAttr: string; | ||
}; | ||
}[]; | ||
/** | ||
* To have attributes the defined element has. | ||
*/ | ||
readonly inheritAttrs?: boolean; | ||
/** | ||
* ARIA properties | ||
*/ | ||
readonly aria?: PretenderARIA; | ||
/** | ||
* Element name | ||
*/ | ||
readonly element: string; | ||
/** | ||
* Namespace | ||
* | ||
* Supports `"svg"` and `undefined` only. | ||
* If it is `undefined`, the namespace is HTML. | ||
*/ | ||
readonly namespace?: 'svg'; | ||
/** | ||
* Attributes | ||
*/ | ||
readonly attrs?: readonly { | ||
/** | ||
* Attribute name | ||
*/ | ||
readonly name: string; | ||
/** | ||
* If it omits this property, the attribute is resolved as a boolean. | ||
*/ | ||
readonly value?: | ||
| string | ||
| { | ||
readonly fromAttr: string; | ||
}; | ||
}[]; | ||
/** | ||
* To have attributes the defined element has. | ||
*/ | ||
readonly inheritAttrs?: boolean; | ||
/** | ||
* ARIA properties | ||
*/ | ||
readonly aria?: PretenderARIA; | ||
}; | ||
@@ -92,11 +100,13 @@ /** | ||
export type PretenderARIA = { | ||
/** | ||
* Accessible name | ||
* | ||
* - If it is `true`, it assumes the element has any text on its accessible name. | ||
* - If it specifies `fromAttr` property, it assumes the accessible name refers to the value of the attribute. | ||
*/ | ||
readonly name?: boolean | { | ||
readonly fromAttr: string; | ||
}; | ||
/** | ||
* Accessible name | ||
* | ||
* - If it is `true`, it assumes the element has any text on its accessible name. | ||
* - If it specifies `fromAttr` property, it assumes the accessible name refers to the value of the attribute. | ||
*/ | ||
readonly name?: | ||
| boolean | ||
| { | ||
readonly fromAttr: string; | ||
}; | ||
}; | ||
@@ -107,3 +117,6 @@ export type Rule<T extends RuleConfigValue, O extends PlainData = undefined> = RuleConfig<T, O> | Readonly<T> | boolean; | ||
*/ | ||
export type RuleV2<T extends RuleConfigValue, O extends PlainData = undefined> = RuleConfigV2<T, O> | Readonly<T> | boolean; | ||
export type RuleV2<T extends RuleConfigValue, O extends PlainData = undefined> = | ||
| RuleConfigV2<T, O> | ||
| Readonly<T> | ||
| boolean; | ||
export type AnyRule = Rule<RuleConfigValue, PlainData>; | ||
@@ -115,9 +128,9 @@ /** | ||
export type Rules = { | ||
readonly [ruleName: string]: AnyRule; | ||
readonly [ruleName: string]: AnyRule; | ||
}; | ||
export type RuleConfig<T extends RuleConfigValue, O extends PlainData = undefined> = { | ||
readonly severity?: Severity; | ||
readonly value?: Readonly<T>; | ||
readonly options?: Readonly<O>; | ||
readonly reason?: string; | ||
readonly severity?: Severity; | ||
readonly value?: Readonly<T>; | ||
readonly options?: Readonly<O>; | ||
readonly reason?: string; | ||
}; | ||
@@ -128,12 +141,12 @@ /** | ||
export type RuleConfigV2<T extends RuleConfigValue, O extends PlainData = undefined> = { | ||
readonly severity?: Severity; | ||
readonly value?: Readonly<T>; | ||
readonly reason?: string; | ||
/** | ||
* Old property | ||
* | ||
* @deprecated | ||
* @see {this.options} | ||
*/ | ||
readonly option?: Readonly<O>; | ||
readonly severity?: Severity; | ||
readonly value?: Readonly<T>; | ||
readonly reason?: string; | ||
/** | ||
* Old property | ||
* | ||
* @deprecated | ||
* @see {this.options} | ||
*/ | ||
readonly option?: Readonly<O>; | ||
}; | ||
@@ -143,51 +156,54 @@ export type Severity = 'error' | 'warning' | 'info'; | ||
export type NodeRule = { | ||
readonly selector?: string; | ||
readonly regexSelector?: RegexSelector; | ||
readonly categories?: readonly string[]; | ||
readonly roles?: readonly string[]; | ||
readonly obsolete?: boolean; | ||
readonly rules?: Rules; | ||
readonly selector?: string; | ||
readonly regexSelector?: RegexSelector; | ||
readonly categories?: readonly string[]; | ||
readonly roles?: readonly string[]; | ||
readonly obsolete?: boolean; | ||
readonly rules?: Rules; | ||
}; | ||
export type ChildNodeRule = { | ||
readonly selector?: string; | ||
readonly regexSelector?: RegexSelector; | ||
readonly inheritance?: boolean; | ||
readonly rules?: Rules; | ||
readonly selector?: string; | ||
readonly regexSelector?: RegexSelector; | ||
readonly inheritance?: boolean; | ||
readonly rules?: Rules; | ||
}; | ||
export type Report<T extends RuleConfigValue, O extends PlainData = undefined> = Report1<T, O> | Report2 | (Report1<T, O> & Report2); | ||
export type Report<T extends RuleConfigValue, O extends PlainData = undefined> = | ||
| Report1<T, O> | ||
| Report2 | ||
| (Report1<T, O> & Report2); | ||
export type Report1<T extends RuleConfigValue, O extends PlainData = undefined> = { | ||
readonly message: string; | ||
readonly scope: Scope<T, O>; | ||
readonly message: string; | ||
readonly scope: Scope<T, O>; | ||
}; | ||
export type Report2 = { | ||
readonly message: string; | ||
readonly line: number; | ||
readonly col: number; | ||
readonly raw: string; | ||
readonly message: string; | ||
readonly line: number; | ||
readonly col: number; | ||
readonly raw: string; | ||
}; | ||
export type Scope<T extends RuleConfigValue, O extends PlainData = undefined> = { | ||
readonly rule: RuleInfo<T, O>; | ||
readonly startLine: number; | ||
readonly startCol: number; | ||
readonly raw: string; | ||
readonly rule: RuleInfo<T, O>; | ||
readonly startLine: number; | ||
readonly startCol: number; | ||
readonly raw: string; | ||
}; | ||
export type Violation = { | ||
readonly ruleId: string; | ||
readonly severity: Severity; | ||
readonly message: string; | ||
readonly reason?: string; | ||
readonly line: number; | ||
readonly col: number; | ||
readonly raw: string; | ||
readonly ruleId: string; | ||
readonly severity: Severity; | ||
readonly message: string; | ||
readonly reason?: string; | ||
readonly line: number; | ||
readonly col: number; | ||
readonly raw: string; | ||
}; | ||
export type RuleInfo<T extends RuleConfigValue, O extends PlainData = undefined> = { | ||
readonly disabled: boolean; | ||
readonly severity: Severity; | ||
readonly value: Readonly<T>; | ||
readonly options: Readonly<O>; | ||
readonly reason?: string; | ||
readonly disabled: boolean; | ||
readonly severity: Severity; | ||
readonly value: Readonly<T>; | ||
readonly options: Readonly<O>; | ||
readonly reason?: string; | ||
}; | ||
export type GlobalRuleInfo<T extends RuleConfigValue, O extends PlainData = undefined> = RuleInfo<T, O> & { | ||
nodeRules: RuleInfo<T, O>[]; | ||
childNodeRules: RuleInfo<T, O>[]; | ||
nodeRules: RuleInfo<T, O>[]; | ||
childNodeRules: RuleInfo<T, O>[]; | ||
}; |
@@ -10,4 +10,9 @@ import type { AnyRule, AnyRuleV2, PlainData, RuleConfig, RuleConfigV2, RuleConfigValue } from './types'; | ||
export declare function provideValue(template: string, data: Readonly<Record<string, string>>): string | undefined; | ||
export declare function exchangeValueOnRule(rule: AnyRule | AnyRuleV2, data: Readonly<Record<string, string>>): AnyRule | undefined; | ||
export declare function cleanOptions(rule: RuleConfig<RuleConfigValue, PlainData> | RuleConfigV2<RuleConfigValue, PlainData>): RuleConfig<RuleConfigValue, PlainData>; | ||
export declare function exchangeValueOnRule( | ||
rule: AnyRule | AnyRuleV2, | ||
data: Readonly<Record<string, string>>, | ||
): AnyRule | undefined; | ||
export declare function cleanOptions( | ||
rule: RuleConfig<RuleConfigValue, PlainData> | RuleConfigV2<RuleConfigValue, PlainData>, | ||
): RuleConfig<RuleConfigValue, PlainData>; | ||
export declare function isRuleConfigValue(v: any): v is RuleConfigValue; | ||
@@ -14,0 +19,0 @@ /** |
{ | ||
"name": "@markuplint/ml-config", | ||
"version": "3.13.0", | ||
"version": "3.14.0", | ||
"description": "JSON Schema and TypeScript types of markuplint configure JSON", | ||
@@ -23,11 +23,11 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"@markuplint/ml-ast": "3.2.0", | ||
"@markuplint/selector": "3.13.0", | ||
"@markuplint/selector": "3.14.0", | ||
"@markuplint/shared": "3.8.0", | ||
"@types/mustache": "^4.2.4", | ||
"@types/mustache": "^4.2.5", | ||
"deepmerge": "^4.3.1", | ||
"is-plain-object": "^5.0.0", | ||
"mustache": "^4.2.0", | ||
"type-fest": "^4.5.0" | ||
"type-fest": "^4.8.2" | ||
}, | ||
"gitHead": "e2adbe92c74631af9c98cb816286287f9f983053" | ||
"gitHead": "b37b749d7ac0f9e6cbd022ee7031bc020c6677d3" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
979
26393
+ Added@markuplint/ml-spec@3.14.0(transitive)
+ Added@markuplint/selector@3.14.0(transitive)
+ Added@markuplint/types@3.12.0(transitive)
+ Added@types/whatwg-mimetype@3.0.2(transitive)
- Removed@markuplint/ml-spec@3.13.0(transitive)
- Removed@markuplint/selector@3.13.0(transitive)
- Removed@markuplint/types@3.11.0(transitive)
- Removed@types/whatwg-mimetype@3.0.1(transitive)
Updated@markuplint/selector@3.14.0
Updated@types/mustache@^4.2.5
Updatedtype-fest@^4.8.2