Drop built-in Flow type definition
I don't want to be responsible for maintaining it. Submit it to https://github.com/flow-typed/flow-typed if you need it.
This commit is contained in:
parent
98628d9f08
commit
d3be9c65b1
5 changed files with 3 additions and 195 deletions
|
|
@ -1,6 +0,0 @@
|
|||
[ignore]
|
||||
.*/node_modules/.*
|
||||
|
||||
[options]
|
||||
suppress_comment= \\(.\\|\n\\)*\\$ExpectError
|
||||
include_warnings=true
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
// @flow strict
|
||||
|
||||
type TemplateStringsArray = $ReadOnlyArray<string>;
|
||||
|
||||
export type Level = $Values<{
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3
|
||||
}>;
|
||||
|
||||
export type Options = {|
|
||||
enabled?: boolean,
|
||||
level?: Level
|
||||
|};
|
||||
|
||||
export type ColorSupport = {|
|
||||
level: Level,
|
||||
hasBasic: boolean,
|
||||
has256: boolean,
|
||||
has16m: boolean
|
||||
|};
|
||||
|
||||
export interface Chalk {
|
||||
(...text: string[]): string,
|
||||
(text: TemplateStringsArray, ...placeholders: mixed[]): string,
|
||||
Instance(options?: Options): Chalk,
|
||||
enabled: boolean,
|
||||
level: Level,
|
||||
rgb(red: number, green: number, blue: number): Chalk,
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk,
|
||||
hsv(hue: number, saturation: number, value: number): Chalk,
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk,
|
||||
bgHex(color: string): Chalk,
|
||||
bgKeyword(color: string): Chalk,
|
||||
bgRgb(red: number, green: number, blue: number): Chalk,
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk,
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk,
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk,
|
||||
hex(color: string): Chalk,
|
||||
keyword(color: string): Chalk,
|
||||
|
||||
+reset: Chalk,
|
||||
+bold: Chalk,
|
||||
+dim: Chalk,
|
||||
+italic: Chalk,
|
||||
+underline: Chalk,
|
||||
+inverse: Chalk,
|
||||
+hidden: Chalk,
|
||||
+strikethrough: Chalk,
|
||||
|
||||
+visible: Chalk,
|
||||
|
||||
+black: Chalk,
|
||||
+red: Chalk,
|
||||
+green: Chalk,
|
||||
+yellow: Chalk,
|
||||
+blue: Chalk,
|
||||
+magenta: Chalk,
|
||||
+cyan: Chalk,
|
||||
+white: Chalk,
|
||||
+gray: Chalk,
|
||||
+grey: Chalk,
|
||||
+blackBright: Chalk,
|
||||
+redBright: Chalk,
|
||||
+greenBright: Chalk,
|
||||
+yellowBright: Chalk,
|
||||
+blueBright: Chalk,
|
||||
+magentaBright: Chalk,
|
||||
+cyanBright: Chalk,
|
||||
+whiteBright: Chalk,
|
||||
|
||||
+bgBlack: Chalk,
|
||||
+bgRed: Chalk,
|
||||
+bgGreen: Chalk,
|
||||
+bgYellow: Chalk,
|
||||
+bgBlue: Chalk,
|
||||
+bgMagenta: Chalk,
|
||||
+bgCyan: Chalk,
|
||||
+bgWhite: Chalk,
|
||||
+bgBlackBright: Chalk,
|
||||
+bgRedBright: Chalk,
|
||||
+bgGreenBright: Chalk,
|
||||
+bgYellowBright: Chalk,
|
||||
+bgBlueBright: Chalk,
|
||||
+bgMagentaBright: Chalk,
|
||||
+bgCyanBright: Chalk,
|
||||
+bgWhiteBright: Chalk,
|
||||
|
||||
supportsColor: ColorSupport
|
||||
};
|
||||
|
||||
declare module.exports: Chalk;
|
||||
11
package.json
11
package.json
|
|
@ -8,14 +8,13 @@
|
|||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd && flow",
|
||||
"test": "xo && nyc ava && tsd",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"templates.js",
|
||||
"index.d.ts",
|
||||
"index.js.flow"
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
|
|
@ -50,17 +49,11 @@
|
|||
"ava": "^1.4.1",
|
||||
"coveralls": "^3.0.3",
|
||||
"execa": "^1.0.0",
|
||||
"flow-bin": "^0.98.0",
|
||||
"import-fresh": "^3.0.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^14.0.0",
|
||||
"resolve-from": "^5.0.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test/_flow.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) 
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) 
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
// @flow
|
||||
import chalk from '..';
|
||||
|
||||
// $ExpectError (Can't have typo in option name)
|
||||
new chalk.Instance({levl: 1});
|
||||
new chalk.Instance({level: 1});
|
||||
|
||||
// $ExpectError (Option must have proper type)
|
||||
new chalk.Instance({enabled: 'true'});
|
||||
new chalk.Instance({enabled: true});
|
||||
|
||||
// $ExpectError (Can't have typo in chalk method)
|
||||
chalk.rd('foo');
|
||||
chalk.red('foo');
|
||||
|
||||
// $ExpectError (Can't have typo in chalk method)
|
||||
chalk.gren`foo`;
|
||||
chalk.green`foo`;
|
||||
|
||||
// $ExpectError (Can't have typo in chalk method)
|
||||
chalk.red.bgBlu.underline('foo');
|
||||
chalk.red.bgBlue.underline('foo');
|
||||
|
||||
// $ExpectError (Level must be 0, 1, 2, or 3)
|
||||
const badCtx = chalk.Instance({level: 4});
|
||||
const ctx = chalk.Instance({level: 3});
|
||||
|
||||
// $ExpectError (Can't have typo in method name)
|
||||
ctx.gry('foo');
|
||||
ctx.grey('foo');
|
||||
|
||||
// $ExpectError (Can't have typo in method name)
|
||||
ctx`foo`.value();
|
||||
ctx`foo`.valueOf();
|
||||
|
||||
// $ExpectError (Can't have typo in property name)
|
||||
chalk.abled = true;
|
||||
chalk.enabled = true;
|
||||
|
||||
// $ExpectError (Can't use invalid Level for property setter)
|
||||
chalk.level = 10;
|
||||
chalk.level = 1;
|
||||
|
||||
const chalkInstance = new chalk.Instance();
|
||||
|
||||
// $ExpectError (Can't have typo in method name)
|
||||
chalkInstance.blu('foo');
|
||||
chalkInstance.blue('foo');
|
||||
chalkInstance`foo`;
|
||||
|
||||
// $ExpectError (Can't have typo in method name)
|
||||
chalk.keywrd('orange').bgBlue('foo');
|
||||
chalk.keyword('orange').bgBlue('foo');
|
||||
|
||||
// $ExpectError (rgb should take in 3 numbers)
|
||||
chalk.rgb(1, 14).bgBlue('foo');
|
||||
chalk.rgb(1, 14, 9).bgBlue('foo');
|
||||
|
||||
// $ExpectError (hsl should take in 3 numbers)
|
||||
chalk.hsl(1, 14, '9').bgBlue('foo');
|
||||
chalk.hsl(1, 14, 9).bgBlue('foo');
|
||||
|
||||
// $ExpectError (hsv should take in 3 numbers)
|
||||
chalk.hsv(1, 14).bgBlue('foo');
|
||||
chalk.hsv(1, 14, 9).bgBlue('foo');
|
||||
|
||||
// $ExpectError (hwb should take in 3 numbers)
|
||||
chalk.hwb(1, 14).bgBlue('foo');
|
||||
chalk.hwb(1, 14, 9).bgBlue('foo');
|
||||
|
||||
// $ExpectError (Can't have typo in method name)
|
||||
chalk.visibl('foo');
|
||||
chalk.visible('foo');
|
||||
|
||||
// $ExpectError (Can't have typo in method name)
|
||||
chalk.red.visibl('foo');
|
||||
chalk.red.visible('foo');
|
||||
chalk.visible.red('foo');
|
||||
|
||||
// $ExpectError (Can't write to readonly property)
|
||||
chalk.black = 'foo';
|
||||
chalk.black;
|
||||
|
||||
// $ExpectError (Can't write to readonly property)
|
||||
chalk.reset = 'foo';
|
||||
console.log(chalk.reset);
|
||||
Loading…
Add table
Add a link
Reference in a new issue