@templatical/quality 0.8.0 → 0.8.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 +59 -19
- package/dist/index.js +242 -199
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ import { TemplateSettings } from '../../types/src/index.ts';
|
|
|
6
6
|
|
|
7
7
|
export declare const ACCESSIBILITY_RULES: Rule[];
|
|
8
8
|
|
|
9
|
+
/** Options consumed only by the accessibility linter. */
|
|
10
|
+
export declare interface AccessibilityLintOptions {
|
|
11
|
+
rules?: RuleOverrides;
|
|
12
|
+
thresholds?: Partial<LintThresholds>;
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
export declare interface AnchorInfo {
|
|
10
16
|
href: string;
|
|
11
17
|
text: string;
|
|
@@ -148,6 +154,16 @@ export declare function getMessages(locale: string): MessageMap;
|
|
|
148
154
|
|
|
149
155
|
export declare function getStructureMessages(locale: string): StructureMessageMap;
|
|
150
156
|
|
|
157
|
+
/**
|
|
158
|
+
* `true` when no linter would run for the given options — either the
|
|
159
|
+
* global `disabled` flag is set, or every per-tool key is `false`.
|
|
160
|
+
*
|
|
161
|
+
* The editor uses this to skip lazy-loading `@templatical/quality`, hide
|
|
162
|
+
* the Issues sidebar tab, and suppress inline canvas badges. Headless
|
|
163
|
+
* callers can use it to short-circuit before any linter call.
|
|
164
|
+
*/
|
|
165
|
+
export declare function isLintFullyDisabled(options: LintOptions | undefined): boolean;
|
|
166
|
+
|
|
151
167
|
export declare function isOpaqueHex(input: string | undefined | null): boolean;
|
|
152
168
|
|
|
153
169
|
export declare const LINK_RULES: Rule[];
|
|
@@ -156,6 +172,21 @@ export declare type LinkMessageMap = typeof en_4;
|
|
|
156
172
|
|
|
157
173
|
export declare type LinkRuleMessageId = keyof LinkMessageMap;
|
|
158
174
|
|
|
175
|
+
/** Options consumed only by the links linter. */
|
|
176
|
+
export declare interface LinksLintOptions {
|
|
177
|
+
rules?: RuleOverrides;
|
|
178
|
+
/**
|
|
179
|
+
* Host patterns that should flag as "staging / non-production".
|
|
180
|
+
* Each entry is a glob-style pattern matched against the URL host.
|
|
181
|
+
* `*` matches any run of characters (including `.`), so `*.staging.*`
|
|
182
|
+
* matches `app.staging.example.com`.
|
|
183
|
+
*
|
|
184
|
+
* Default: ['localhost', '127.0.0.1', '0.0.0.0', '*.local',
|
|
185
|
+
* '*.staging.*', '*.dev.*']
|
|
186
|
+
*/
|
|
187
|
+
nonProductionHosts?: string[];
|
|
188
|
+
}
|
|
189
|
+
|
|
159
190
|
export declare function lintAccessibility(content: TemplateContent, options?: LintOptions): LintIssue[];
|
|
160
191
|
|
|
161
192
|
export declare interface LintIssue {
|
|
@@ -169,19 +200,6 @@ export declare interface LintIssue {
|
|
|
169
200
|
|
|
170
201
|
export declare function lintLinks(content: TemplateContent, options?: LintOptions): LintIssue[];
|
|
171
202
|
|
|
172
|
-
export declare interface LintLinksOptions {
|
|
173
|
-
/**
|
|
174
|
-
* Host patterns that should flag as "staging / non-production".
|
|
175
|
-
* Each entry is a glob-style pattern matched against the URL host.
|
|
176
|
-
* `*` matches any run of characters (including `.`), so `*.staging.*`
|
|
177
|
-
* matches `app.staging.example.com`.
|
|
178
|
-
*
|
|
179
|
-
* Default: ['localhost', '127.0.0.1', '0.0.0.0', '*.local',
|
|
180
|
-
* '*.staging.*', '*.dev.*']
|
|
181
|
-
*/
|
|
182
|
-
nonProductionHosts?: string[];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
203
|
export declare interface LintOptions {
|
|
186
204
|
/**
|
|
187
205
|
* Fully disable linting. When true, the editor skips lazy-loading the
|
|
@@ -190,11 +208,21 @@ export declare interface LintOptions {
|
|
|
190
208
|
disabled?: boolean;
|
|
191
209
|
/** Locale for vague-text dictionaries and message text. Falls back to `en`. */
|
|
192
210
|
locale?: string;
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Accessibility linter config. Set to `false` to disable the whole
|
|
213
|
+
* `lintAccessibility` linter without enumerating its rules.
|
|
214
|
+
*/
|
|
215
|
+
accessibility?: false | AccessibilityLintOptions;
|
|
216
|
+
/**
|
|
217
|
+
* Structure linter config. Set to `false` to disable the whole
|
|
218
|
+
* `lintStructure` linter without enumerating its rules.
|
|
219
|
+
*/
|
|
220
|
+
structure?: false | StructureLintOptions;
|
|
221
|
+
/**
|
|
222
|
+
* Links linter config. Set to `false` to disable the whole `lintLinks`
|
|
223
|
+
* linter without enumerating its rules.
|
|
224
|
+
*/
|
|
225
|
+
links?: false | LinksLintOptions;
|
|
198
226
|
}
|
|
199
227
|
|
|
200
228
|
export declare interface LintPatch {
|
|
@@ -227,7 +255,7 @@ export declare interface ResolvedLinksOptions {
|
|
|
227
255
|
|
|
228
256
|
export declare interface ResolvedOptions {
|
|
229
257
|
locale: string;
|
|
230
|
-
rules:
|
|
258
|
+
rules: RuleOverrides;
|
|
231
259
|
thresholds: LintThresholds;
|
|
232
260
|
links: ResolvedLinksOptions;
|
|
233
261
|
/** Returns the effective severity for a rule (override or default). */
|
|
@@ -269,10 +297,22 @@ export declare interface RuleMeta {
|
|
|
269
297
|
severity: Exclude<Severity, "off">;
|
|
270
298
|
}
|
|
271
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Per-rule severity override. Set a rule to `'off'` to disable it.
|
|
302
|
+
* Keys are the full prefixed rule IDs (`a11y.*`, `structure.*`, `link.*`)
|
|
303
|
+
* so a value copied from `LintIssue.ruleId` pastes straight in.
|
|
304
|
+
*/
|
|
305
|
+
export declare type RuleOverrides = Record<string, Severity>;
|
|
306
|
+
|
|
272
307
|
export declare type Severity = "error" | "warning" | "info" | "off";
|
|
273
308
|
|
|
274
309
|
export declare const STRUCTURE_RULES: Rule[];
|
|
275
310
|
|
|
311
|
+
/** Options consumed only by the structure linter. */
|
|
312
|
+
export declare interface StructureLintOptions {
|
|
313
|
+
rules?: RuleOverrides;
|
|
314
|
+
}
|
|
315
|
+
|
|
276
316
|
export declare type StructureMessageMap = typeof en_3;
|
|
277
317
|
|
|
278
318
|
export declare type StructureRuleMessageId = keyof StructureMessageMap;
|