@@ -275,6 +275,115 @@ import './my-component.scss';
275275}
276276 ]]> </example >
277277 </responsive_styling >
278+
279+ <token_enforcement priority =" critical" >
280+ <title >Carbon Token Usage for All Styling</title >
281+ <description >
282+ Carbon tokens, mixins, and functions should be used for ALL styling properties,
283+ not just specific cases. This ensures theme compatibility, consistency, and
284+ maintainability across the entire application.
285+ </description >
286+ <enforcement >
287+ <tool >stylelint-plugin-carbon-tokens</tool >
288+ <description >
289+ This stylelint plugin enforces the use of Carbon tokens throughout your
290+ stylesheets, catching hardcoded values and suggesting appropriate tokens.
291+ </description >
292+ </enforcement >
293+ <comprehensive_token_usage >
294+ <category name =" Colors" >
295+ <rule >Use theme tokens ($text-primary, $layer, $border-subtle, etc.) for all colors</rule >
296+ <example ><![CDATA[
297+ // CORRECT: Using theme tokens
298+ .component {
299+ color: $text-primary;
300+ background-color: $layer;
301+ border-color: $border-subtle;
302+ }
303+
304+ // INCORRECT: Hardcoded colors
305+ .component {
306+ color: #161616; // ❌ Use $text-primary
307+ background-color: #f4f4f4; // ❌ Use $layer
308+ border-color: #e0e0e0; // ❌ Use $border-subtle
309+ }
310+ ]]> </example >
311+ </category >
312+ <category name =" Spacing" >
313+ <rule >Use spacing tokens ($spacing-03, $spacing-05, etc.) for all spacing</rule >
314+ <example ><![CDATA[
315+ // CORRECT: Using spacing tokens
316+ .component {
317+ padding: $spacing-05;
318+ margin-bottom: $spacing-06;
319+ gap: $spacing-03;
320+ }
321+
322+ // INCORRECT: Hardcoded spacing
323+ .component {
324+ padding: 16px; // ❌ Use $spacing-05
325+ margin-bottom: 24px; // ❌ Use $spacing-06
326+ gap: 8px; // ❌ Use $spacing-03
327+ }
328+ ]]> </example >
329+ </category >
330+ <category name =" Typography" >
331+ <rule >Use type mixins (@include type-style()) for all typography</rule >
332+ <example ><![CDATA[
333+ // CORRECT: Using type mixins
334+ .heading {
335+ @include type-style('heading-03');
336+ }
337+
338+ .body-text {
339+ @include type-style('body-long-01');
340+ }
341+
342+ // INCORRECT: Manual font declarations
343+ .heading {
344+ font-size: 20px; // ❌ Use type-style mixin
345+ line-height: 26px; // ❌ Use type-style mixin
346+ font-weight: 600; // ❌ Use type-style mixin
347+ }
348+ ]]> </example >
349+ </category >
350+ <category name =" Gradients" >
351+ <rule >Use Carbon tokens in gradients for theme compatibility</rule >
352+ <example ><![CDATA[
353+ // CORRECT: Tokens in gradients
354+ .section {
355+ background: linear-gradient(to bottom, $layer, $layer-accent);
356+ }
357+
358+ // INCORRECT: Hardcoded gradient colors
359+ .section {
360+ background: linear-gradient(to bottom, #f4f4f4, #e0e0e0); // ❌ Use tokens
361+ }
362+ ]]> </example >
363+ </category >
364+ <category name =" Motion" >
365+ <rule >Use motion tokens and functions for animations and transitions</rule >
366+ <example ><![CDATA[
367+ // CORRECT: Using motion tokens
368+ .component {
369+ transition: opacity motion(standard, productive);
370+ }
371+
372+ // INCORRECT: Hardcoded timing
373+ .component {
374+ transition: opacity 0.3s ease-in-out; // ❌ Use motion tokens
375+ }
376+ ]]> </example >
377+ </category >
378+ </comprehensive_token_usage >
379+ <benefits >
380+ <benefit >Automatic theme adaptation across all themes (white, g10, g90, g100)</benefit >
381+ <benefit >Consistent spacing and typography throughout the application</benefit >
382+ <benefit >Easier maintenance when design system updates</benefit >
383+ <benefit >Enforced by tooling (stylelint-plugin-carbon-tokens)</benefit >
384+ <benefit >Better accessibility through tested token values</benefit >
385+ </benefits >
386+ </token_enforcement >
278387 </styling_guidelines >
279388
280389 <troubleshooting priority =" high" >
0 commit comments