All files / packages/sds-stylelint-config/src/deprecated private-hooks.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                2x     34x 34x       4x       5x    
/**
 * Scheduled for removal. When removing:
 *   1. Delete this file
 *   2. Remove the import and call in the component-pattern plugin
 *   3. Remove the privateSyntax option from the config
 *   4. Update shouldValidate() to reject private props entirely
 */
 
const PRIVATE_PREFIX = '_';
 
export function isPrivateHook(prop: string): boolean {
  const body = prop.replace(/^--/, '');
  return body.startsWith(PRIVATE_PREFIX);
}
 
export function stripPrivatePrefix(prop: string): string {
  return prop.replace(/^--_/, '--');
}
 
export function isPrivateComponentHook(tokens: string[]): boolean {
  return tokens.length >= 3 && tokens[1] === 'c';
}