@markuplint/ml-config
Advanced tools
Comparing version 3.0.0-alpha.66 to 3.0.0-canary.34
@@ -0,1 +1,2 @@ | ||
import type { ParserOptions } from '@markuplint/ml-ast'; | ||
import type { RegexSelector } from '@markuplint/selector'; | ||
@@ -11,2 +12,3 @@ export type { RegexSelector } from '@markuplint/selector'; | ||
excludeFiles?: string[]; | ||
pretenders?: Pretender[]; | ||
rules?: Rules; | ||
@@ -17,3 +19,3 @@ nodeRules?: NodeRule[]; | ||
} | ||
export declare type PluginConfig = { | ||
export type PluginConfig = { | ||
name: string; | ||
@@ -25,14 +27,75 @@ settings: Record<string, any>; | ||
} | ||
export declare type ParserOptions = { | ||
ignoreFrontMatter?: boolean; | ||
}; | ||
export declare type SpecConfig = { | ||
export type SpecConfig = { | ||
[extensionPattern: string]: string; | ||
}; | ||
export declare type Rule<T extends RuleConfigValue, O = void> = RuleConfig<T, O> | T | boolean; | ||
export declare type AnyRule = Rule<RuleConfigValue, unknown>; | ||
export type Pretender = { | ||
/** | ||
* Target node selectors | ||
*/ | ||
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. | ||
*/ | ||
as: string | OriginalNode; | ||
}; | ||
export type OriginalNode = { | ||
/** | ||
* Element name | ||
*/ | ||
element: string; | ||
/** | ||
* Namespace | ||
* | ||
* Supports `"svg"` and `undefined` only. | ||
* If it is `undefined`, the namespace is HTML. | ||
*/ | ||
namespace?: 'svg'; | ||
/** | ||
* Attributes | ||
*/ | ||
attrs?: { | ||
/** | ||
* Attribute name | ||
*/ | ||
name: string; | ||
/** | ||
* If it omits this property, the attribute is resolved as a boolean. | ||
*/ | ||
value?: string | { | ||
fromAttr: string; | ||
}; | ||
}[]; | ||
/** | ||
* To have attributes the defined element has. | ||
*/ | ||
inheritAttrs?: boolean; | ||
/** | ||
* ARIA properties | ||
*/ | ||
aria?: PretenderARIA; | ||
}; | ||
/** | ||
* Pretender Node ARIA properties | ||
*/ | ||
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. | ||
*/ | ||
name?: boolean | { | ||
fromAttr: string; | ||
}; | ||
}; | ||
export type Rule<T extends RuleConfigValue, O = void> = RuleConfig<T, O> | T | boolean; | ||
export type AnyRule = Rule<RuleConfigValue, unknown>; | ||
export interface Rules { | ||
[ruleName: string]: AnyRule; | ||
} | ||
export declare type RuleConfig<T extends RuleConfigValue, O = void> = { | ||
export type RuleConfig<T extends RuleConfigValue, O = void> = { | ||
severity?: Severity; | ||
@@ -43,4 +106,4 @@ value?: T; | ||
}; | ||
export declare type Severity = 'error' | 'warning' | 'info'; | ||
export declare type RuleConfigValue = string | number | boolean | any[] | null; | ||
export type Severity = 'error' | 'warning' | 'info'; | ||
export type RuleConfigValue = string | number | boolean | any[] | null; | ||
export interface NodeRule { | ||
@@ -60,8 +123,8 @@ selector?: string; | ||
} | ||
export declare type Report<T extends RuleConfigValue, O = null> = Report1<T, O> | Report2 | (Report1<T, O> & Report2); | ||
export declare type Report1<T extends RuleConfigValue, O = null> = { | ||
export type Report<T extends RuleConfigValue, O = null> = Report1<T, O> | Report2 | (Report1<T, O> & Report2); | ||
export type Report1<T extends RuleConfigValue, O = null> = { | ||
message: string; | ||
scope: Scope<T, O>; | ||
}; | ||
export declare type Report2 = { | ||
export type Report2 = { | ||
message: string; | ||
@@ -72,3 +135,3 @@ line: number; | ||
}; | ||
export declare type Scope<T extends RuleConfigValue, O = null> = { | ||
export type Scope<T extends RuleConfigValue, O = null> = { | ||
rule: RuleInfo<T, O>; | ||
@@ -95,6 +158,6 @@ startLine: number; | ||
} | ||
export declare type GlobalRuleInfo<T extends RuleConfigValue, O = null> = RuleInfo<T, O> & { | ||
export type GlobalRuleInfo<T extends RuleConfigValue, O = null> = RuleInfo<T, O> & { | ||
nodeRules: RuleInfo<T, O>[]; | ||
childNodeRules: RuleInfo<T, O>[]; | ||
}; | ||
export declare type Nullable<T> = T | null | undefined; | ||
export type Nullable<T> = T | null | undefined; |
{ | ||
"name": "@markuplint/ml-config", | ||
"version": "3.0.0-alpha.66+6cde1134", | ||
"version": "3.0.0-canary.34+382d1365", | ||
"description": "JSON Schema and TypeScript types of markuplint configure JSON", | ||
@@ -19,6 +19,7 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"devDependencies": { | ||
"@types/mustache": "^4.1.2" | ||
"@markuplint/ml-ast": "3.0.0-canary.69+382d1365", | ||
"@types/mustache": "^4.2.1" | ||
}, | ||
"dependencies": { | ||
"@markuplint/selector": "3.0.0-alpha.2105+6cde1134", | ||
"@markuplint/selector": "3.0.0-canary.2421+382d1365", | ||
"deepmerge": "^4.2.2", | ||
@@ -28,3 +29,3 @@ "is-plain-object": "^5.0.0", | ||
}, | ||
"gitHead": "6cde113402758a8fdbd6a0fcf98e78efd2cdb778" | ||
"gitHead": "382d13653071bd02210d5430403d1a87c840398c" | ||
} |
# @markuplint/ml-config | ||
[![npm version](https://badge.fury.io/js/%40markuplint%2Fml-config.svg)](https://www.npmjs.com/package/@markuplint/ml-config) | ||
[![Build Status](https://travis-ci.org/markuplint/markuplint.svg?branch=main)](https://travis-ci.org/markuplint/markuplint) | ||
[![Coverage Status](https://coveralls.io/repos/github/markuplint/markuplint/badge.svg?branch=main)](https://coveralls.io/github/markuplint/markuplint?branch=main) | ||
## Install | ||
[`markuplint`](https://www.npmjs.com/package/markuplint) package includes this package. | ||
<details> | ||
<summary>If you are installing purposely, how below:</summary> | ||
```sh | ||
@@ -14,1 +17,3 @@ $ npm install @markuplint/ml-config | ||
``` | ||
</details> |
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
79576
454
19
2