onsystem 0.4.0 → 0.6.0
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/README.md +36 -15
- package/dist/cli.js +339 -180
- package/dist/config-lbfW91qB.d.ts +482 -0
- package/dist/{stdio-BcJth14k.js → design-system-A3pRX3Ka.js} +8439 -7212
- package/dist/eslint-worker.d.ts +36 -0
- package/dist/eslint-worker.js +95 -0
- package/dist/eslint.d.ts +23 -0
- package/dist/eslint.js +172 -0
- package/dist/index.d.ts +84 -387
- package/dist/index.js +3 -2
- package/dist/stdio-CEChNFLR.js +1396 -0
- package/dist/workspace-CHvUwgz9.js +227 -0
- package/package.json +22 -2
- package/schema.json +19 -1
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
//#region src/detect.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* How apps import a design-system module, from a package's `exports`:
|
|
5
|
+
* `@midday/ui/button` → `../../packages/ui/src/components/button.tsx`, or a
|
|
6
|
+
* pattern (`@workspace/ui/components/*` → `…/src/components/*.tsx`). A
|
|
7
|
+
* specifier without `*` and a pattern target map every matching file to one
|
|
8
|
+
* module: a package that exports its components from a barrel.
|
|
9
|
+
*/
|
|
10
|
+
interface ImportMapping {
|
|
11
|
+
specifier: string;
|
|
12
|
+
/** File or pattern relative to the root, with forward slashes. */
|
|
13
|
+
target: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A dependency whose package.json declares its onsystem config
|
|
17
|
+
* (`"onsystem": "./onsystem.config.json"`): a design-system package set up for the apps that
|
|
18
|
+
* use it.
|
|
19
|
+
*/
|
|
20
|
+
interface DesignSystemPackage {
|
|
21
|
+
/** Its package name: `@acme/ui`. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Its folder, absolute: the workspace package's sources, or where it is installed. */
|
|
24
|
+
dir: string;
|
|
25
|
+
/** The JSON config its package.json names, absolute. */
|
|
26
|
+
config: string;
|
|
27
|
+
/** Installed from a registry into `node_modules`, rather than a workspace package. */
|
|
28
|
+
installed: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The folder its config's paths must stay in: its own folder when installed, else the
|
|
31
|
+
* workspace root (a sibling package's tokens, `../tokens/...`), or its own folder outside one.
|
|
32
|
+
*/
|
|
33
|
+
boundary: string;
|
|
34
|
+
}
|
|
35
|
+
/** One of several design systems an app uses, and how often its code imports it. */
|
|
36
|
+
interface DesignSystemSource {
|
|
37
|
+
source: string;
|
|
38
|
+
components: string[];
|
|
39
|
+
imports: number;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/types.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* The design-system model the server exposes. Everything here is plain JSON so
|
|
45
|
+
* it can be cached on disk and returned as MCP structured content.
|
|
46
|
+
*/
|
|
47
|
+
declare const TOKEN_CATEGORIES: readonly ["color", "spacing", "radius", "typography", "shadow", "other"];
|
|
48
|
+
type TokenCategory = (typeof TOKEN_CATEGORIES)[number];
|
|
49
|
+
interface SourceLocation {
|
|
50
|
+
/** Path relative to the project root, with forward slashes. */
|
|
51
|
+
file: string;
|
|
52
|
+
/** 1-based line. */
|
|
53
|
+
line: number;
|
|
54
|
+
}
|
|
55
|
+
interface Token {
|
|
56
|
+
/**
|
|
57
|
+
* Canonical name: the DTCG path for JSON tokens (`color.brand.500`) or the
|
|
58
|
+
* custom property without its dashes for CSS tokens (`primary`, `radius-md`).
|
|
59
|
+
*/
|
|
60
|
+
name: string;
|
|
61
|
+
category: TokenCategory;
|
|
62
|
+
/** The value with aliases resolved, as authored (`oklch(0.205 0 0)`, `0.5rem`). */
|
|
63
|
+
value: string;
|
|
64
|
+
/** Values for other modes or themes, e.g. `{ dark: "oklch(0.922 0 0)" }`. */
|
|
65
|
+
modes?: Record<string, string>;
|
|
66
|
+
/** The custom property to reference from CSS, e.g. `--primary`. */
|
|
67
|
+
cssVar?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Tailwind theme key when the token is exposed through `@theme`
|
|
70
|
+
* (`primary` for `--color-primary`, `md` for `--radius-md`).
|
|
71
|
+
*/
|
|
72
|
+
tailwind?: string;
|
|
73
|
+
/** Ready-to-paste usages, most idiomatic first: `bg-primary`, `var(--primary)`. */
|
|
74
|
+
usage: string[];
|
|
75
|
+
description?: string;
|
|
76
|
+
deprecated?: string | true;
|
|
77
|
+
/** Name of the token this one aliases, if any. */
|
|
78
|
+
aliasOf?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Where the value comes from. `tailwind-default` marks Tailwind built-ins such as `--spacing`;
|
|
81
|
+
* `library` a value of a library's theme (MUI's `createTheme`), whose spacing and radius are
|
|
82
|
+
* listed but do not drive the length rules, whose scales are Tailwind's.
|
|
83
|
+
*/
|
|
84
|
+
origin?: 'tailwind-default' | 'library';
|
|
85
|
+
source: SourceLocation;
|
|
86
|
+
}
|
|
87
|
+
interface PropInfo {
|
|
88
|
+
name: string;
|
|
89
|
+
/** TypeScript type as written by the checker, without `| undefined`. */
|
|
90
|
+
type: string;
|
|
91
|
+
required: boolean;
|
|
92
|
+
default?: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
/** Allowed values when the type is a finite set of literals. */
|
|
95
|
+
values?: string[];
|
|
96
|
+
deprecated?: string | true;
|
|
97
|
+
/** `variant` when the prop comes from a `cva()` definition. */
|
|
98
|
+
kind: 'prop' | 'variant';
|
|
99
|
+
}
|
|
100
|
+
interface VariantInfo {
|
|
101
|
+
/** Variant prop name, e.g. `variant` or `size`. */
|
|
102
|
+
name: string;
|
|
103
|
+
values: string[];
|
|
104
|
+
default?: string;
|
|
105
|
+
/** Classes applied for each value, straight from the `cva()` config. */
|
|
106
|
+
classes: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
interface CompoundVariantInfo {
|
|
109
|
+
when: Record<string, string | string[]>;
|
|
110
|
+
classes: string;
|
|
111
|
+
}
|
|
112
|
+
interface InheritedProps {
|
|
113
|
+
/** Source text of the type the props come from, e.g. `React.ComponentProps<"button">`. */
|
|
114
|
+
from: string;
|
|
115
|
+
count: number;
|
|
116
|
+
/** Key into `DesignSystemModel.propSets` with the full list of names. */
|
|
117
|
+
set: string;
|
|
118
|
+
/** Names in the set marked `@deprecated` (React Aria's `onClick`), left out of summaries. */
|
|
119
|
+
deprecated?: string[];
|
|
120
|
+
}
|
|
121
|
+
interface ExampleInfo {
|
|
122
|
+
title?: string;
|
|
123
|
+
code: string;
|
|
124
|
+
lang: string;
|
|
125
|
+
source: 'docs' | 'jsdoc';
|
|
126
|
+
}
|
|
127
|
+
interface DocSection {
|
|
128
|
+
heading: string;
|
|
129
|
+
body: string;
|
|
130
|
+
}
|
|
131
|
+
interface ComponentDocs {
|
|
132
|
+
file: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
sections: DocSection[];
|
|
135
|
+
frontmatter: Record<string, string | string[]>;
|
|
136
|
+
}
|
|
137
|
+
interface ComponentInfo {
|
|
138
|
+
/** How the component is referenced in JSX: `Button`, `CardHeader` or `Tabs.List`. */
|
|
139
|
+
name: string;
|
|
140
|
+
/** Other names that resolve to the same component (e.g. `Card.Header` when `CardHeader` is also exported). */
|
|
141
|
+
aliases: string[];
|
|
142
|
+
description?: string;
|
|
143
|
+
deprecated?: string | true;
|
|
144
|
+
/** Suggested import specifier, e.g. `@/components/ui/button`. */
|
|
145
|
+
importPath: string;
|
|
146
|
+
/** Exported binding name, or the static member path for compound members. */
|
|
147
|
+
exportName: string;
|
|
148
|
+
source: SourceLocation;
|
|
149
|
+
/** The root component this one belongs to (`Card` for `CardHeader`). */
|
|
150
|
+
parent?: string;
|
|
151
|
+
/** Direct sub-components, in declaration order. */
|
|
152
|
+
subcomponents: string[];
|
|
153
|
+
/** Native element it renders or wraps, when it can be inferred (`button`, `input`). */
|
|
154
|
+
element?: string;
|
|
155
|
+
props: PropInfo[];
|
|
156
|
+
inherits: InheritedProps[];
|
|
157
|
+
/**
|
|
158
|
+
* True when part of the props type could not be resolved (missing
|
|
159
|
+
* `node_modules`, a type error). The linter then skips unknown-prop checks.
|
|
160
|
+
*/
|
|
161
|
+
openProps: boolean;
|
|
162
|
+
variants: VariantInfo[];
|
|
163
|
+
compoundVariants: CompoundVariantInfo[];
|
|
164
|
+
examples: ExampleInfo[];
|
|
165
|
+
docs?: ComponentDocs;
|
|
166
|
+
/** Utility classes used in the component source; mapped to tokens at query time. */
|
|
167
|
+
classNames: string[];
|
|
168
|
+
/** CSS custom properties referenced in the component source. */
|
|
169
|
+
cssVars: string[];
|
|
170
|
+
/**
|
|
171
|
+
* The published library it comes from, read from its type declarations rather than from
|
|
172
|
+
* source: `@mui/material`. The app's own components win where they share a name.
|
|
173
|
+
*/
|
|
174
|
+
library?: string;
|
|
175
|
+
/**
|
|
176
|
+
* A prop that renders another element or component in its place and takes that one's props
|
|
177
|
+
* (`component` in MUI): when it is set, the props cannot be checked.
|
|
178
|
+
*/
|
|
179
|
+
polymorphic?: string;
|
|
180
|
+
/** Another module that exports it as its default: `@mui/material/Button`. */
|
|
181
|
+
defaultImport?: string;
|
|
182
|
+
/**
|
|
183
|
+
* A prop whose text the component gives its child element as its accessible name (MUI's
|
|
184
|
+
* Tooltip `title`), unless the `unless` prop is set (`describeChild` makes it a description).
|
|
185
|
+
*/
|
|
186
|
+
labelsChild?: {
|
|
187
|
+
prop: string;
|
|
188
|
+
unless?: string;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
interface DesignSystemModel {
|
|
192
|
+
version: 1;
|
|
193
|
+
root: string;
|
|
194
|
+
components: ComponentInfo[];
|
|
195
|
+
tokens: Token[];
|
|
196
|
+
/** Shared inherited prop-name lists, deduplicated across components. */
|
|
197
|
+
propSets: Record<string, string[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Every value the component files export, components or not (`Icons`,
|
|
200
|
+
* `buttonVariants`), so the linter tells an invented name from a real export.
|
|
201
|
+
*/
|
|
202
|
+
exports: string[];
|
|
203
|
+
/** Non-fatal problems found while extracting (unparseable files, unmatched docs). */
|
|
204
|
+
warnings: string[];
|
|
205
|
+
/**
|
|
206
|
+
* The component files extraction read, relative to the root: a name one of them exports
|
|
207
|
+
* that is not a component was seen, while a file outside them was never looked at.
|
|
208
|
+
*/
|
|
209
|
+
sources?: string[];
|
|
210
|
+
stats: {
|
|
211
|
+
files: {
|
|
212
|
+
components: number;
|
|
213
|
+
tokens: number;
|
|
214
|
+
docs: number;
|
|
215
|
+
};
|
|
216
|
+
durationMs: number;
|
|
217
|
+
fromCache: boolean;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
type Severity = 'error' | 'warning';
|
|
221
|
+
interface TextEdit {
|
|
222
|
+
/** 0-based offsets into the checked source, end exclusive. */
|
|
223
|
+
range: [number, number];
|
|
224
|
+
text: string;
|
|
225
|
+
}
|
|
226
|
+
interface Diagnostic {
|
|
227
|
+
ruleId: string;
|
|
228
|
+
severity: Severity;
|
|
229
|
+
message: string;
|
|
230
|
+
/** 1-based. */
|
|
231
|
+
line: number;
|
|
232
|
+
/** 1-based. */
|
|
233
|
+
column: number;
|
|
234
|
+
endLine: number;
|
|
235
|
+
endColumn: number;
|
|
236
|
+
/** The offending source text. */
|
|
237
|
+
source: string;
|
|
238
|
+
/** What to write instead, e.g. `bg-destructive` or `<Button>`. */
|
|
239
|
+
suggestion?: string;
|
|
240
|
+
/** Edits that apply the suggestion, when it can be done mechanically. */
|
|
241
|
+
fix?: TextEdit[];
|
|
242
|
+
}
|
|
243
|
+
interface CheckResult {
|
|
244
|
+
file: string;
|
|
245
|
+
diagnostics: Diagnostic[];
|
|
246
|
+
errorCount: number;
|
|
247
|
+
warningCount: number;
|
|
248
|
+
/** With a baseline: findings it accepted, left out of `diagnostics` and the counts. */
|
|
249
|
+
baselined?: number;
|
|
250
|
+
/**
|
|
251
|
+
* Components imported from design-system modules the model does not include
|
|
252
|
+
* (extraction is incomplete), which the rules could not check.
|
|
253
|
+
*/
|
|
254
|
+
unchecked?: {
|
|
255
|
+
names: string[];
|
|
256
|
+
modules: string[];
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Why the file was not checked: it renders outside the browser's CSS (an
|
|
260
|
+
* Open Graph image through next/og, an email through React Email), where
|
|
261
|
+
* design tokens and classes do not apply.
|
|
262
|
+
*/
|
|
263
|
+
skipped?: string;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/libraries/index.d.ts
|
|
267
|
+
/** The ids of the libraries onsystem can read, for the config's `libraries` list. */
|
|
268
|
+
declare const LIBRARY_IDS: readonly ["mui"];
|
|
269
|
+
type LibraryId = (typeof LIBRARY_IDS)[number];
|
|
270
|
+
/** A library an app depends on, and where it is installed. */
|
|
271
|
+
interface LibrarySource {
|
|
272
|
+
package: string;
|
|
273
|
+
/** The installed package's folder, absolute; undefined when it is a dependency but not installed. */
|
|
274
|
+
dir?: string | undefined;
|
|
275
|
+
/** The installed version. */
|
|
276
|
+
version?: string | undefined;
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/config.d.ts
|
|
280
|
+
declare const RULE_IDS: readonly ["no-hardcoded-color", "no-hardcoded-spacing", "no-hardcoded-radius", "prefer-design-system-component", "no-unknown-component", "no-unknown-prop", "no-unknown-variant", "icon-button-accessible-name"];
|
|
281
|
+
type RuleId = (typeof RULE_IDS)[number];
|
|
282
|
+
declare const severitySchema: z.ZodEnum<{
|
|
283
|
+
error: "error";
|
|
284
|
+
off: "off";
|
|
285
|
+
warn: "warn";
|
|
286
|
+
}>;
|
|
287
|
+
type RuleSeverity = z.infer<typeof severitySchema>;
|
|
288
|
+
declare const ruleOptionsSchema: z.ZodObject<{
|
|
289
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
290
|
+
}, z.core.$strict>;
|
|
291
|
+
type RuleOptions = z.infer<typeof ruleOptionsSchema>;
|
|
292
|
+
declare const configSchema: z.ZodObject<{
|
|
293
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
294
|
+
components: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
295
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
296
|
+
tokens: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
297
|
+
path: z.ZodString;
|
|
298
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
299
|
+
}, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
300
|
+
path: z.ZodString;
|
|
301
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
302
|
+
}, z.core.$strict>]>>]>>;
|
|
303
|
+
docs: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
304
|
+
tsconfig: z.ZodOptional<z.ZodString>;
|
|
305
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
306
|
+
elements: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
307
|
+
libraries: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodArray<z.ZodEnum<{
|
|
308
|
+
mui: "mui";
|
|
309
|
+
}>>]>>;
|
|
310
|
+
includeDesignSystem: z.ZodOptional<z.ZodBoolean>;
|
|
311
|
+
rules: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
312
|
+
"no-hardcoded-color": "no-hardcoded-color";
|
|
313
|
+
"no-hardcoded-spacing": "no-hardcoded-spacing";
|
|
314
|
+
"no-hardcoded-radius": "no-hardcoded-radius";
|
|
315
|
+
"prefer-design-system-component": "prefer-design-system-component";
|
|
316
|
+
"no-unknown-component": "no-unknown-component";
|
|
317
|
+
"no-unknown-prop": "no-unknown-prop";
|
|
318
|
+
"no-unknown-variant": "no-unknown-variant";
|
|
319
|
+
"icon-button-accessible-name": "icon-button-accessible-name";
|
|
320
|
+
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodEnum<{
|
|
321
|
+
error: "error";
|
|
322
|
+
off: "off";
|
|
323
|
+
warn: "warn";
|
|
324
|
+
}>, z.ZodTuple<[z.ZodEnum<{
|
|
325
|
+
error: "error";
|
|
326
|
+
off: "off";
|
|
327
|
+
warn: "warn";
|
|
328
|
+
}>], null>, z.ZodTuple<[z.ZodEnum<{
|
|
329
|
+
error: "error";
|
|
330
|
+
off: "off";
|
|
331
|
+
warn: "warn";
|
|
332
|
+
}>, z.ZodObject<{
|
|
333
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
334
|
+
}, z.core.$strict>], null>]>>>;
|
|
335
|
+
overrides: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
336
|
+
files: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
337
|
+
rules: z.ZodRecord<z.ZodEnum<{
|
|
338
|
+
"no-hardcoded-color": "no-hardcoded-color";
|
|
339
|
+
"no-hardcoded-spacing": "no-hardcoded-spacing";
|
|
340
|
+
"no-hardcoded-radius": "no-hardcoded-radius";
|
|
341
|
+
"prefer-design-system-component": "prefer-design-system-component";
|
|
342
|
+
"no-unknown-component": "no-unknown-component";
|
|
343
|
+
"no-unknown-prop": "no-unknown-prop";
|
|
344
|
+
"no-unknown-variant": "no-unknown-variant";
|
|
345
|
+
"icon-button-accessible-name": "icon-button-accessible-name";
|
|
346
|
+
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodEnum<{
|
|
347
|
+
error: "error";
|
|
348
|
+
off: "off";
|
|
349
|
+
warn: "warn";
|
|
350
|
+
}>, z.ZodTuple<[z.ZodEnum<{
|
|
351
|
+
error: "error";
|
|
352
|
+
off: "off";
|
|
353
|
+
warn: "warn";
|
|
354
|
+
}>], null>, z.ZodTuple<[z.ZodEnum<{
|
|
355
|
+
error: "error";
|
|
356
|
+
off: "off";
|
|
357
|
+
warn: "warn";
|
|
358
|
+
}>, z.ZodObject<{
|
|
359
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
360
|
+
}, z.core.$strict>], null>]>>;
|
|
361
|
+
}, z.core.$strict>>>;
|
|
362
|
+
}, z.core.$strict>;
|
|
363
|
+
type Config = z.input<typeof configSchema>;
|
|
364
|
+
/** Identity helper for typed `onsystem.config.ts` files. */
|
|
365
|
+
declare function defineConfig(config: Config): Config;
|
|
366
|
+
interface TokenSourceConfig {
|
|
367
|
+
path: string;
|
|
368
|
+
prefix?: string | undefined;
|
|
369
|
+
/** Read only when no other source finds a token file (zero config's `DESIGN.md`). */
|
|
370
|
+
fallback?: boolean | undefined;
|
|
371
|
+
}
|
|
372
|
+
interface ResolvedRule {
|
|
373
|
+
severity: RuleSeverity;
|
|
374
|
+
options: RuleOptions;
|
|
375
|
+
}
|
|
376
|
+
/** Rule settings for the files that match `files` (root-relative globs). */
|
|
377
|
+
interface ResolvedOverride {
|
|
378
|
+
files: string[];
|
|
379
|
+
rules: Partial<Record<RuleId, ResolvedRule>>;
|
|
380
|
+
}
|
|
381
|
+
interface ResolvedConfig {
|
|
382
|
+
root: string;
|
|
383
|
+
configFile?: string | undefined;
|
|
384
|
+
components: string[];
|
|
385
|
+
/** What `check`, the ESLint plugin and the hook leave out of the project's own files. */
|
|
386
|
+
exclude: string[];
|
|
387
|
+
/**
|
|
388
|
+
* What finding the design system's own files (components, tokens, docs) leaves out, when it
|
|
389
|
+
* is not `exclude`: a design-system package's own list, rebased onto the package. An app that
|
|
390
|
+
* takes on the package's config leaves out the default `exclude` patterns as well.
|
|
391
|
+
*/
|
|
392
|
+
designSystemExclude?: string[] | undefined;
|
|
393
|
+
tokens: TokenSourceConfig[];
|
|
394
|
+
docs: string[];
|
|
395
|
+
tsconfig?: string | undefined;
|
|
396
|
+
importPath?: string | undefined;
|
|
397
|
+
/** Import specifiers for component files, from the `exports` of the package that holds them. */
|
|
398
|
+
imports?: ImportMapping[] | undefined;
|
|
399
|
+
/** How the design system was found when the config does not say (`components.json`, a workspace package). */
|
|
400
|
+
detected?: string | undefined;
|
|
401
|
+
/**
|
|
402
|
+
* Several design systems found at once, the most imported first: its components win
|
|
403
|
+
* where two share a name, and are the ones suggested for native elements.
|
|
404
|
+
*/
|
|
405
|
+
designSystems?: DesignSystemSource[] | undefined;
|
|
406
|
+
/** A Tailwind v3 config, which maps color classes to custom properties (`primary` → `hsl(var(--primary))`). */
|
|
407
|
+
tailwindConfig?: string | undefined;
|
|
408
|
+
/**
|
|
409
|
+
* Published component libraries the project depends on, read from their type declarations
|
|
410
|
+
* (MUI), whatever the config says about `components`: their components are checked where
|
|
411
|
+
* the code imports them, and the project's own components win a shared name.
|
|
412
|
+
*/
|
|
413
|
+
libraries?: LibrarySource[] | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* The config's `libraries`: the ids of the libraries to read, or false for none. Undefined
|
|
416
|
+
* reads every library onsystem supports.
|
|
417
|
+
*/
|
|
418
|
+
libraryIds?: false | LibraryId[] | undefined;
|
|
419
|
+
/** Libraries the project depends on that `libraries` leaves out, so they are not read. */
|
|
420
|
+
librariesOff?: LibrarySource[] | undefined;
|
|
421
|
+
elements: Record<string, string>;
|
|
422
|
+
/** `check` lints the component files themselves, which it skips by default. */
|
|
423
|
+
includeDesignSystem: boolean;
|
|
424
|
+
rules: Record<RuleId, ResolvedRule>;
|
|
425
|
+
/** Per-file rule settings, applied in order over `rules`. */
|
|
426
|
+
overrides?: ResolvedOverride[] | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* The folder `overrides` globs are relative to, when it is not the root: the workspace
|
|
429
|
+
* root, for a project that takes its settings from a config there.
|
|
430
|
+
*/
|
|
431
|
+
base?: string | undefined;
|
|
432
|
+
/**
|
|
433
|
+
* The design-system package whose config this is: a dependency whose package.json declares it
|
|
434
|
+
* (`"onsystem": "./onsystem.config.json"`), taken on by a project with no config of its own.
|
|
435
|
+
* Its paths are rebased from the package; its `tsconfig`, `overrides` and
|
|
436
|
+
* `includeDesignSystem` stay with it.
|
|
437
|
+
*/
|
|
438
|
+
designSystemPackage?: DesignSystemPackage | undefined;
|
|
439
|
+
/** `components` comes from the config file or `--components`, not from detection or the defaults. */
|
|
440
|
+
configured?: boolean | undefined;
|
|
441
|
+
/**
|
|
442
|
+
* What to tell the user about the config's name: a config file found under its name from
|
|
443
|
+
* before the rename to onsystem. The CLI prints these once per run, the server logs them once.
|
|
444
|
+
*/
|
|
445
|
+
deprecations?: string[] | undefined;
|
|
446
|
+
/**
|
|
447
|
+
* What to tell the user about a design-system package's config: one installed from a
|
|
448
|
+
* registry whose declaration cannot be read, which was skipped, or paths in one that point
|
|
449
|
+
* outside it, which were ignored. The CLI prints these once per run, the server logs them
|
|
450
|
+
* once, and the ESLint plugin writes them once to stderr.
|
|
451
|
+
*/
|
|
452
|
+
warnings?: string[] | undefined;
|
|
453
|
+
}
|
|
454
|
+
interface LoadConfigOptions {
|
|
455
|
+
/** Where to look for a config file when `root` and `config` are not given. */
|
|
456
|
+
cwd?: string;
|
|
457
|
+
/** Project root. Defaults to the config file's directory, then `cwd`. */
|
|
458
|
+
root?: string | undefined;
|
|
459
|
+
/** Explicit config file path. */
|
|
460
|
+
config?: string | undefined;
|
|
461
|
+
/**
|
|
462
|
+
* The folder the config file's paths and globs are written relative to, when it is not
|
|
463
|
+
* the root: a workspace root whose config a project in it takes on.
|
|
464
|
+
*/
|
|
465
|
+
base?: string | undefined;
|
|
466
|
+
/** CLI overrides; replace the config file's values when set. */
|
|
467
|
+
components?: string[] | undefined;
|
|
468
|
+
tokens?: string[] | undefined;
|
|
469
|
+
docs?: string[] | undefined;
|
|
470
|
+
includeDesignSystem?: boolean | undefined;
|
|
471
|
+
/**
|
|
472
|
+
* Read a JSON config only: a JavaScript or TypeScript config is an error rather than run.
|
|
473
|
+
* For a project the MCP server found from the path a tool call names, which a prompt can
|
|
474
|
+
* choose, unlike the folder the server was started in.
|
|
475
|
+
*/
|
|
476
|
+
jsonConfigOnly?: boolean | undefined;
|
|
477
|
+
}
|
|
478
|
+
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
|
|
479
|
+
/** JSON Schema for editor completion in `onsystem.config.json`. */
|
|
480
|
+
declare function configJsonSchema(): Record<string, unknown>;
|
|
481
|
+
//#endregion
|
|
482
|
+
export { TOKEN_CATEGORIES as C, VariantInfo as D, TokenCategory as E, ImportMapping as O, SourceLocation as S, Token as T, DocSection as _, ResolvedRule as a, PropInfo as b, configJsonSchema as c, CheckResult as d, ComponentDocs as f, Diagnostic as g, DesignSystemModel as h, ResolvedConfig as i, defineConfig as l, CompoundVariantInfo as m, LoadConfigOptions as n, RuleId as o, ComponentInfo as p, RULE_IDS as r, RuleOptions as s, Config as t, loadConfig as u, ExampleInfo as v, TextEdit as w, Severity as x, InheritedProps as y };
|