@frame12/lint 0.2.0 → 0.2.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/index.d.ts +2 -1
- package/dist/index.js +4 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -60,7 +60,8 @@ export declare function lintFiles(targetPaths: string[]): {
|
|
|
60
60
|
export declare const lintDirectory: typeof lintFiles;
|
|
61
61
|
|
|
62
62
|
export declare function lintHtml(
|
|
63
|
-
|
|
63
|
+
/** HTML text, or an object whose string form is HTML (e.g. an `@frame12/static` `Html`). */
|
|
64
|
+
html: string | { toString(): string },
|
|
64
65
|
opts?: LintHtmlOptions
|
|
65
66
|
): Violation[];
|
|
66
67
|
|
package/dist/index.js
CHANGED
|
@@ -2198,7 +2198,10 @@ function parseHtmlTagAttributes(html, startIdx) {
|
|
|
2198
2198
|
* (`<iframe>`, `<object>`, `<embed>`, `srcdoc`), `<meta http-equiv="refresh">`,
|
|
2199
2199
|
* `<base href>`, `on*=` attributes, and `javascript:` URLs.
|
|
2200
2200
|
*/
|
|
2201
|
-
export function lintHtml(
|
|
2201
|
+
export function lintHtml(input, opts = {}) {
|
|
2202
|
+
// Accept objects with a string form (e.g. @frame12/static `Html` values) by converting them
|
|
2203
|
+
// once; indexing a non-string character by character would never terminate or lint nothing.
|
|
2204
|
+
const html = typeof input === 'string' ? input : String(input ?? '');
|
|
2202
2205
|
const filePath = opts.file ?? 'input.html';
|
|
2203
2206
|
const tokenStyleIds = new Set(opts.tokenStyleIds ?? []);
|
|
2204
2207
|
const violations = [];
|