1
- 'use strict '
1
+ import chalk from 'chalk '
2
2
3
- const chalk = require ( 'chalk' )
4
- const CHECK = chalk . green ( '✔' )
5
- const X = chalk . red ( '✖' )
6
- const WARN = chalk . yellow ( '⚠' )
3
+ export const CHECK = chalk . green ( '✔' )
4
+ export const X = chalk . red ( '✖' )
5
+ export const WARN = chalk . yellow ( '⚠' )
7
6
8
- exports . CHECK = CHECK
9
- exports . X = X
10
- exports . WARN = WARN
11
-
12
- exports . rightPad = function rightPad ( str , max ) {
7
+ export function rightPad ( str , max ) {
13
8
const diff = max - str . length + 1
14
9
if ( diff > 0 ) {
15
10
return `${ str } ${ ' ' . repeat ( diff ) } `
16
11
}
17
12
return str
18
13
}
19
14
20
- exports . leftPad = function leftPad ( str , max ) {
15
+ export function leftPad ( str , max ) {
21
16
const diff = max - str . length + 1
22
17
if ( diff > 0 ) {
23
18
return `${ ' ' . repeat ( diff ) } ${ str } `
24
19
}
25
20
return str
26
21
}
27
22
28
- exports . header = ( sha , status ) => {
23
+ export function header ( sha , status ) {
29
24
switch ( status ) {
30
25
case 'skip' :
31
26
case 'pass' : {
@@ -37,21 +32,21 @@ exports.header = (sha, status) => {
37
32
}
38
33
}
39
34
40
- exports . describeRule = function describeRule ( rule , max = 20 ) {
35
+ export function describeRule ( rule , max = 20 ) {
41
36
if ( rule . meta && rule . meta . description ) {
42
37
const desc = rule . meta . description
43
- const title = exports . leftPad ( rule . id , max )
38
+ const title = leftPad ( rule . id , max )
44
39
console . log ( ' %s %s' , chalk . red ( title ) , chalk . dim ( desc ) )
45
40
}
46
41
}
47
42
48
- exports . describeSubsystem = function describeSubsystem ( subsystems , max = 20 ) {
43
+ export function describeSubsystem ( subsystems , max = 20 ) {
49
44
if ( subsystems ) {
50
45
for ( let sub = 0 ; sub < subsystems . length ; sub = sub + 3 ) {
51
46
console . log ( '%s %s %s' ,
52
- chalk . green ( exports . leftPad ( subsystems [ sub ] || '' , max ) ) ,
53
- chalk . green ( exports . leftPad ( subsystems [ sub + 1 ] || '' , max ) ) ,
54
- chalk . green ( exports . leftPad ( subsystems [ sub + 2 ] || '' , max ) )
47
+ chalk . green ( leftPad ( subsystems [ sub ] || '' , max ) ) ,
48
+ chalk . green ( leftPad ( subsystems [ sub + 1 ] || '' , max ) ) ,
49
+ chalk . green ( leftPad ( subsystems [ sub + 2 ] || '' , max ) )
55
50
)
56
51
}
57
52
}
0 commit comments