html-validate 11.4.0 → 11.5.1
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/dist/cjs/browser.js +1 -1
- package/dist/cjs/cli.js +7 -0
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-nodejs.js +212 -2
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +85 -30
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +429 -58
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/html-validate.js +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest-worker.js +1 -1
- package/dist/cjs/jest.js +1 -1
- package/dist/cjs/presets.d.ts +1 -0
- package/dist/cjs/presets.js +22 -0
- package/dist/cjs/presets.js.map +1 -0
- package/dist/cjs/vitest-matchers.js +20 -4
- package/dist/cjs/vitest-matchers.js.map +1 -1
- package/dist/cjs/vitest-worker.js +1 -1
- package/dist/cjs/vitest.js +1 -1
- package/dist/esm/browser.js +2 -2
- package/dist/esm/cli.js +10 -3
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/core-browser.js +1 -1
- package/dist/esm/core-nodejs.js +212 -4
- package/dist/esm/core-nodejs.js.map +1 -1
- package/dist/esm/core.js +78 -30
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +429 -58
- package/dist/esm/elements.js.map +1 -1
- package/dist/esm/html-validate.js +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/jest-matchers.js +2 -2
- package/dist/esm/jest-utils.js +2 -2
- package/dist/esm/jest-worker.js +2 -2
- package/dist/esm/jest.js +1 -1
- package/dist/esm/presets.d.ts +1 -0
- package/dist/esm/presets.js +11 -0
- package/dist/esm/presets.js.map +1 -0
- package/dist/esm/vitest-matchers.js +23 -7
- package/dist/esm/vitest-matchers.js.map +1 -1
- package/dist/esm/vitest-utils.js +2 -2
- package/dist/esm/vitest-worker.js +2 -2
- package/dist/esm/vitest.js +1 -1
- package/dist/schema/elements.json +14 -1
- package/dist/types/browser.d.ts +88 -4
- package/dist/types/index.d.ts +154 -4
- package/dist/types/presets.d.ts +8 -0
- package/package.json +7 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -439,6 +439,10 @@ export declare abstract class ConfigLoader {
|
|
|
439
439
|
*
|
|
440
440
|
* If [[configOverride]] is set it is merged with the final result.
|
|
441
441
|
*
|
|
442
|
+
* Do note that if `configOverride` is changed between calls the cache must be
|
|
443
|
+
* flushed in-between or the final results may vary. Loaders may cache the
|
|
444
|
+
* merged result.
|
|
445
|
+
*
|
|
442
446
|
* @param handle - Unique handle to get configuration for.
|
|
443
447
|
* @param configOverride - Optional configuration to merge final results with.
|
|
444
448
|
*/
|
|
@@ -501,6 +505,27 @@ export declare interface DeferredMessage extends Omit<Message, "selector"> {
|
|
|
501
505
|
*/
|
|
502
506
|
export declare function defineConfig(config: ConfigData): ConfigData;
|
|
503
507
|
|
|
508
|
+
/**
|
|
509
|
+
* Helper function to assist IDE with completion and type-checking.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
*
|
|
513
|
+
* ```ts
|
|
514
|
+
* import { defineFlatConfig } from "html-validate";
|
|
515
|
+
*
|
|
516
|
+
* export default defineFlatConfig([
|
|
517
|
+
* {
|
|
518
|
+
* files: ["*.html"],
|
|
519
|
+
* rules: { "void-style": "error" },
|
|
520
|
+
* }
|
|
521
|
+
* ]);
|
|
522
|
+
* ```
|
|
523
|
+
*
|
|
524
|
+
* @public
|
|
525
|
+
* @since 11.5.0
|
|
526
|
+
*/
|
|
527
|
+
export declare function defineFlatConfig(config: FlatConfig): FlatConfig;
|
|
528
|
+
|
|
504
529
|
/**
|
|
505
530
|
* Helper function to assist IDE with completion and type-checking.
|
|
506
531
|
*
|
|
@@ -954,6 +979,109 @@ export declare interface FileSystemConfigLoaderOptions {
|
|
|
954
979
|
fs: FSLike;
|
|
955
980
|
}
|
|
956
981
|
|
|
982
|
+
/**
|
|
983
|
+
* @public
|
|
984
|
+
* @since 11.5.0
|
|
985
|
+
*/
|
|
986
|
+
export declare type FlatConfig = FlatConfigObject[];
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Configuration loader for the flat config format.
|
|
990
|
+
*
|
|
991
|
+
* Loads configuration from a `html-validate.config.*` file and applies
|
|
992
|
+
* per-file glob filtering.
|
|
993
|
+
*
|
|
994
|
+
* @public
|
|
995
|
+
* @since 11.5.0
|
|
996
|
+
*/
|
|
997
|
+
export declare class FlatConfigLoader extends ConfigLoader {
|
|
998
|
+
private readonly configFilePath;
|
|
999
|
+
private configCache;
|
|
1000
|
+
private fileCache;
|
|
1001
|
+
/**
|
|
1002
|
+
* @param configFilePath - Absolute path to the flat config file.
|
|
1003
|
+
* @param resolvers - Resolvers to use.
|
|
1004
|
+
*/
|
|
1005
|
+
constructor(configFilePath: string, resolvers?: Resolver[]);
|
|
1006
|
+
/**
|
|
1007
|
+
* Search `dir` and its ancestors for a flat config file and, if found,
|
|
1008
|
+
* return a new `FlatConfigLoader` pointed at it. Returns `null` when no
|
|
1009
|
+
* config file can be found.
|
|
1010
|
+
*
|
|
1011
|
+
* @param dir - Directory to start searching from.
|
|
1012
|
+
* @param resolvers - Resolvers to use.
|
|
1013
|
+
*/
|
|
1014
|
+
static fromDirectory(dir: string, resolvers?: Resolver[]): FlatConfigLoader | null;
|
|
1015
|
+
/**
|
|
1016
|
+
* Get configuration for the given filename.
|
|
1017
|
+
*
|
|
1018
|
+
* Do note that if `configOverride` is changed between calls the cache must be
|
|
1019
|
+
* flushed in-between. This loader caches the final merged result.
|
|
1020
|
+
*
|
|
1021
|
+
* @param filename - Absolute or relative path to the file being validated.
|
|
1022
|
+
* @param configOverride - Optional configuration to merge into the result.
|
|
1023
|
+
*/
|
|
1024
|
+
getConfigFor(filename: string, configOverride?: ConfigData): Promise<ResolvedConfig>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Flush the cached flat config, forcing a reload on the next call.
|
|
1027
|
+
*/
|
|
1028
|
+
flushCache(handle?: string): void;
|
|
1029
|
+
protected defaultConfig(): Config;
|
|
1030
|
+
private loadConfig;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* A single object in a flat configuration file.
|
|
1035
|
+
*
|
|
1036
|
+
* @public
|
|
1037
|
+
* @since 11.5.0
|
|
1038
|
+
*/
|
|
1039
|
+
export declare interface FlatConfigObject {
|
|
1040
|
+
/**
|
|
1041
|
+
* Optional name of this configuration object.
|
|
1042
|
+
*
|
|
1043
|
+
* Used for troubleshooting and error messages.
|
|
1044
|
+
*/
|
|
1045
|
+
name?: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* An array of glob patterns indicating the files that the configuration
|
|
1048
|
+
* object should apply to.
|
|
1049
|
+
*
|
|
1050
|
+
* If not specified, the configuration object applies to all files matched by
|
|
1051
|
+
* any other configuration object.
|
|
1052
|
+
*/
|
|
1053
|
+
files?: string[];
|
|
1054
|
+
/**
|
|
1055
|
+
* An array of glob patterns indicating the files that the configuration object should not apply to.
|
|
1056
|
+
*
|
|
1057
|
+
* If not specified, the configuration object applies to all files matches by `files`.
|
|
1058
|
+
*
|
|
1059
|
+
* If `ignores` is used without any other keys in the configuration object,
|
|
1060
|
+
* then the patterns act as a global ignores and gets applied to every
|
|
1061
|
+
* configuration object.
|
|
1062
|
+
*/
|
|
1063
|
+
ignores?: string[];
|
|
1064
|
+
/**
|
|
1065
|
+
* Element metadata sources.
|
|
1066
|
+
*/
|
|
1067
|
+
elements?: MetaDataTable[];
|
|
1068
|
+
/**
|
|
1069
|
+
* Plugins
|
|
1070
|
+
*/
|
|
1071
|
+
plugins?: Plugin_2[];
|
|
1072
|
+
/**
|
|
1073
|
+
* Source file transformations.
|
|
1074
|
+
*
|
|
1075
|
+
* Maps a regular-expression pattern (matched against the filename) to a
|
|
1076
|
+
* transformer function.
|
|
1077
|
+
*/
|
|
1078
|
+
transform?: Record<string, Transformer_2>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Rule configuration.
|
|
1081
|
+
*/
|
|
1082
|
+
rules?: RuleConfig;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
957
1085
|
/**
|
|
958
1086
|
* @public
|
|
959
1087
|
*/
|
|
@@ -1705,10 +1833,19 @@ export declare interface MetaAttribute {
|
|
|
1705
1833
|
*/
|
|
1706
1834
|
deprecated?: boolean | string;
|
|
1707
1835
|
/**
|
|
1708
|
-
* If set it is an exhaustive list of all possible values
|
|
1709
|
-
*
|
|
1836
|
+
* If set it is an exhaustive list of all possible values this attribute can
|
|
1837
|
+
* have (each token if list is set).
|
|
1838
|
+
*
|
|
1839
|
+
* Each entry can either be:
|
|
1840
|
+
*
|
|
1841
|
+
* - A keyword (as string).
|
|
1842
|
+
* - A regular expression.
|
|
1843
|
+
* - An object with `name` and `pattern` (regular expression).
|
|
1844
|
+
*
|
|
1845
|
+
* When using an object the name is presented in error messages and contextual
|
|
1846
|
+
* documentation.
|
|
1710
1847
|
*/
|
|
1711
|
-
enum?: Array<string | RegExp>;
|
|
1848
|
+
enum?: Array<string | RegExp | MetaAttributeNamedRegex>;
|
|
1712
1849
|
/**
|
|
1713
1850
|
* If `true` this attribute contains space-separated tokens and each token must
|
|
1714
1851
|
* be valid by itself.
|
|
@@ -1745,6 +1882,19 @@ export declare interface MetaAttribute {
|
|
|
1745
1882
|
*/
|
|
1746
1883
|
export declare type MetaAttributeAllowedCallback = (node: HtmlElementLike, attr: string | DynamicValue | null | undefined) => string | null | undefined;
|
|
1747
1884
|
|
|
1885
|
+
/**
|
|
1886
|
+
* A named regular expression for use in attribute value validation.
|
|
1887
|
+
*
|
|
1888
|
+
* @public
|
|
1889
|
+
* @since 11.5.0
|
|
1890
|
+
*/
|
|
1891
|
+
export declare interface MetaAttributeNamedRegex {
|
|
1892
|
+
/** Human-readable label shown in error documentation. */
|
|
1893
|
+
name: string;
|
|
1894
|
+
/** Regular expression used for validation. */
|
|
1895
|
+
pattern: RegExp | string;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1748
1898
|
/**
|
|
1749
1899
|
* Callback for the `required` property of `MetaAttribute`.
|
|
1750
1900
|
*
|
|
@@ -2464,7 +2614,7 @@ export declare class ResolvedConfig {
|
|
|
2464
2614
|
* Returns the (merged) configuration data used to create this resolved
|
|
2465
2615
|
* configuration.
|
|
2466
2616
|
*/
|
|
2467
|
-
getConfigData(): ConfigData;
|
|
2617
|
+
getConfigData(): ConfigData | FlatConfig;
|
|
2468
2618
|
getMetaTable(): MetaTable;
|
|
2469
2619
|
getPlugins(): Plugin_2[];
|
|
2470
2620
|
getRules(): Map<string, [Severity, RuleOptions]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlatConfigObject } from "html-validate";
|
|
2
|
+
|
|
3
|
+
export declare const a11y: FlatConfigObject;
|
|
4
|
+
export declare const browser: FlatConfigObject;
|
|
5
|
+
export declare const document: FlatConfigObject;
|
|
6
|
+
export declare const prettier: FlatConfigObject;
|
|
7
|
+
export declare const recommended: FlatConfigObject;
|
|
8
|
+
export declare const standard: FlatConfigObject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-validate",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.1",
|
|
4
4
|
"description": "Offline HTML5 validator and linter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html",
|
|
@@ -62,6 +62,11 @@
|
|
|
62
62
|
"import": "./dist/esm/html5.js",
|
|
63
63
|
"require": "./dist/cjs/html5.js"
|
|
64
64
|
},
|
|
65
|
+
"./presets": {
|
|
66
|
+
"types": "./dist/types/presets.d.ts",
|
|
67
|
+
"import": "./dist/esm/presets.js",
|
|
68
|
+
"require": "./dist/cjs/presets.js"
|
|
69
|
+
},
|
|
65
70
|
"./jest": {
|
|
66
71
|
"types": "./dist/types/jest.d.ts",
|
|
67
72
|
"import": "./dist/esm/jest.js",
|
|
@@ -121,6 +126,6 @@
|
|
|
121
126
|
}
|
|
122
127
|
},
|
|
123
128
|
"engines": {
|
|
124
|
-
"node": "^22.
|
|
129
|
+
"node": "^22.22.0 || >= 24.8.0"
|
|
125
130
|
}
|
|
126
131
|
}
|