Skip to content

Commit 5305ebf

Browse files
chore: update linting and type-helper.d.ts (#4619)
1 parent a8d8f8c commit 5305ebf

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
1010
"parserOptions": {
1111
"sourceType": "module",
12-
"ecmaVersion": 2020
12+
"ecmaVersion": 2023
1313
},
1414
"rules": {
1515
"import/extensions": ["error", "always", {

src/core/base-runner.js

-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ export async function runAll(plugs) {
2424
runnables.forEach(
2525
plug => !plug.name && console.warn("Plugin lacks name:", plug)
2626
);
27-
respecConfig.state = {};
2827
await executePreparePass(runnables, respecConfig);
2928
await executeRunPass(runnables, respecConfig);
30-
respecConfig.state = {};
3129
pub("plugins-done", respecConfig);
3230

3331
await postProcess(respecConfig);

src/type-helper.d.ts

+66-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface AxeViolation {
2424
nodes: { failureSummary: string; element: HTMLElement }[];
2525
}
2626

27-
declare var respecConfig: any;
27+
declare var respecConfig: Conf;
2828
interface Window {
2929
respecVersion: string;
3030
respecUI: {
@@ -110,15 +110,42 @@ interface BiblioData {
110110
etAl?: boolean;
111111
expires: number;
112112
}
113+
114+
type ProcessFn = (config: Conf, doc: Document) => Promise<void> | void;
115+
116+
/** Configuration object type */
113117
interface Conf {
114118
authors?: Person[];
119+
/** Object containing bibliographic data */
115120
biblio: Record<string, BiblioData>;
116121
editors?: Person[];
117122
formerEditors?: Person[];
123+
/** Set of informative references */
118124
informativeReferences: Set<string>;
119125
localBiblio?: Record<string, BiblioData>;
126+
/** Set of normative references */
120127
normativeReferences: Set<string>;
121128
shortName: string;
129+
preProcess?: ProcessFn[];
130+
postProcess?: ProcessFn[];
131+
afterEnd?: ProcessFn;
132+
specStatus?: string;
133+
wgId?: string;
134+
noToc: boolean;
135+
136+
/** Indicates whether the document is a preview */
137+
isPreview?: boolean;
138+
/** The pull request number, if applicable */
139+
prNumber?: number;
140+
/** The URL of the pull request, if applicable */
141+
prUrl?: string;
142+
/** The GitHub configuration object */
143+
github?: {
144+
/** The URL of the GitHub repository */
145+
repoURL: string;
146+
};
147+
/** The title of the document */
148+
title?: string;
122149
}
123150

124151
type LicenseInfo = {
@@ -159,14 +186,18 @@ type ResourceHintOption = {
159186
dontRemove?: boolean;
160187
};
161188

189+
/** Represents a request to the core/xref module */
162190
module "core/xref" {
163191
import { IDBPDatabase, DBSchema } from "idb";
164192

193+
/** Represents a single request entry */
165194
export interface RequestEntry {
166195
term: string;
167196
id: string;
168197
types: string[];
198+
/** Spec URLs to restrict the search to */
169199
specs?: string[][];
200+
/** The context in which the term appears */
170201
for?: string;
171202
}
172203

@@ -244,6 +275,40 @@ type DefinitionValidator = (
244275
pluginName: string
245276
) => boolean;
246277

278+
declare class RespecError extends Error {
279+
constructor(
280+
message: string,
281+
pluginName: string,
282+
options: {
283+
isWarning: boolean;
284+
elements?: HTMLElement[];
285+
title?: string;
286+
}
287+
);
288+
toJSON(): {
289+
message: string;
290+
name: string;
291+
plugin: string;
292+
hint?: string;
293+
elements?: any[];
294+
title?: string;
295+
details?: any;
296+
stack?: string;
297+
};
298+
}
299+
300+
/**
301+
* Localization strings for different languages.
302+
*
303+
*/
304+
type LocalizationStrings = {
305+
de: Record<string, string>;
306+
en: Record<string, string>;
307+
ja: Record<string, string>;
308+
nl: Record<string, string>;
309+
zh: Record<string, string>;
310+
};
311+
247312
interface LinkProps {
248313
href: string;
249314
title: string;

0 commit comments

Comments
 (0)