From d3be9c65b11f505e0e8bd9d4796c4988bb634cf7 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 3 May 2019 15:03:53 +0700 Subject: [PATCH] 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. --- .flowconfig | 6 ---- index.js.flow | 93 --------------------------------------------------- package.json | 11 ++---- readme.md | 2 +- test/_flow.js | 86 ----------------------------------------------- 5 files changed, 3 insertions(+), 195 deletions(-) delete mode 100644 .flowconfig delete mode 100644 index.js.flow delete mode 100644 test/_flow.js diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index 48ee960..0000000 --- a/.flowconfig +++ /dev/null @@ -1,6 +0,0 @@ -[ignore] -.*/node_modules/.* - -[options] -suppress_comment= \\(.\\|\n\\)*\\$ExpectError -include_warnings=true diff --git a/index.js.flow b/index.js.flow deleted file mode 100644 index f7e4abc..0000000 --- a/index.js.flow +++ /dev/null @@ -1,93 +0,0 @@ -// @flow strict - -type TemplateStringsArray = $ReadOnlyArray; - -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; diff --git a/package.json b/package.json index 39ec03d..b18d8a3 100644 --- a/package.json +++ b/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" - ] } } diff --git a/readme.md b/readme.md index 1e3b9bb..ed3cd1b 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ > Terminal string styling done right -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript- and Flow-ready](https://img.shields.io/npm/types/chalk.svg) +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) diff --git a/test/_flow.js b/test/_flow.js deleted file mode 100644 index dbb6dd0..0000000 --- a/test/_flow.js +++ /dev/null @@ -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);