@razorwind/stylelint 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.
- package/LICENSE +201 -0
- package/README.md +372 -0
- package/dist/index.cjs +75 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +54 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +76 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runtime-CZCP4myF.mjs +2 -0
- package/dist/runtime-CZCP4myF.mjs.map +1 -0
- package/dist/runtime-D4YzdLS9.cjs +1 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.cts +89 -0
- package/dist/runtime.d.cts.map +1 -0
- package/dist/runtime.d.mts +89 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +1 -0
- package/dist/types-DdjS21Bx.d.cts +136 -0
- package/dist/types-DdjS21Bx.d.cts.map +1 -0
- package/dist/types-DdjS21Bx.d.mts +136 -0
- package/dist/types-DdjS21Bx.d.mts.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ComponentRole, ManifestComponent, ManifestFont, ManifestToken, TokenCategory } from "@razorwind/eslint";
|
|
2
|
+
import { GuardrailRuleId as TailwindGuardrailRuleId, GuardrailTheme as TailwindGuardrailTheme } from "@razorwind/tailwindcss/stylelint-runtime";
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Razorwind Stylelint design-system plugin generator.
|
|
6
|
+
*/
|
|
7
|
+
interface StylelintPluginOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Output path of the generated Stylelint plugin module, written relative
|
|
10
|
+
* to the execution cwd.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue "stylelint/design-system/index.mjs"
|
|
13
|
+
*/
|
|
14
|
+
stylelintPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Rule namespace used in `stylelint.config.*`
|
|
17
|
+
* (`<prefix>/ensure-design-token-usage`).
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue "design-system"
|
|
20
|
+
*/
|
|
21
|
+
prefix?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Module the generated file imports `createDesignSystemPlugin` from.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue "\@razorwind/stylelint/runtime"
|
|
26
|
+
*/
|
|
27
|
+
runtimeImport?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Prefix of the CSS custom properties generated for the design tokens
|
|
30
|
+
* (`--<prefix>-color-primary`). Set to `false` when tokens are emitted
|
|
31
|
+
* without a prefix.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue initials derived from the schema name, matching `\@razorwind/css`
|
|
34
|
+
*/
|
|
35
|
+
cssVarPrefix?: string | false;
|
|
36
|
+
/**
|
|
37
|
+
* Include the `\@razorwind/tailwindcss` guardrails, exposed as
|
|
38
|
+
* `<prefix>/tailwind-*` rules that read `\@apply` preludes and theme
|
|
39
|
+
* variable references.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue true
|
|
42
|
+
*/
|
|
43
|
+
tailwind?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Override body for generated `INSTALL.md`. When omitted, Stylelint config
|
|
46
|
+
* wiring steps are generated for the output file.
|
|
47
|
+
*/
|
|
48
|
+
installGuide?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Schema-derived design-system manifest serialized into the generated
|
|
52
|
+
* Stylelint module.
|
|
53
|
+
*/
|
|
54
|
+
interface DesignSystemManifest {
|
|
55
|
+
/** Plugin name. */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Plugin version. */
|
|
58
|
+
version: string;
|
|
59
|
+
/** Rule namespace used in `stylelint.config.*`. */
|
|
60
|
+
prefix: string;
|
|
61
|
+
/** CSS custom-property prefix, when tokens are emitted with one. */
|
|
62
|
+
cssVarPrefix?: string;
|
|
63
|
+
/** Theme ids present in the schema (`light`, `dark`). */
|
|
64
|
+
themes: string[];
|
|
65
|
+
tokens: ManifestToken[];
|
|
66
|
+
/** Schema components, named in messages that point at a replacement. */
|
|
67
|
+
components: ManifestComponent[];
|
|
68
|
+
fonts: ManifestFont[];
|
|
69
|
+
/** `\@razorwind/tailwindcss` guardrail theme, when enabled. */
|
|
70
|
+
tailwind?: TailwindGuardrailTheme;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Rule ids ported from `\@atlaskit/stylelint-design-system`, plus the
|
|
74
|
+
* `\@razorwind/eslint` rules that apply to stylesheets.
|
|
75
|
+
*/
|
|
76
|
+
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-physical-properties" | "no-margin" | "use-visually-hidden";
|
|
77
|
+
type TailwindRuleId = `tailwind-${TailwindGuardrailRuleId}`;
|
|
78
|
+
/** Every rule id the generated plugin can expose. */
|
|
79
|
+
type DesignSystemRuleId = CoreRuleId | TailwindRuleId;
|
|
80
|
+
type DesignSystemSeverity = "error" | "warn" | "off";
|
|
81
|
+
/**
|
|
82
|
+
* Value domains `ensure-design-token-usage` checks: the primary option of
|
|
83
|
+
* `\@atlaskit/stylelint-design-system`'s rule.
|
|
84
|
+
*/
|
|
85
|
+
interface TokenUsageDomains {
|
|
86
|
+
/**
|
|
87
|
+
* Hard-coded colors and shadows.
|
|
88
|
+
*
|
|
89
|
+
* @defaultValue true
|
|
90
|
+
*/
|
|
91
|
+
color?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Hard-coded lengths in spacing properties (`padding`, `gap`, …).
|
|
94
|
+
*
|
|
95
|
+
* @defaultValue false
|
|
96
|
+
*/
|
|
97
|
+
spacing?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Hard-coded font sizes, weights, families, line heights and letter
|
|
100
|
+
* spacing.
|
|
101
|
+
*
|
|
102
|
+
* @defaultValue false
|
|
103
|
+
*/
|
|
104
|
+
typography?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Custom properties outside the design system (`var(--sidebar-width)`).
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue false
|
|
109
|
+
*/
|
|
110
|
+
nonTokenCssVariables?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* How `no-unsafe-design-token-usage` treats `var(--token, fallback)`
|
|
114
|
+
* fallbacks: required (`forced`), allowed (`optional`) or disallowed (`none`).
|
|
115
|
+
*/
|
|
116
|
+
type FallbackUsage = "forced" | "optional" | "none";
|
|
117
|
+
/** Options for the generated Stylelint config factory. */
|
|
118
|
+
interface DesignSystemOptions {
|
|
119
|
+
/** Glob(s) the rules apply to; the rules move into an `overrides` entry. */
|
|
120
|
+
files?: string[];
|
|
121
|
+
/** Glob(s) exempt from every rule. */
|
|
122
|
+
ignoreFiles?: string[];
|
|
123
|
+
/** Per-rule overrides of the schema-derived default severities. */
|
|
124
|
+
severity?: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
|
|
125
|
+
/** Domains `ensure-design-token-usage` checks. */
|
|
126
|
+
tokenUsage?: TokenUsageDomains;
|
|
127
|
+
/**
|
|
128
|
+
* Fallback strategy of `no-unsafe-design-token-usage`.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue "optional"
|
|
131
|
+
*/
|
|
132
|
+
fallbackUsage?: FallbackUsage;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { DesignSystemRuleId as a, ManifestComponent as c, StylelintPluginOptions as d, TokenCategory as f, DesignSystemOptions as i, ManifestFont as l, CoreRuleId as n, DesignSystemSeverity as o, TokenUsageDomains as p, DesignSystemManifest as r, FallbackUsage as s, ComponentRole as t, ManifestToken as u };
|
|
136
|
+
//# sourceMappingURL=types-DdjS21Bx.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DdjS21Bx.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;UA2CiB;;;;;;;EAOf;;;;;;;EAQA;;;;;;EAOA;;;;;;;;EASA;;;;;;;;EASA;;;;;EAMA;;;;;;UAOe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;EACA,QAAQ;;EAER,YAAY;EACZ,OAAO;;EAEP,WAAW;;;;;;KAOD;KAaA,6BAA6B;;KAG7B,qBAAqB,aAAa;KAElC;;;;;UAMK;;;;;;EAMf;;;;;;EAMA;;;;;;;EAOA;;;;;;EAMA;;;;;;KAOU;;UAGK;;EAEf;;EAEA;;EAEA,WAAW,QAAQ,OAAO,oBAAoB;;EAE9C,aAAa;;;;;;EAMb,gBAAgB"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ComponentRole, ManifestComponent, ManifestFont, ManifestToken, TokenCategory } from "@razorwind/eslint";
|
|
2
|
+
import { GuardrailRuleId as TailwindGuardrailRuleId, GuardrailTheme as TailwindGuardrailTheme } from "@razorwind/tailwindcss/stylelint-runtime";
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Razorwind Stylelint design-system plugin generator.
|
|
6
|
+
*/
|
|
7
|
+
interface StylelintPluginOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Output path of the generated Stylelint plugin module, written relative
|
|
10
|
+
* to the execution cwd.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue "stylelint/design-system/index.mjs"
|
|
13
|
+
*/
|
|
14
|
+
stylelintPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Rule namespace used in `stylelint.config.*`
|
|
17
|
+
* (`<prefix>/ensure-design-token-usage`).
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue "design-system"
|
|
20
|
+
*/
|
|
21
|
+
prefix?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Module the generated file imports `createDesignSystemPlugin` from.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue "\@razorwind/stylelint/runtime"
|
|
26
|
+
*/
|
|
27
|
+
runtimeImport?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Prefix of the CSS custom properties generated for the design tokens
|
|
30
|
+
* (`--<prefix>-color-primary`). Set to `false` when tokens are emitted
|
|
31
|
+
* without a prefix.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue initials derived from the schema name, matching `\@razorwind/css`
|
|
34
|
+
*/
|
|
35
|
+
cssVarPrefix?: string | false;
|
|
36
|
+
/**
|
|
37
|
+
* Include the `\@razorwind/tailwindcss` guardrails, exposed as
|
|
38
|
+
* `<prefix>/tailwind-*` rules that read `\@apply` preludes and theme
|
|
39
|
+
* variable references.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue true
|
|
42
|
+
*/
|
|
43
|
+
tailwind?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Override body for generated `INSTALL.md`. When omitted, Stylelint config
|
|
46
|
+
* wiring steps are generated for the output file.
|
|
47
|
+
*/
|
|
48
|
+
installGuide?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Schema-derived design-system manifest serialized into the generated
|
|
52
|
+
* Stylelint module.
|
|
53
|
+
*/
|
|
54
|
+
interface DesignSystemManifest {
|
|
55
|
+
/** Plugin name. */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Plugin version. */
|
|
58
|
+
version: string;
|
|
59
|
+
/** Rule namespace used in `stylelint.config.*`. */
|
|
60
|
+
prefix: string;
|
|
61
|
+
/** CSS custom-property prefix, when tokens are emitted with one. */
|
|
62
|
+
cssVarPrefix?: string;
|
|
63
|
+
/** Theme ids present in the schema (`light`, `dark`). */
|
|
64
|
+
themes: string[];
|
|
65
|
+
tokens: ManifestToken[];
|
|
66
|
+
/** Schema components, named in messages that point at a replacement. */
|
|
67
|
+
components: ManifestComponent[];
|
|
68
|
+
fonts: ManifestFont[];
|
|
69
|
+
/** `\@razorwind/tailwindcss` guardrail theme, when enabled. */
|
|
70
|
+
tailwind?: TailwindGuardrailTheme;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Rule ids ported from `\@atlaskit/stylelint-design-system`, plus the
|
|
74
|
+
* `\@razorwind/eslint` rules that apply to stylesheets.
|
|
75
|
+
*/
|
|
76
|
+
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-physical-properties" | "no-margin" | "use-visually-hidden";
|
|
77
|
+
type TailwindRuleId = `tailwind-${TailwindGuardrailRuleId}`;
|
|
78
|
+
/** Every rule id the generated plugin can expose. */
|
|
79
|
+
type DesignSystemRuleId = CoreRuleId | TailwindRuleId;
|
|
80
|
+
type DesignSystemSeverity = "error" | "warn" | "off";
|
|
81
|
+
/**
|
|
82
|
+
* Value domains `ensure-design-token-usage` checks: the primary option of
|
|
83
|
+
* `\@atlaskit/stylelint-design-system`'s rule.
|
|
84
|
+
*/
|
|
85
|
+
interface TokenUsageDomains {
|
|
86
|
+
/**
|
|
87
|
+
* Hard-coded colors and shadows.
|
|
88
|
+
*
|
|
89
|
+
* @defaultValue true
|
|
90
|
+
*/
|
|
91
|
+
color?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Hard-coded lengths in spacing properties (`padding`, `gap`, …).
|
|
94
|
+
*
|
|
95
|
+
* @defaultValue false
|
|
96
|
+
*/
|
|
97
|
+
spacing?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Hard-coded font sizes, weights, families, line heights and letter
|
|
100
|
+
* spacing.
|
|
101
|
+
*
|
|
102
|
+
* @defaultValue false
|
|
103
|
+
*/
|
|
104
|
+
typography?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Custom properties outside the design system (`var(--sidebar-width)`).
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue false
|
|
109
|
+
*/
|
|
110
|
+
nonTokenCssVariables?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* How `no-unsafe-design-token-usage` treats `var(--token, fallback)`
|
|
114
|
+
* fallbacks: required (`forced`), allowed (`optional`) or disallowed (`none`).
|
|
115
|
+
*/
|
|
116
|
+
type FallbackUsage = "forced" | "optional" | "none";
|
|
117
|
+
/** Options for the generated Stylelint config factory. */
|
|
118
|
+
interface DesignSystemOptions {
|
|
119
|
+
/** Glob(s) the rules apply to; the rules move into an `overrides` entry. */
|
|
120
|
+
files?: string[];
|
|
121
|
+
/** Glob(s) exempt from every rule. */
|
|
122
|
+
ignoreFiles?: string[];
|
|
123
|
+
/** Per-rule overrides of the schema-derived default severities. */
|
|
124
|
+
severity?: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
|
|
125
|
+
/** Domains `ensure-design-token-usage` checks. */
|
|
126
|
+
tokenUsage?: TokenUsageDomains;
|
|
127
|
+
/**
|
|
128
|
+
* Fallback strategy of `no-unsafe-design-token-usage`.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue "optional"
|
|
131
|
+
*/
|
|
132
|
+
fallbackUsage?: FallbackUsage;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { DesignSystemRuleId as a, ManifestComponent as c, StylelintPluginOptions as d, TokenCategory as f, DesignSystemOptions as i, ManifestFont as l, CoreRuleId as n, DesignSystemSeverity as o, TokenUsageDomains as p, DesignSystemManifest as r, FallbackUsage as s, ComponentRole as t, ManifestToken as u };
|
|
136
|
+
//# sourceMappingURL=types-DdjS21Bx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DdjS21Bx.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@razorwind/stylelint",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Razorwind Stylelint plugin generator to create stylelint rules that can be used as design system guidelines.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "github",
|
|
8
|
+
"url": "https://github.com/storm-software/razorwind.git",
|
|
9
|
+
"directory": "packages/stylelint"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://stormsoftware.com",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://stormsoftware.com/support",
|
|
14
|
+
"email": "support@stormsoftware.com"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Storm Software",
|
|
18
|
+
"email": "contact@stormsoftware.com",
|
|
19
|
+
"url": "https://stormsoftware.com"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"private": false,
|
|
23
|
+
"files": ["dist"],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"stylelint",
|
|
26
|
+
"stylelint-plugin",
|
|
27
|
+
"razorwind",
|
|
28
|
+
"design-tokens",
|
|
29
|
+
"dtcg",
|
|
30
|
+
"storm-software"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/index.d.cts",
|
|
36
|
+
"default": "./dist/index.cjs"
|
|
37
|
+
},
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
40
|
+
"default": "./dist/index.mjs"
|
|
41
|
+
},
|
|
42
|
+
"default": {
|
|
43
|
+
"types": "./dist/index.d.mts",
|
|
44
|
+
"default": "./dist/index.mjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"./generate": {
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./dist/index.d.cts",
|
|
50
|
+
"default": "./dist/index.cjs"
|
|
51
|
+
},
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/index.d.mts",
|
|
54
|
+
"default": "./dist/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"default": {
|
|
57
|
+
"types": "./dist/index.d.mts",
|
|
58
|
+
"default": "./dist/index.mjs"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"./runtime": {
|
|
62
|
+
"require": {
|
|
63
|
+
"types": "./dist/runtime.d.cts",
|
|
64
|
+
"default": "./dist/runtime.cjs"
|
|
65
|
+
},
|
|
66
|
+
"import": {
|
|
67
|
+
"types": "./dist/runtime.d.mts",
|
|
68
|
+
"default": "./dist/runtime.mjs"
|
|
69
|
+
},
|
|
70
|
+
"default": {
|
|
71
|
+
"types": "./dist/runtime.d.mts",
|
|
72
|
+
"default": "./dist/runtime.mjs"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"./package.json": "./package.json"
|
|
76
|
+
},
|
|
77
|
+
"main": "./dist/index.cjs",
|
|
78
|
+
"module": "./dist/index.mjs",
|
|
79
|
+
"types": "./dist/index.d.cts",
|
|
80
|
+
"typings": "dist/index.d.mts",
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"@power-plant/core": "^0.0.93",
|
|
83
|
+
"@power-plant/dtcg-schema": "^0.0.1",
|
|
84
|
+
"@razorwind/core": "^0.0.80",
|
|
85
|
+
"@razorwind/eslint": "^0.0.2",
|
|
86
|
+
"@razorwind/tailwindcss": "^0.0.78"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": { "stylelint": "^16.8.2 || ^17.0.0" },
|
|
89
|
+
"peerDependenciesMeta": { "stylelint": { "optional": true } },
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@powerlines/plugin-tsdown": "^0.1.614",
|
|
92
|
+
"@types/node": "^25.9.9",
|
|
93
|
+
"typescript": "^6.0.3"
|
|
94
|
+
},
|
|
95
|
+
"publishConfig": { "access": "public" },
|
|
96
|
+
"gitHead": "2dc4d1c0f0fa0810aad001551f06c614f4991fec"
|
|
97
|
+
}
|