mirror of
https://github.com/garraflavatra/trmclr.git
synced 2025-01-18 11:07:57 +00:00
Add yeslint!
This commit is contained in:
parent
035fe080f1
commit
5f958cf813
5
index.d.ts
vendored
5
index.d.ts
vendored
@ -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;
|
||||
|
12
index.js
12
index.js
@ -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
5045
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user