mirror of
https://github.com/garraflavatra/trmclr.git
synced 2025-01-18 19:07:58 +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} g
|
||||||
* @property {number} b
|
* @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 const noColor: boolean;
|
||||||
export type Color = {
|
export type Color = {
|
||||||
open: string;
|
open: string;
|
||||||
|
12
index.js
12
index.js
@ -1,3 +1,5 @@
|
|||||||
|
/* global process, Deno */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Color
|
* @typedef Color
|
||||||
* @property {string} open
|
* @property {string} open
|
||||||
@ -12,7 +14,11 @@
|
|||||||
* @property {number} b
|
* @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;
|
export const noColor = !!process?.env?.NO_COLOR || !!Deno?.noColor;
|
||||||
|
|
||||||
let enabled = !noColor;
|
let enabled = !noColor;
|
||||||
@ -50,9 +56,7 @@ function code(open, close) {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function run(str, code) {
|
function run(str, code) {
|
||||||
return enabled
|
return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str;
|
||||||
? `${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",
|
"homepage": "https://github.com/garraflavatra/trmclr#readme",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc"
|
"build": "tsc",
|
||||||
|
"lint": "eslint index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.8.3",
|
"@garraflavatra/yeslint": "^1.2.0",
|
||||||
"typescript": "^4.8.4"
|
"@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