Skip to content

Commit c99b7b6

Browse files
committed
feature: @putout/formatter-stream: chalk -> styleText
1 parent b358172 commit c99b7b6

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

packages/formatter-stream/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import {defineConfig} from 'eslint/config';
33

44
export default defineConfig([
55
safeAlign, {
6+
rules: {
7+
'n/no-unsupported-features/node-builtins': 'off',
8+
},
69
ignores: ['**/fixture'],
710
},
811
]);

packages/formatter-stream/lib/stream.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1+
import {styleText} from 'node:util';
12
import {
23
table,
34
getBorderCharacters,
45
} from 'table';
5-
import chalk from 'chalk';
66

7-
const {
8-
underline,
9-
red,
10-
grey,
11-
bold,
12-
redBright,
13-
} = chalk;
7+
const underline = (a) => styleText('underline', a);
8+
const red = (a) => styleText('red', a);
9+
const gray = (a) => styleText('gray', a);
10+
const bold = (a) => styleText('bold', a);
11+
const redBright = (a) => styleText('redBright', a);
1412

1513
export default ({name, places, index, count, filesCount, errorsCount}) => {
1614
const data = [];
@@ -20,9 +18,9 @@ export default ({name, places, index, count, filesCount, errorsCount}) => {
2018
const {line, column} = position;
2119

2220
data.push([
23-
grey(`${line}:${column}`),
21+
gray(`${line}:${column}`),
2422
`${red('error')} ${message}`,
25-
grey(rule),
23+
gray(rule),
2624
]);
2725
}
2826

packages/formatter-stream/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"report": "madrun report"
2525
},
2626
"dependencies": {
27-
"chalk": "^5.3.0",
2827
"table": "^6.0.1"
2928
},
3029
"keywords": [
@@ -44,11 +43,11 @@
4443
"superc8": "^12.0.0"
4544
},
4645
"peerDependencies": {
47-
"putout": ">=40"
46+
"putout": ">=42"
4847
},
4948
"license": "MIT",
5049
"engines": {
51-
"node": ">=20"
50+
"node": ">=22"
5251
},
5352
"publishConfig": {
5453
"access": "public"

0 commit comments

Comments
 (0)