ShtukbaseStandard
包文件→ .shtukbase/packages/design-tokens/checks/valid.ts

checks/valid.ts

14 行, 691 B.

文件按包中的原样显示:代码及其注释不做翻译。

  1. // DTK-R01. The tokens file is valid DTCG: a JSON tree of groups and tokens; every token has $value and a known
  2. // $type (its own, its group's or the referenced token's); the value fits the type; every reference {a.b} leads to
  3. // a token of the right type; no reference cycles; names have no { } or dots. The dark file, if set, overrides only
  4. // existing tokens.
  5. import { report } from '../../design-base/lib/files.ts';
  6. import { validate } from '../actions/tokenslib.ts';
  7. export const RULE = { id: 'dtk-r01', title: 'Tokens are valid by the DTCG format' };
  8. export function check(root = process.cwd()): string[] {
  9. return validate(root).problems;
  10. }
  11. if (import.meta.main) report(check());