Skip to content

Commit

Permalink
docs: removed chalk from src + linting (ipfs#1273)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed May 16, 2023
1 parent 7e93e14 commit 06e64de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@
"chai-parentheses": "^0.0.2",
"chai-string": "^1.5.0",
"chai-subset": "^1.6.0",
"chalk": "^5.2.0",
"conventional-changelog-conventionalcommits": "^5.0.0",
"cors": "^2.8.5",
"depcheck": "^1.4.3",
Expand Down
2 changes: 1 addition & 1 deletion src/config/tsconfig.aegir.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"stripInternal": true,
"resolveJsonModule": true,
"resolveJsonModule": true
},
"include": [
"src",
Expand Down
8 changes: 4 additions & 4 deletions src/document-check.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-console */

import chalk from 'chalk'
import fs from 'fs-extra'
import { globby } from 'globby'
import kleur from 'kleur'
import Listr from 'listr'
import merge from 'merge-options'
import { compileSnippets } from 'typescript-docs-verifier'
Expand All @@ -20,7 +20,7 @@ const tasks = new Listr(
/**
* @param {GlobalOptions & DocsVerifierOptions} ctx
*/
enabled: ctx => hasTsconfig && !isTypescript,
enabled: ctx => hasTsconfig,
/**
* @param {GlobalOptions & DocsVerifierOptions} ctx
* @param {Task} task
Expand Down Expand Up @@ -60,9 +60,9 @@ const tasks = new Listr(
results.forEach((result) => {
if (result.error) {
process.exitCode = 1
console.log(chalk.red.bold(`Error compiling example code block ${result.index} in file ${result.file}:`))
console.log(kleur.red().bold(`Error compiling example code block ${result.index} in file ${result.file}:`))
console.log(formatError(result.error))
console.log(chalk.blue.bold('Original code:'))
console.log(kleur.blue().bold('Original code:'))
console.log(formatCode(result.snippet, result.linesWithErrors))
}
})
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import readline from 'readline'
import { fileURLToPath } from 'url'
import { constants, createBrotliCompress, createGzip } from 'zlib'
import { download } from '@electron/get'
import chalk from 'chalk'
import envPaths from 'env-paths'
import { execa } from 'execa'
import extract from 'extract-zip'
import fs from 'fs-extra'
import kleur from 'kleur'
import Listr from 'listr'
import { minimatch } from 'minimatch'
import lockfile from 'proper-lockfile'
Expand Down Expand Up @@ -532,7 +532,7 @@ export const formatCode = (code, errorLines) => {
const lines = code.split('\n').map((line, index) => {
const lineNumber = index + 1
if (errorLines.includes(lineNumber)) {
return chalk.bold.red(`${String(lineNumber).padStart(2)}| ${line}`)
return kleur.red().bold(`${String(lineNumber).padStart(2)}| ${line}`)
} else {
return `${String(lineNumber).padStart(2)}| ${line}`
}
Expand Down

0 comments on commit 06e64de

Please sign in to comment.