@razorwind/eslint 0.0.2

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.
@@ -0,0 +1,110 @@
1
+ import { a as DesignSystemRuleId, d as ManifestToken, f as TokenCategory, i as DesignSystemOptions, l as ManifestComponent, n as CoreRuleId, o as DesignSystemSettings, p as TokenReferenceStyle, r as DesignSystemManifest, s as DesignSystemSeverity, t as ComponentRole, u as ManifestFont } from "./types-cqb0r3sP.cjs";
2
+ import { GuardrailRuleModule } from "@razorwind/tailwindcss/eslint-runtime";
3
+ import { GuardrailRuleModule as GuardrailRuleModule$1 } from "@razorwind/tamagui/eslint-runtime";
4
+ //#region src/runtime/ast.d.ts
5
+ interface Node {
6
+ type: string;
7
+ parent?: Node;
8
+ range?: [number, number];
9
+ [key: string]: unknown;
10
+ }
11
+ interface Fix {
12
+ range: [number, number];
13
+ text: string;
14
+ }
15
+ interface Fixer {
16
+ replaceText: (node: Node, text: string) => Fix;
17
+ replaceTextRange: (range: [number, number], text: string) => Fix;
18
+ }
19
+ type FixFunction = (fixer: Fixer) => Fix | Fix[] | null;
20
+ interface SuggestionDescriptor {
21
+ messageId: string;
22
+ data?: Record<string, string>;
23
+ fix: FixFunction;
24
+ }
25
+ interface ReportDescriptor {
26
+ node: Node;
27
+ messageId: string;
28
+ data?: Record<string, string>;
29
+ fix?: FixFunction;
30
+ suggest?: SuggestionDescriptor[];
31
+ }
32
+ interface Variable {
33
+ defs: {
34
+ node: Node;
35
+ }[];
36
+ }
37
+ interface Scope {
38
+ set: Map<string, Variable>;
39
+ upper: Scope | null;
40
+ }
41
+ interface SourceCode {
42
+ getText: (node?: Node) => string;
43
+ getScope?: (node: Node) => Scope;
44
+ }
45
+ interface RuleContext {
46
+ report: (descriptor: ReportDescriptor) => void;
47
+ settings?: Record<string, unknown>;
48
+ sourceCode: SourceCode;
49
+ }
50
+ type Visitors = Record<string, (node: Node) => void>;
51
+ interface RuleModule {
52
+ meta: {
53
+ type: "problem" | "suggestion";
54
+ docs: {
55
+ description: string;
56
+ };
57
+ messages: Record<string, string>;
58
+ schema: [];
59
+ fixable?: "code";
60
+ hasSuggestions?: boolean;
61
+ };
62
+ create: (context: RuleContext) => Visitors;
63
+ }
64
+ //#endregion
65
+ //#region src/runtime/settings.d.ts
66
+ /** Settings key the core rules read their sources from. */
67
+ declare const SETTINGS_KEY = "razorwind-design-system";
68
+ //#endregion
69
+ //#region src/runtime/values.d.ts
70
+ /**
71
+ * Normalize a CSS color to `#rrggbbaa` (hex, `rgb()`, `hsl()`, named colors);
72
+ * other color spaces are compared as lowercased, whitespace-collapsed text.
73
+ */
74
+ declare function normalizeColor(input: string): string | undefined;
75
+ //#endregion
76
+ //#region src/runtime.d.ts
77
+ type AnyRuleModule = RuleModule | GuardrailRuleModule | GuardrailRuleModule$1;
78
+ interface DesignSystemConfig {
79
+ files: string[];
80
+ ignores: string[];
81
+ plugins: Record<string, DesignSystemEslintPlugin>;
82
+ settings: Record<string, unknown>;
83
+ rules: Record<string, DesignSystemSeverity>;
84
+ }
85
+ interface DesignSystemEslintPlugin {
86
+ meta: {
87
+ name: string;
88
+ version: string;
89
+ };
90
+ rules: Partial<Record<DesignSystemRuleId, AnyRuleModule>>;
91
+ configs: {
92
+ recommended?: DesignSystemConfig;
93
+ };
94
+ }
95
+ interface DesignSystemPlugin {
96
+ plugin: DesignSystemEslintPlugin;
97
+ rules: Partial<Record<DesignSystemRuleId, AnyRuleModule>>;
98
+ defaultSeverity: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
99
+ configs: DesignSystemEslintPlugin["configs"];
100
+ /** Build a flat-config block to spread into `eslint.config.*`. */
101
+ config: (options?: DesignSystemOptions) => DesignSystemConfig;
102
+ }
103
+ /**
104
+ * Build the design-system rules, default severities and flat-config factory
105
+ * for a schema-derived manifest.
106
+ */
107
+ declare function createDesignSystemPlugin(manifest: DesignSystemManifest): DesignSystemPlugin;
108
+ //#endregion
109
+ export { AnyRuleModule, type ComponentRole, type CoreRuleId, DesignSystemConfig, DesignSystemEslintPlugin, type DesignSystemManifest, type DesignSystemOptions, DesignSystemPlugin, type DesignSystemRuleId, type DesignSystemSettings, type DesignSystemSeverity, type ManifestComponent, type ManifestFont, type ManifestToken, SETTINGS_KEY, type TokenCategory, type TokenReferenceStyle, createDesignSystemPlugin, normalizeColor };
110
+ //# sourceMappingURL=runtime.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.cts","names":["TailwindRuleModule","TamaguiRuleModule"],"sources":["../src/runtime/ast.ts","../src/runtime/settings.ts","../src/runtime/values.ts","../src/runtime.ts"],"mappings":";;;;UAuBiB;EACf;EACA,SAAS;EACT;GACC;;UAGc;EACf;EACA;;UAGe;EACf,cAAc,MAAM,MAAM,iBAAiB;EAC3C,mBAAmB,yBAAyB,iBAAiB;;KAGnD,eAAe,OAAO,UAAU,MAAM;UAEjC;EACf;EACA,OAAO;EACP,KAAK;;UAGU;EACf,MAAM;EACN;EACA,OAAO;EACP,MAAM;EACN,UAAU;;UAGF;EACR;IAAQ,MAAM;;;UAGC;EACf,KAAK,YAAY;EACjB,OAAO;;UAGQ;EACf,UAAU,OAAO;EACjB,YAAY,MAAM,SAAS;;UAGZ;EACf,SAAS,YAAY;EACrB,WAAW;EACX,YAAY;;KAGF,WAAW,gBAAgB,MAAM;UAE5B;EACf;IACE;IACA;MAAQ;;IACR,UAAU;IACV;IACA;IACA;;EAEF,SAAS,SAAS,gBAAgB;;;;;cCjEvB;;;;;;;iBC6hBG,eAAe;;;KChenB,gBAAgB,aAAaA,sBAAqBC;UAE7C;EACf;EACA;EACA,SAAS,eAAe;EACxB,UAAU;EACV,OAAO,eAAe;;UAGP;EACf;IAAQ;IAAc;;EACtB,OAAO,QAAQ,OAAO,oBAAoB;EAC1C;IAAW,cAAc;;;UAGV;EACf,QAAQ;EACR,OAAO,QAAQ,OAAO,oBAAoB;EAC1C,iBAAiB,QAAQ,OAAO,oBAAoB;EACpD,SAAS;;EAET,SAAS,UAAU,wBAAwB;;;;;;iBA0G7B,yBACd,UAAU,uBACT"}
@@ -0,0 +1,110 @@
1
+ import { a as DesignSystemRuleId, d as ManifestToken, f as TokenCategory, i as DesignSystemOptions, l as ManifestComponent, n as CoreRuleId, o as DesignSystemSettings, p as TokenReferenceStyle, r as DesignSystemManifest, s as DesignSystemSeverity, t as ComponentRole, u as ManifestFont } from "./types-BskEdv2u.mjs";
2
+ import { GuardrailRuleModule } from "@razorwind/tailwindcss/eslint-runtime";
3
+ import { GuardrailRuleModule as GuardrailRuleModule$1 } from "@razorwind/tamagui/eslint-runtime";
4
+ //#region src/runtime/ast.d.ts
5
+ interface Node {
6
+ type: string;
7
+ parent?: Node;
8
+ range?: [number, number];
9
+ [key: string]: unknown;
10
+ }
11
+ interface Fix {
12
+ range: [number, number];
13
+ text: string;
14
+ }
15
+ interface Fixer {
16
+ replaceText: (node: Node, text: string) => Fix;
17
+ replaceTextRange: (range: [number, number], text: string) => Fix;
18
+ }
19
+ type FixFunction = (fixer: Fixer) => Fix | Fix[] | null;
20
+ interface SuggestionDescriptor {
21
+ messageId: string;
22
+ data?: Record<string, string>;
23
+ fix: FixFunction;
24
+ }
25
+ interface ReportDescriptor {
26
+ node: Node;
27
+ messageId: string;
28
+ data?: Record<string, string>;
29
+ fix?: FixFunction;
30
+ suggest?: SuggestionDescriptor[];
31
+ }
32
+ interface Variable {
33
+ defs: {
34
+ node: Node;
35
+ }[];
36
+ }
37
+ interface Scope {
38
+ set: Map<string, Variable>;
39
+ upper: Scope | null;
40
+ }
41
+ interface SourceCode {
42
+ getText: (node?: Node) => string;
43
+ getScope?: (node: Node) => Scope;
44
+ }
45
+ interface RuleContext {
46
+ report: (descriptor: ReportDescriptor) => void;
47
+ settings?: Record<string, unknown>;
48
+ sourceCode: SourceCode;
49
+ }
50
+ type Visitors = Record<string, (node: Node) => void>;
51
+ interface RuleModule {
52
+ meta: {
53
+ type: "problem" | "suggestion";
54
+ docs: {
55
+ description: string;
56
+ };
57
+ messages: Record<string, string>;
58
+ schema: [];
59
+ fixable?: "code";
60
+ hasSuggestions?: boolean;
61
+ };
62
+ create: (context: RuleContext) => Visitors;
63
+ }
64
+ //#endregion
65
+ //#region src/runtime/settings.d.ts
66
+ /** Settings key the core rules read their sources from. */
67
+ declare const SETTINGS_KEY = "razorwind-design-system";
68
+ //#endregion
69
+ //#region src/runtime/values.d.ts
70
+ /**
71
+ * Normalize a CSS color to `#rrggbbaa` (hex, `rgb()`, `hsl()`, named colors);
72
+ * other color spaces are compared as lowercased, whitespace-collapsed text.
73
+ */
74
+ declare function normalizeColor(input: string): string | undefined;
75
+ //#endregion
76
+ //#region src/runtime.d.ts
77
+ type AnyRuleModule = RuleModule | GuardrailRuleModule | GuardrailRuleModule$1;
78
+ interface DesignSystemConfig {
79
+ files: string[];
80
+ ignores: string[];
81
+ plugins: Record<string, DesignSystemEslintPlugin>;
82
+ settings: Record<string, unknown>;
83
+ rules: Record<string, DesignSystemSeverity>;
84
+ }
85
+ interface DesignSystemEslintPlugin {
86
+ meta: {
87
+ name: string;
88
+ version: string;
89
+ };
90
+ rules: Partial<Record<DesignSystemRuleId, AnyRuleModule>>;
91
+ configs: {
92
+ recommended?: DesignSystemConfig;
93
+ };
94
+ }
95
+ interface DesignSystemPlugin {
96
+ plugin: DesignSystemEslintPlugin;
97
+ rules: Partial<Record<DesignSystemRuleId, AnyRuleModule>>;
98
+ defaultSeverity: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
99
+ configs: DesignSystemEslintPlugin["configs"];
100
+ /** Build a flat-config block to spread into `eslint.config.*`. */
101
+ config: (options?: DesignSystemOptions) => DesignSystemConfig;
102
+ }
103
+ /**
104
+ * Build the design-system rules, default severities and flat-config factory
105
+ * for a schema-derived manifest.
106
+ */
107
+ declare function createDesignSystemPlugin(manifest: DesignSystemManifest): DesignSystemPlugin;
108
+ //#endregion
109
+ export { AnyRuleModule, type ComponentRole, type CoreRuleId, DesignSystemConfig, DesignSystemEslintPlugin, type DesignSystemManifest, type DesignSystemOptions, DesignSystemPlugin, type DesignSystemRuleId, type DesignSystemSettings, type DesignSystemSeverity, type ManifestComponent, type ManifestFont, type ManifestToken, SETTINGS_KEY, type TokenCategory, type TokenReferenceStyle, createDesignSystemPlugin, normalizeColor };
110
+ //# sourceMappingURL=runtime.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.mts","names":["TailwindRuleModule","TamaguiRuleModule"],"sources":["../src/runtime/ast.ts","../src/runtime/settings.ts","../src/runtime/values.ts","../src/runtime.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./runtime-gmz9xNDY.mjs";export{t as SETTINGS_KEY,n as createDesignSystemPlugin,e as normalizeColor};
@@ -0,0 +1,207 @@
1
+ import { GuardrailRuleId as TailwindGuardrailRuleId, GuardrailSettings as TailwindGuardrailSettings, GuardrailTheme as TailwindGuardrailTheme } from "@razorwind/tailwindcss/eslint-runtime";
2
+ import { GuardrailRuleId as TamaguiGuardrailRuleId, GuardrailSettings as TamaguiGuardrailSettings, GuardrailTheme as TamaguiGuardrailTheme } from "@razorwind/tamagui/eslint-runtime";
3
+ import { TokenType } from "@power-plant/dtcg-schema";
4
+ //#region src/types.d.ts
5
+ /**
6
+ * Options for the Razorwind ESLint design-system plugin generator.
7
+ */
8
+ interface EslintPluginOptions {
9
+ /**
10
+ * Output path of the generated ESLint plugin module, written relative to
11
+ * the execution cwd.
12
+ *
13
+ * @defaultValue "eslint/design-system/index.mjs"
14
+ */
15
+ eslintPath?: string;
16
+ /**
17
+ * Rule namespace used in `eslint.config.*`
18
+ * (`<prefix>/ensure-design-token-usage`).
19
+ *
20
+ * @defaultValue "design-system"
21
+ */
22
+ prefix?: string;
23
+ /**
24
+ * Module the generated file imports `createDesignSystemPlugin` from.
25
+ *
26
+ * @defaultValue "\@razorwind/eslint/runtime"
27
+ */
28
+ runtimeImport?: string;
29
+ /**
30
+ * Prefix of the CSS custom properties generated for the design tokens
31
+ * (`--<prefix>-color-primary`). Set to `false` when tokens are emitted
32
+ * without a prefix.
33
+ *
34
+ * @defaultValue initials derived from the schema name, matching `\@razorwind/css`
35
+ */
36
+ cssVarPrefix?: string | false;
37
+ /**
38
+ * Include the `\@razorwind/tailwindcss` class guardrails, exposed as
39
+ * `<prefix>/tailwind-*` rules.
40
+ *
41
+ * @defaultValue true
42
+ */
43
+ tailwind?: boolean;
44
+ /**
45
+ * Include the `\@razorwind/tamagui` v3 flat-value guardrails, exposed as
46
+ * `<prefix>/tamagui-*` rules. Pass an object to forward the app's Tamagui
47
+ * shorthands or restrict the token types.
48
+ *
49
+ * @defaultValue false
50
+ */
51
+ tamagui?: boolean | {
52
+ shorthands?: Record<string, string>;
53
+ includeTypes?: TokenType[];
54
+ };
55
+ /**
56
+ * Override body for generated `INSTALL.md`. When omitted, ESLint flat-config
57
+ * wiring steps are generated for the output file.
58
+ */
59
+ installGuide?: string;
60
+ }
61
+ /**
62
+ * Design-token categories a style property resolves against. Derived from
63
+ * the DTCG `$type` and the token path.
64
+ */
65
+ type TokenCategory = "color" | "shadow" | "space" | "size" | "radius" | "borderWidth" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "typography" | "duration" | "easing" | "zIndex" | "opacity";
66
+ /**
67
+ * The part a schema component plays, used to point raw HTML and hand-rolled
68
+ * patterns at the design-system replacement.
69
+ */
70
+ type ComponentRole = "button" | "icon-button" | "link" | "checkbox" | "code" | "heading" | "image" | "radio" | "range" | "select" | "text-input" | "textarea" | "text" | "visually-hidden" | "icon" | "primitive";
71
+ /** A design token as the lint rules see it. */
72
+ interface ManifestToken {
73
+ /** Dot-separated token path (`color.primary`). */
74
+ path: string;
75
+ /** DTCG `$type`, when known. */
76
+ type?: string;
77
+ /** Category style properties resolve this token against. */
78
+ category?: TokenCategory;
79
+ /** Generated CSS custom property (`--acme-color-primary`). */
80
+ cssVar: string;
81
+ /** Resolved CSS value in the primary theme, used to suggest replacements. */
82
+ value?: string;
83
+ /** True when the token aliases another token (a semantic token). */
84
+ alias?: boolean;
85
+ /** DTCG `$deprecated`: `true` or the deprecation note. */
86
+ deprecated?: true | string;
87
+ /** Replacement token path, read from a `{path}` reference in `$deprecated`. */
88
+ replacement?: string;
89
+ }
90
+ /** A schema component as the lint rules see it. */
91
+ interface ManifestComponent {
92
+ /** Schema component name (`icon-button`). */
93
+ name: string;
94
+ /** JSX names the component is rendered as (`IconButton`). */
95
+ jsx: string[];
96
+ /** Roles inferred from the component name and title. */
97
+ roles: ComponentRole[];
98
+ /** True when the component is tagged `deprecated`. */
99
+ deprecated?: boolean;
100
+ /** JSX names of the related components suggested as replacements. */
101
+ replacements?: string[];
102
+ }
103
+ /** A schema font family. */
104
+ interface ManifestFont {
105
+ /** CSS `font-family` name. */
106
+ family: string;
107
+ /** Font role (`sans`, `mono`, …). */
108
+ role?: string;
109
+ }
110
+ /**
111
+ * Schema-derived design-system manifest serialized into the generated ESLint
112
+ * module.
113
+ */
114
+ interface DesignSystemManifest {
115
+ /** Plugin `meta.name`. */
116
+ name: string;
117
+ /** Plugin `meta.version`. */
118
+ version: string;
119
+ /** Rule namespace used in flat config. */
120
+ prefix: string;
121
+ /** CSS custom-property prefix, when tokens are emitted with one. */
122
+ cssVarPrefix?: string;
123
+ /** Theme ids present in the schema (`light`, `dark`). */
124
+ themes: string[];
125
+ tokens: ManifestToken[];
126
+ components: ManifestComponent[];
127
+ /** JSX names of the schema icons (`ArrowRightIcon`). */
128
+ icons: string[];
129
+ fonts: ManifestFont[];
130
+ /** `\@razorwind/tailwindcss` guardrail theme, when enabled. */
131
+ tailwind?: TailwindGuardrailTheme;
132
+ /** `\@razorwind/tamagui` guardrail theme, when enabled. */
133
+ tamagui?: TamaguiGuardrailTheme;
134
+ }
135
+ /** Raw HTML elements with a design-system replacement rule. */
136
+ type HtmlElementRuleId = "no-html-anchor" | "no-html-button" | "no-html-checkbox" | "no-html-code" | "no-html-heading" | "no-html-image" | "no-html-radio" | "no-html-range" | "no-html-select" | "no-html-text-input" | "no-html-textarea";
137
+ /** Rule ids ported from `\@atlaskit/eslint-plugin-design-system`. */
138
+ type CoreRuleId = "ensure-design-token-usage" | "no-unsafe-design-token-usage" | "no-deprecated-design-token-usage" | "use-tokens-space" | "use-tokens-shape" | "use-tokens-typography" | "use-tokens-motion" | "expand-motion-shorthand" | "no-margin" | "no-physical-properties" | "no-nested-styles" | "no-exported-css" | "no-exported-keyframes" | "no-empty-styled-expression" | "no-css-tagged-template-expression" | "no-styled-tagged-template-expression" | "no-keyframes-tagged-template-expression" | "no-banned-imports" | "no-deprecated-imports" | "no-unsafe-style-overrides" | "prefer-primitives" | "use-primitives-text" | "use-visually-hidden" | "icon-label" | "no-empty-icon-button-label" | "no-placeholder" | "no-readonly-or-disabled-inputs" | HtmlElementRuleId;
139
+ type TailwindRuleId = `tailwind-${TailwindGuardrailRuleId}`;
140
+ type TamaguiRuleId = `tamagui-${TamaguiGuardrailRuleId}`;
141
+ /** Every rule id the generated plugin can expose. */
142
+ type DesignSystemRuleId = CoreRuleId | TailwindRuleId | TamaguiRuleId;
143
+ type DesignSystemSeverity = "error" | "warn" | "off";
144
+ /** How suggestions reference a token. */
145
+ type TokenReferenceStyle = "css-var" | "function";
146
+ /** Shared ESLint `settings["razorwind-design-system"]` read by the core rules. */
147
+ interface DesignSystemSettings {
148
+ /**
149
+ * Functions that resolve a token path (`token("color.primary")`).
150
+ *
151
+ * @defaultValue ["token"]
152
+ */
153
+ tokenFunctions?: string[];
154
+ /**
155
+ * How suggested fixes reference a token: `var(--acme-color-primary)` or
156
+ * `token("color.primary")` (the first of {@link tokenFunctions}).
157
+ *
158
+ * @defaultValue "css-var"
159
+ */
160
+ tokenReference?: TokenReferenceStyle;
161
+ /**
162
+ * CSS-in-JS calls whose object or template arguments are styles.
163
+ * `styled.*` factories and `StyleSheet.create` are always read.
164
+ *
165
+ * @defaultValue ["css", "cssMap", "xcss", "keyframes", "injectGlobal", "createGlobalStyle"]
166
+ */
167
+ styleCallees?: string[];
168
+ /**
169
+ * JSX attributes holding style objects.
170
+ *
171
+ * @defaultValue ["style", "css", "xcss", "sx"]
172
+ */
173
+ styleAttributes?: string[];
174
+ /**
175
+ * Props on design-system components reported by `no-unsafe-style-overrides`.
176
+ *
177
+ * @defaultValue ["style", "css", "xcss", "sx", "UNSAFE_style", "UNSAFE_className"]
178
+ */
179
+ unsafeStyleProps?: string[];
180
+ /**
181
+ * Module specifiers (or prefixes ending in `/`) the design-system
182
+ * components are imported from. When set, component rules only apply to
183
+ * JSX names imported from these modules.
184
+ */
185
+ componentModules?: string[];
186
+ /**
187
+ * Modules reported by `no-banned-imports`, mapped to the reason (or the
188
+ * replacement to use instead).
189
+ */
190
+ bannedImports?: Record<string, string>;
191
+ }
192
+ /** Options for the generated flat-config factory. */
193
+ interface DesignSystemOptions extends DesignSystemSettings {
194
+ /** Glob(s) the rules apply to. */
195
+ files?: string[];
196
+ /** Glob(s) exempt from every rule. */
197
+ ignores?: string[];
198
+ /** Per-rule overrides of the schema-derived default severities. */
199
+ severity?: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
200
+ /** Class sources read by the `tailwind-*` rules. */
201
+ tailwind?: TailwindGuardrailSettings;
202
+ /** Style sources read by the `tamagui-*` rules. */
203
+ tamagui?: TamaguiGuardrailSettings;
204
+ }
205
+ //#endregion
206
+ export { DesignSystemRuleId as a, EslintPluginOptions as c, ManifestToken as d, TokenCategory as f, DesignSystemOptions as i, ManifestComponent as l, CoreRuleId as n, DesignSystemSettings as o, TokenReferenceStyle as p, DesignSystemManifest as r, DesignSystemSeverity as s, ComponentRole as t, ManifestFont as u };
207
+ //# sourceMappingURL=types-BskEdv2u.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BskEdv2u.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
@@ -0,0 +1,207 @@
1
+ import { TokenType } from "@power-plant/dtcg-schema";
2
+ import { GuardrailRuleId as TailwindGuardrailRuleId, GuardrailSettings as TailwindGuardrailSettings, GuardrailTheme as TailwindGuardrailTheme } from "@razorwind/tailwindcss/eslint-runtime";
3
+ import { GuardrailRuleId as TamaguiGuardrailRuleId, GuardrailSettings as TamaguiGuardrailSettings, GuardrailTheme as TamaguiGuardrailTheme } from "@razorwind/tamagui/eslint-runtime";
4
+ //#region src/types.d.ts
5
+ /**
6
+ * Options for the Razorwind ESLint design-system plugin generator.
7
+ */
8
+ interface EslintPluginOptions {
9
+ /**
10
+ * Output path of the generated ESLint plugin module, written relative to
11
+ * the execution cwd.
12
+ *
13
+ * @defaultValue "eslint/design-system/index.mjs"
14
+ */
15
+ eslintPath?: string;
16
+ /**
17
+ * Rule namespace used in `eslint.config.*`
18
+ * (`<prefix>/ensure-design-token-usage`).
19
+ *
20
+ * @defaultValue "design-system"
21
+ */
22
+ prefix?: string;
23
+ /**
24
+ * Module the generated file imports `createDesignSystemPlugin` from.
25
+ *
26
+ * @defaultValue "\@razorwind/eslint/runtime"
27
+ */
28
+ runtimeImport?: string;
29
+ /**
30
+ * Prefix of the CSS custom properties generated for the design tokens
31
+ * (`--<prefix>-color-primary`). Set to `false` when tokens are emitted
32
+ * without a prefix.
33
+ *
34
+ * @defaultValue initials derived from the schema name, matching `\@razorwind/css`
35
+ */
36
+ cssVarPrefix?: string | false;
37
+ /**
38
+ * Include the `\@razorwind/tailwindcss` class guardrails, exposed as
39
+ * `<prefix>/tailwind-*` rules.
40
+ *
41
+ * @defaultValue true
42
+ */
43
+ tailwind?: boolean;
44
+ /**
45
+ * Include the `\@razorwind/tamagui` v3 flat-value guardrails, exposed as
46
+ * `<prefix>/tamagui-*` rules. Pass an object to forward the app's Tamagui
47
+ * shorthands or restrict the token types.
48
+ *
49
+ * @defaultValue false
50
+ */
51
+ tamagui?: boolean | {
52
+ shorthands?: Record<string, string>;
53
+ includeTypes?: TokenType[];
54
+ };
55
+ /**
56
+ * Override body for generated `INSTALL.md`. When omitted, ESLint flat-config
57
+ * wiring steps are generated for the output file.
58
+ */
59
+ installGuide?: string;
60
+ }
61
+ /**
62
+ * Design-token categories a style property resolves against. Derived from
63
+ * the DTCG `$type` and the token path.
64
+ */
65
+ type TokenCategory = "color" | "shadow" | "space" | "size" | "radius" | "borderWidth" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "typography" | "duration" | "easing" | "zIndex" | "opacity";
66
+ /**
67
+ * The part a schema component plays, used to point raw HTML and hand-rolled
68
+ * patterns at the design-system replacement.
69
+ */
70
+ type ComponentRole = "button" | "icon-button" | "link" | "checkbox" | "code" | "heading" | "image" | "radio" | "range" | "select" | "text-input" | "textarea" | "text" | "visually-hidden" | "icon" | "primitive";
71
+ /** A design token as the lint rules see it. */
72
+ interface ManifestToken {
73
+ /** Dot-separated token path (`color.primary`). */
74
+ path: string;
75
+ /** DTCG `$type`, when known. */
76
+ type?: string;
77
+ /** Category style properties resolve this token against. */
78
+ category?: TokenCategory;
79
+ /** Generated CSS custom property (`--acme-color-primary`). */
80
+ cssVar: string;
81
+ /** Resolved CSS value in the primary theme, used to suggest replacements. */
82
+ value?: string;
83
+ /** True when the token aliases another token (a semantic token). */
84
+ alias?: boolean;
85
+ /** DTCG `$deprecated`: `true` or the deprecation note. */
86
+ deprecated?: true | string;
87
+ /** Replacement token path, read from a `{path}` reference in `$deprecated`. */
88
+ replacement?: string;
89
+ }
90
+ /** A schema component as the lint rules see it. */
91
+ interface ManifestComponent {
92
+ /** Schema component name (`icon-button`). */
93
+ name: string;
94
+ /** JSX names the component is rendered as (`IconButton`). */
95
+ jsx: string[];
96
+ /** Roles inferred from the component name and title. */
97
+ roles: ComponentRole[];
98
+ /** True when the component is tagged `deprecated`. */
99
+ deprecated?: boolean;
100
+ /** JSX names of the related components suggested as replacements. */
101
+ replacements?: string[];
102
+ }
103
+ /** A schema font family. */
104
+ interface ManifestFont {
105
+ /** CSS `font-family` name. */
106
+ family: string;
107
+ /** Font role (`sans`, `mono`, …). */
108
+ role?: string;
109
+ }
110
+ /**
111
+ * Schema-derived design-system manifest serialized into the generated ESLint
112
+ * module.
113
+ */
114
+ interface DesignSystemManifest {
115
+ /** Plugin `meta.name`. */
116
+ name: string;
117
+ /** Plugin `meta.version`. */
118
+ version: string;
119
+ /** Rule namespace used in flat config. */
120
+ prefix: string;
121
+ /** CSS custom-property prefix, when tokens are emitted with one. */
122
+ cssVarPrefix?: string;
123
+ /** Theme ids present in the schema (`light`, `dark`). */
124
+ themes: string[];
125
+ tokens: ManifestToken[];
126
+ components: ManifestComponent[];
127
+ /** JSX names of the schema icons (`ArrowRightIcon`). */
128
+ icons: string[];
129
+ fonts: ManifestFont[];
130
+ /** `\@razorwind/tailwindcss` guardrail theme, when enabled. */
131
+ tailwind?: TailwindGuardrailTheme;
132
+ /** `\@razorwind/tamagui` guardrail theme, when enabled. */
133
+ tamagui?: TamaguiGuardrailTheme;
134
+ }
135
+ /** Raw HTML elements with a design-system replacement rule. */
136
+ type HtmlElementRuleId = "no-html-anchor" | "no-html-button" | "no-html-checkbox" | "no-html-code" | "no-html-heading" | "no-html-image" | "no-html-radio" | "no-html-range" | "no-html-select" | "no-html-text-input" | "no-html-textarea";
137
+ /** Rule ids ported from `\@atlaskit/eslint-plugin-design-system`. */
138
+ type CoreRuleId = "ensure-design-token-usage" | "no-unsafe-design-token-usage" | "no-deprecated-design-token-usage" | "use-tokens-space" | "use-tokens-shape" | "use-tokens-typography" | "use-tokens-motion" | "expand-motion-shorthand" | "no-margin" | "no-physical-properties" | "no-nested-styles" | "no-exported-css" | "no-exported-keyframes" | "no-empty-styled-expression" | "no-css-tagged-template-expression" | "no-styled-tagged-template-expression" | "no-keyframes-tagged-template-expression" | "no-banned-imports" | "no-deprecated-imports" | "no-unsafe-style-overrides" | "prefer-primitives" | "use-primitives-text" | "use-visually-hidden" | "icon-label" | "no-empty-icon-button-label" | "no-placeholder" | "no-readonly-or-disabled-inputs" | HtmlElementRuleId;
139
+ type TailwindRuleId = `tailwind-${TailwindGuardrailRuleId}`;
140
+ type TamaguiRuleId = `tamagui-${TamaguiGuardrailRuleId}`;
141
+ /** Every rule id the generated plugin can expose. */
142
+ type DesignSystemRuleId = CoreRuleId | TailwindRuleId | TamaguiRuleId;
143
+ type DesignSystemSeverity = "error" | "warn" | "off";
144
+ /** How suggestions reference a token. */
145
+ type TokenReferenceStyle = "css-var" | "function";
146
+ /** Shared ESLint `settings["razorwind-design-system"]` read by the core rules. */
147
+ interface DesignSystemSettings {
148
+ /**
149
+ * Functions that resolve a token path (`token("color.primary")`).
150
+ *
151
+ * @defaultValue ["token"]
152
+ */
153
+ tokenFunctions?: string[];
154
+ /**
155
+ * How suggested fixes reference a token: `var(--acme-color-primary)` or
156
+ * `token("color.primary")` (the first of {@link tokenFunctions}).
157
+ *
158
+ * @defaultValue "css-var"
159
+ */
160
+ tokenReference?: TokenReferenceStyle;
161
+ /**
162
+ * CSS-in-JS calls whose object or template arguments are styles.
163
+ * `styled.*` factories and `StyleSheet.create` are always read.
164
+ *
165
+ * @defaultValue ["css", "cssMap", "xcss", "keyframes", "injectGlobal", "createGlobalStyle"]
166
+ */
167
+ styleCallees?: string[];
168
+ /**
169
+ * JSX attributes holding style objects.
170
+ *
171
+ * @defaultValue ["style", "css", "xcss", "sx"]
172
+ */
173
+ styleAttributes?: string[];
174
+ /**
175
+ * Props on design-system components reported by `no-unsafe-style-overrides`.
176
+ *
177
+ * @defaultValue ["style", "css", "xcss", "sx", "UNSAFE_style", "UNSAFE_className"]
178
+ */
179
+ unsafeStyleProps?: string[];
180
+ /**
181
+ * Module specifiers (or prefixes ending in `/`) the design-system
182
+ * components are imported from. When set, component rules only apply to
183
+ * JSX names imported from these modules.
184
+ */
185
+ componentModules?: string[];
186
+ /**
187
+ * Modules reported by `no-banned-imports`, mapped to the reason (or the
188
+ * replacement to use instead).
189
+ */
190
+ bannedImports?: Record<string, string>;
191
+ }
192
+ /** Options for the generated flat-config factory. */
193
+ interface DesignSystemOptions extends DesignSystemSettings {
194
+ /** Glob(s) the rules apply to. */
195
+ files?: string[];
196
+ /** Glob(s) exempt from every rule. */
197
+ ignores?: string[];
198
+ /** Per-rule overrides of the schema-derived default severities. */
199
+ severity?: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
200
+ /** Class sources read by the `tailwind-*` rules. */
201
+ tailwind?: TailwindGuardrailSettings;
202
+ /** Style sources read by the `tamagui-*` rules. */
203
+ tamagui?: TamaguiGuardrailSettings;
204
+ }
205
+ //#endregion
206
+ export { DesignSystemRuleId as a, EslintPluginOptions as c, ManifestToken as d, TokenCategory as f, DesignSystemOptions as i, ManifestComponent as l, CoreRuleId as n, DesignSystemSettings as o, TokenReferenceStyle as p, DesignSystemManifest as r, DesignSystemSeverity as s, ComponentRole as t, ManifestFont as u };
207
+ //# sourceMappingURL=types-cqb0r3sP.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-cqb0r3sP.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;UA0CiB;;;;;;;EAOf;;;;;;;EAQA;;;;;;EAOA;;;;;;;;EASA;;;;;;;EAQA;;;;;;;;EASA;IAGM,aAAa;IACb,eAAe;;;;;;EAOrB;;;;;;KAOU;;;;;KAsBA;;UAmBK;;EAEf;;EAEA;;EAEA,WAAW;;EAEX;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;EAEA,OAAO;;EAEP;;EAEA;;;UAIe;;EAEf;;EAEA;;;;;;UAOe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;EACA,QAAQ;EACR,YAAY;;EAEZ;EACA,OAAO;;EAEP,WAAW;;EAEX,UAAU;;;KAIA;;KAcA,quBA4BR;KAEQ,6BAA6B;KAC7B,2BAA2B;;KAG3B,qBAAqB,aAAa,iBAAiB;KAEnD;;KAGA;;UAGK;;;;;;EAMf;;;;;;;EAOA,iBAAiB;;;;;;;EAOjB;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;EAKA,gBAAgB;;;UAID,4BAA4B;;EAE3C;;EAEA;;EAEA,WAAW,QAAQ,OAAO,oBAAoB;;EAE9C,WAAW;;EAEX,UAAU"}