diff --git a/lint-staged.config.cjs b/lint-staged.config.cjs index 698942d..86cf450 100644 --- a/lint-staged.config.cjs +++ b/lint-staged.config.cjs @@ -1,4 +1,4 @@ module.exports = { - '*.{js,cjs,mjs,jsx,ts,tsx}': ['prettier --write', 'eslint --fix'], + '*.{js,cjs,mjs,jsx,ts,tsx}': ['prettier --write', 'eslint --fix', () => 'npm run types:check'], '*.{md,html,css}': ['prettier --write'], }; diff --git a/package.json b/package.json index bbeddab..8de2f42 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "format:fix": "prettier --write .", "prepare": "npx husky install", "types": "tsc --build --pretty", - "types:check": "tsc --pretty -p tsconfig.checkOnly.json", + "types:check": "tsc --pretty", "prepublishOnly": "npm run types", "release": "npx semantic-release", "reset": "rm -rf .apimockrc && rm -rf .api-mock-runner", diff --git a/src/helpers/colours.js b/src/helpers/colours.js index 5e702c0..196571d 100644 --- a/src/helpers/colours.js +++ b/src/helpers/colours.js @@ -4,11 +4,11 @@ * @param {string} color - The desired color to paint the text. * @returns {string} - The painted text. */ -function paintText(text, color) { - return color + text + colours.reset; +export function paintText(text, color) { + return `${color}${text}${colours.reset}`; } -const colours = { +export const colours = Object.freeze({ reset: '\x1b[0m', bright: '\x1b[1m', dim: '\x1b[2m', @@ -40,5 +40,4 @@ const colours = { gray: '\x1b[100m', crimson: '\x1b[48m', }, -}; -export { colours, paintText }; +}); diff --git a/src/services/utils.js b/src/services/utils.js index 322ddce..896d3d7 100644 --- a/src/services/utils.js +++ b/src/services/utils.js @@ -79,10 +79,10 @@ export class MockRunnerError extends Error { type = colours.fg.cyan; } Logger.error( - `Error of level ${paintText(this.level, type)}, type ${paintText(this.code, colours.fg.gray)} over ${paintText( - this.emitter, - colours.fg.blue - )}` + `Error of level ${paintText(this.level.toString(), type)}, type ${paintText( + this.code.toString(), + colours.fg.gray + )} over ${paintText(this.emitter, colours.fg.blue)}` ); Logger.info(`${this.stack}`); } diff --git a/tsconfig.json b/tsconfig.json index e983a06..739bf74 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@os3/tsconfig", "compilerOptions": { "outDir": "./dist-types", - "rootDir": "." + "rootDir": "./src" }, "include": ["src"], "exclude": ["dist-types", "node_modules", "test"]