Skip to content

Commit ce38de1

Browse files
committed
fix(lint): use colors in a way that pleases the linter
1 parent 3768bee commit ce38de1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/bin/index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'fs';
33
import path from 'path';
44
import * as url from 'url';
55

6-
import colors from 'ansi-colors';
6+
import * as colors from 'ansi-colors';
77
import { glob } from 'fast-glob';
88
// eslint-disable-next-line import/order -- what the actual heck, this rule bounces
99
import parser from 'yargs-parser';
@@ -12,12 +12,11 @@ import type { OpenAPITSOptions } from 'openapi-typescript';
1212

1313
import { generate } from '../index.js';
1414

15-
const { bold, red, green, dim } = colors;
1615
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
1716

1817
/** print error message */
1918
export function error(msg: string) {
20-
console.error(red(` ✘ ${msg}`)); // eslint-disable-line no-console
19+
console.error(colors.red(` ✘ ${msg}`)); // eslint-disable-line no-console
2120
}
2221

2322
const HELP = `Usage
@@ -140,7 +139,9 @@ async function generateSchema(pathToSpec: string | typeof process.stdin) {
140139
const timeEnd = process.hrtime(timeStart);
141140
const time = timeEnd[0] + Math.round(timeEnd[1] / 1e6);
142141
console.log(
143-
`🚀 ${green(`${pathToSpec}${bold(outputFilePath.toString())}`)} ${dim(`[${time}ms]`)}`,
142+
`🚀 ${colors.green(`${pathToSpec}${colors.bold(outputFilePath.toString())}`)} ${colors.dim(
143+
`[${time}ms]`,
144+
)}`,
144145
);
145146
} else {
146147
process.stdout.write(result);
@@ -168,7 +169,7 @@ async function main() {
168169
const outputDir = new URL('.', outputFile);
169170

170171
if (output === OUTPUT_FILE)
171-
console.info(`✨ ${bold(`openapi-typescript ${packageJSON.version}`)}`); // only log if we’re NOT writing to stdout
172+
console.info(`✨ ${colors.bold(`openapi-typescript ${packageJSON.version}`)}`); // only log if we’re NOT writing to stdout
172173

173174
const pathToSpec = flags._[0] as string;
174175

0 commit comments

Comments
 (0)