1
0
mirror of https://github.com/garraflavatra/trmclr.git synced 2025-01-18 11:07:57 +00:00

Add yeslint!

This commit is contained in:
Romein van Buren 2024-08-09 14:28:46 +02:00
parent 035fe080f1
commit 5f958cf813
No known key found for this signature in database
4 changed files with 5097 additions and 69 deletions

5
index.d.ts vendored
View File

@ -305,7 +305,10 @@ export function stripColor(str: string): string;
* @property {number} g
* @property {number} b
*/
/** True if [`NO_COLOR`](https://no-color.org/) is set. */
/**
* True if `NO_COLOR` is set.
* @see https://no-color.org/
*/
export const noColor: boolean;
export type Color = {
open: string;

View File

@ -1,3 +1,5 @@
/* global process, Deno */
/**
* @typedef Color
* @property {string} open
@ -12,7 +14,11 @@
* @property {number} b
*/
/** True if [`NO_COLOR`](https://no-color.org/) is set. */
/**
* True if `NO_COLOR` is set.
* @see https://no-color.org/
*/
// @ts-expect-error Depends on environment.
export const noColor = !!process?.env?.NO_COLOR || !!Deno?.noColor;
let enabled = !noColor;
@ -50,9 +56,7 @@ function code(open, close) {
* @returns {string}
*/
function run(str, code) {
return enabled
? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
: str;
return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str;
}
/**

5045
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,10 +24,20 @@
},
"homepage": "https://github.com/garraflavatra/trmclr#readme",
"scripts": {
"build": "tsc"
"build": "tsc",
"lint": "eslint index.js"
},
"devDependencies": {
"@types/node": "^18.8.3",
"typescript": "^4.8.4"
"@garraflavatra/yeslint": "^1.2.0",
"@types/node": "^22.1.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"eslint": "^8.57.0",
"typescript": "^5.5.4"
},
"eslintConfig": {
"extends": "./node_modules/@garraflavatra/yeslint/configs/generic.js",
"parserOptions": {
"sourceType": "module"
}
}
}