diff --git a/.changeset/eighty-dancers-flash.md b/.changeset/eighty-dancers-flash.md new file mode 100644 index 00000000..480f6876 --- /dev/null +++ b/.changeset/eighty-dancers-flash.md @@ -0,0 +1,5 @@ +--- +"@khanacademy/eslint-config": minor +--- + +Remove Flow eslint rules diff --git a/.eslintignore b/.eslintignore index c6a53b13..ebc20b77 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ node_modules -flow-typed/**/*.js coverage **/dist **/*.template diff --git a/.eslintrc.js b/.eslintrc.js index 2170b9ed..5115a936 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -48,8 +48,6 @@ module.exports = { "@babel/no-invalid-this": "error", "@babel/object-curly-spacing": "error", "@babel/semi": "error", - "ft-flow/no-types-missing-file-annotation": "error", - "ft-flow/no-existential-type": "error", "import/no-default-export": "error", "import/no-unresolved": "error", "import/named": "error", diff --git a/.gitignore b/.gitignore index 017b6756..198b03b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ node_modules coverage -flow-coverage dist !.vscode .DS_Store diff --git a/.prettierignore b/.prettierignore index 9566961d..c42b875a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,4 +2,3 @@ *.md docs *.yml -flow-typed/npm diff --git a/.vscode/settings.json b/.vscode/settings.json index daaba23d..75ae1ca0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,6 @@ "editor.renderWhitespace": "boundary", "eslint.codeActionsOnSave.mode": "all", "files.trimTrailingWhitespace": true, - "flow.useNPMPackagedFlow": true, "typescript.format.enable": false, "typescript.validate.enable": true, "javascript.validate.enable": true, @@ -11,6 +10,5 @@ }, "todo-tree.filtering.excludeGlobs": [ "**/dist/**", - "**/flow-typed/**" ] } \ No newline at end of file diff --git a/build-settings/babel.config.js b/build-settings/babel.config.js index 12857fa4..6fe61ea3 100644 --- a/build-settings/babel.config.js +++ b/build-settings/babel.config.js @@ -1,6 +1,5 @@ /* eslint-disable import/no-commonjs */ const createBabelPresets = require("./create-babel-presets"); -const createBabelPlugins = require("./create-babel-plugins"); // This config is used for Jest testing here in this repository, only. module.exports = { @@ -11,8 +10,4 @@ module.exports = { platform: "node", format: "cjs", }), - plugins: createBabelPlugins({ - platform: "node", - format: "cjs", - }), }; diff --git a/build-settings/create-babel-plugins.js b/build-settings/create-babel-plugins.js deleted file mode 100644 index 6d4839c3..00000000 --- a/build-settings/create-babel-plugins.js +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable import/no-commonjs */ -module.exports = function createBabelPlugins({platform, format}) { - return []; -}; diff --git a/build-settings/index.js.flow.template b/build-settings/index.js.flow.template deleted file mode 100644 index 74f2613a..00000000 --- a/build-settings/index.js.flow.template +++ /dev/null @@ -1,2 +0,0 @@ -// @flow -export * from "../src/index.js"; diff --git a/build-settings/rollup.config.js b/build-settings/rollup.config.js index c453b3cf..3b41f7d1 100644 --- a/build-settings/rollup.config.js +++ b/build-settings/rollup.config.js @@ -11,7 +11,6 @@ import {preserveShebangs} from "rollup-plugin-preserve-shebangs"; import rollupExecutable from "rollup-plugin-executable-output"; const createBabelPresets = require("./create-babel-presets"); -const createBabelPlugins = require("./create-babel-plugins"); /** * We support the following config args with this rollup configuration: @@ -118,7 +117,6 @@ const createConfig = ( babel({ babelHelpers: "bundled", presets: createBabelPresets({platform, format}), - plugins: createBabelPlugins({platform, format}), exclude: "node_modules/**", extensions, }), diff --git a/flow-typed/@google-cloud/debug-agent.js b/flow-typed/@google-cloud/debug-agent.js deleted file mode 100644 index b4da2174..00000000 --- a/flow-typed/@google-cloud/debug-agent.js +++ /dev/null @@ -1,19 +0,0 @@ -// NOTE(somewhatabstract): We don't use the return type, so we're just saying -// There is one. -declare class debugagent$Debuglet {} - -declare type debugagent$Config = { - logLevel?: number, - allowExpressions?: boolean, -}; - -declare function debugagent$start( - config?: debugagent$Config, -): debugagent$Debuglet; - -declare module "@google-cloud/debug-agent" { - declare export type Config = debugagent$Config; - declare module.exports: { - start: typeof debugagent$start, - }; -} diff --git a/flow-typed/@google-cloud/profiler.js b/flow-typed/@google-cloud/profiler.js deleted file mode 100644 index ffcb3106..00000000 --- a/flow-typed/@google-cloud/profiler.js +++ /dev/null @@ -1,14 +0,0 @@ -// NOTE(somewhatabstract): We don't use the return type, so we're just saying -// There is one. -declare type profiler$Config = { - logLevel: number, -}; - -declare function profiler$start(config?: profiler$Config): Promise; - -declare module "@google-cloud/profiler" { - declare export type Config = profiler$Config; - declare module.exports: { - start: typeof profiler$start, - }; -} diff --git a/flow-typed/@google-cloud/trace-agent.js b/flow-typed/@google-cloud/trace-agent.js deleted file mode 100644 index 9db161d6..00000000 --- a/flow-typed/@google-cloud/trace-agent.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Represents a trace span. - */ -declare interface traceagent$Span { - /** - * Adds a key-value pair as a label to the trace span. The value will be - * converted to a string if it is not already, and both the key and value - * may be truncated according to the user's configuration. - */ - addLabel(key: string, value: any): void; - - /** - * Ends the span. This method should only be called once. - * @param timestamp A custom span end time; defaults to the time when endSpan - * was called if not provided. - */ - endSpan(timestamp?: Date): void; -} - -/** - * An interface that describes the available options for creating a span in - * general. - */ -declare interface traceagent$SpanOptions { - name: string; - /** - * The number of stack frames to skip when collecting call stack information - * for the span, starting from the top; this should be set to avoid including - * frames in the plugin. Defaults to 0. - */ - skipFrames?: number; -} - -declare class traceagent$Tracer { - createChildSpan(options?: traceagent$SpanOptions): traceagent$Span; -} - -declare type traceagent$Config = { - enabled?: boolean, - logLevel?: number, -}; - -declare function traceagent$start( - config?: traceagent$Config, -): traceagent$Tracer; - -declare function traceagent$get(): traceagent$Tracer; - -declare module "@google-cloud/trace-agent" { - declare export type Config = traceagent$Config; - declare export type SpanOptions = traceagent$SpanOptions; - declare export type Span = traceagent$Span; - declare export type Tracer = traceagent$Tracer; - declare module.exports: { - start: typeof traceagent$start, - get: typeof traceagent$get, - }; -} diff --git a/flow-typed/npm/ancesdir_vx.x.x.js b/flow-typed/npm/ancesdir_vx.x.x.js deleted file mode 100644 index 17e83528..00000000 --- a/flow-typed/npm/ancesdir_vx.x.x.js +++ /dev/null @@ -1,35 +0,0 @@ -// flow-typed signature: 02e095fc2135e742ae3a993ce37b6294 -// flow-typed version: <>/ancesdir_v1.1.0/flow_v0.176.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'ancesdir' - * - * Fill this stub out by replacing all the `any` types. - * - * Once filled out, we encourage you to share your work with the - * community by sending a pull request to: - * https://github.com/flowtype/flow-typed - */ - -declare module 'ancesdir' { - declare module.exports: any; -} - -/** - * We include stubs for each file inside this npm package in case you need to - * require those files directly. Feel free to delete any files that aren't - * needed. - */ -declare module 'ancesdir/dist' { - declare module.exports: any; -} - -// Filename aliases -declare module 'ancesdir/dist/index' { - declare module.exports: $Exports<'ancesdir/dist'>; -} -declare module 'ancesdir/dist/index.js' { - declare module.exports: $Exports<'ancesdir/dist'>; -} diff --git a/flow-typed/npm/async_vx.x.x.js b/flow-typed/npm/async_vx.x.x.js deleted file mode 100644 index f68e80b5..00000000 --- a/flow-typed/npm/async_vx.x.x.js +++ /dev/null @@ -1,913 +0,0 @@ -// flow-typed signature: d03d68dfa235ff2476661b813a5910bc -// flow-typed version: <>/async_v2.6.2/flow_v0.176.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'async' - * - * Fill this stub out by replacing all the `any` types. - * - * Once filled out, we encourage you to share your work with the - * community by sending a pull request to: - * https://github.com/flowtype/flow-typed - */ - -declare module 'async' { - declare module.exports: any; -} - -/** - * We include stubs for each file inside this npm package in case you need to - * require those files directly. Feel free to delete any files that aren't - * needed. - */ -declare module 'async/all' { - declare module.exports: any; -} - -declare module 'async/allLimit' { - declare module.exports: any; -} - -declare module 'async/allSeries' { - declare module.exports: any; -} - -declare module 'async/any' { - declare module.exports: any; -} - -declare module 'async/anyLimit' { - declare module.exports: any; -} - -declare module 'async/anySeries' { - declare module.exports: any; -} - -declare module 'async/apply' { - declare module.exports: any; -} - -declare module 'async/applyEach' { - declare module.exports: any; -} - -declare module 'async/applyEachSeries' { - declare module.exports: any; -} - -declare module 'async/asyncify' { - declare module.exports: any; -} - -declare module 'async/auto' { - declare module.exports: any; -} - -declare module 'async/autoInject' { - declare module.exports: any; -} - -declare module 'async/cargo' { - declare module.exports: any; -} - -declare module 'async/compose' { - declare module.exports: any; -} - -declare module 'async/concat' { - declare module.exports: any; -} - -declare module 'async/concatLimit' { - declare module.exports: any; -} - -declare module 'async/concatSeries' { - declare module.exports: any; -} - -declare module 'async/constant' { - declare module.exports: any; -} - -declare module 'async/detect' { - declare module.exports: any; -} - -declare module 'async/detectLimit' { - declare module.exports: any; -} - -declare module 'async/detectSeries' { - declare module.exports: any; -} - -declare module 'async/dir' { - declare module.exports: any; -} - -declare module 'async/dist/async' { - declare module.exports: any; -} - -declare module 'async/dist/async.min' { - declare module.exports: any; -} - -declare module 'async/doDuring' { - declare module.exports: any; -} - -declare module 'async/doUntil' { - declare module.exports: any; -} - -declare module 'async/doWhilst' { - declare module.exports: any; -} - -declare module 'async/during' { - declare module.exports: any; -} - -declare module 'async/each' { - declare module.exports: any; -} - -declare module 'async/eachLimit' { - declare module.exports: any; -} - -declare module 'async/eachOf' { - declare module.exports: any; -} - -declare module 'async/eachOfLimit' { - declare module.exports: any; -} - -declare module 'async/eachOfSeries' { - declare module.exports: any; -} - -declare module 'async/eachSeries' { - declare module.exports: any; -} - -declare module 'async/ensureAsync' { - declare module.exports: any; -} - -declare module 'async/every' { - declare module.exports: any; -} - -declare module 'async/everyLimit' { - declare module.exports: any; -} - -declare module 'async/everySeries' { - declare module.exports: any; -} - -declare module 'async/filter' { - declare module.exports: any; -} - -declare module 'async/filterLimit' { - declare module.exports: any; -} - -declare module 'async/filterSeries' { - declare module.exports: any; -} - -declare module 'async/find' { - declare module.exports: any; -} - -declare module 'async/findLimit' { - declare module.exports: any; -} - -declare module 'async/findSeries' { - declare module.exports: any; -} - -declare module 'async/foldl' { - declare module.exports: any; -} - -declare module 'async/foldr' { - declare module.exports: any; -} - -declare module 'async/forEach' { - declare module.exports: any; -} - -declare module 'async/forEachLimit' { - declare module.exports: any; -} - -declare module 'async/forEachOf' { - declare module.exports: any; -} - -declare module 'async/forEachOfLimit' { - declare module.exports: any; -} - -declare module 'async/forEachOfSeries' { - declare module.exports: any; -} - -declare module 'async/forEachSeries' { - declare module.exports: any; -} - -declare module 'async/forever' { - declare module.exports: any; -} - -declare module 'async/groupBy' { - declare module.exports: any; -} - -declare module 'async/groupByLimit' { - declare module.exports: any; -} - -declare module 'async/groupBySeries' { - declare module.exports: any; -} - -declare module 'async/inject' { - declare module.exports: any; -} - -declare module 'async/internal/applyEach' { - declare module.exports: any; -} - -declare module 'async/internal/breakLoop' { - declare module.exports: any; -} - -declare module 'async/internal/consoleFunc' { - declare module.exports: any; -} - -declare module 'async/internal/createTester' { - declare module.exports: any; -} - -declare module 'async/internal/doLimit' { - declare module.exports: any; -} - -declare module 'async/internal/doParallel' { - declare module.exports: any; -} - -declare module 'async/internal/doParallelLimit' { - declare module.exports: any; -} - -declare module 'async/internal/DoublyLinkedList' { - declare module.exports: any; -} - -declare module 'async/internal/eachOfLimit' { - declare module.exports: any; -} - -declare module 'async/internal/filter' { - declare module.exports: any; -} - -declare module 'async/internal/findGetResult' { - declare module.exports: any; -} - -declare module 'async/internal/getIterator' { - declare module.exports: any; -} - -declare module 'async/internal/initialParams' { - declare module.exports: any; -} - -declare module 'async/internal/iterator' { - declare module.exports: any; -} - -declare module 'async/internal/map' { - declare module.exports: any; -} - -declare module 'async/internal/notId' { - declare module.exports: any; -} - -declare module 'async/internal/once' { - declare module.exports: any; -} - -declare module 'async/internal/onlyOnce' { - declare module.exports: any; -} - -declare module 'async/internal/parallel' { - declare module.exports: any; -} - -declare module 'async/internal/queue' { - declare module.exports: any; -} - -declare module 'async/internal/reject' { - declare module.exports: any; -} - -declare module 'async/internal/setImmediate' { - declare module.exports: any; -} - -declare module 'async/internal/slice' { - declare module.exports: any; -} - -declare module 'async/internal/withoutIndex' { - declare module.exports: any; -} - -declare module 'async/internal/wrapAsync' { - declare module.exports: any; -} - -declare module 'async/log' { - declare module.exports: any; -} - -declare module 'async/map' { - declare module.exports: any; -} - -declare module 'async/mapLimit' { - declare module.exports: any; -} - -declare module 'async/mapSeries' { - declare module.exports: any; -} - -declare module 'async/mapValues' { - declare module.exports: any; -} - -declare module 'async/mapValuesLimit' { - declare module.exports: any; -} - -declare module 'async/mapValuesSeries' { - declare module.exports: any; -} - -declare module 'async/memoize' { - declare module.exports: any; -} - -declare module 'async/nextTick' { - declare module.exports: any; -} - -declare module 'async/parallel' { - declare module.exports: any; -} - -declare module 'async/parallelLimit' { - declare module.exports: any; -} - -declare module 'async/priorityQueue' { - declare module.exports: any; -} - -declare module 'async/queue' { - declare module.exports: any; -} - -declare module 'async/race' { - declare module.exports: any; -} - -declare module 'async/reduce' { - declare module.exports: any; -} - -declare module 'async/reduceRight' { - declare module.exports: any; -} - -declare module 'async/reflect' { - declare module.exports: any; -} - -declare module 'async/reflectAll' { - declare module.exports: any; -} - -declare module 'async/reject' { - declare module.exports: any; -} - -declare module 'async/rejectLimit' { - declare module.exports: any; -} - -declare module 'async/rejectSeries' { - declare module.exports: any; -} - -declare module 'async/retry' { - declare module.exports: any; -} - -declare module 'async/retryable' { - declare module.exports: any; -} - -declare module 'async/select' { - declare module.exports: any; -} - -declare module 'async/selectLimit' { - declare module.exports: any; -} - -declare module 'async/selectSeries' { - declare module.exports: any; -} - -declare module 'async/seq' { - declare module.exports: any; -} - -declare module 'async/series' { - declare module.exports: any; -} - -declare module 'async/setImmediate' { - declare module.exports: any; -} - -declare module 'async/some' { - declare module.exports: any; -} - -declare module 'async/someLimit' { - declare module.exports: any; -} - -declare module 'async/someSeries' { - declare module.exports: any; -} - -declare module 'async/sortBy' { - declare module.exports: any; -} - -declare module 'async/timeout' { - declare module.exports: any; -} - -declare module 'async/times' { - declare module.exports: any; -} - -declare module 'async/timesLimit' { - declare module.exports: any; -} - -declare module 'async/timesSeries' { - declare module.exports: any; -} - -declare module 'async/transform' { - declare module.exports: any; -} - -declare module 'async/tryEach' { - declare module.exports: any; -} - -declare module 'async/unmemoize' { - declare module.exports: any; -} - -declare module 'async/until' { - declare module.exports: any; -} - -declare module 'async/waterfall' { - declare module.exports: any; -} - -declare module 'async/whilst' { - declare module.exports: any; -} - -declare module 'async/wrapSync' { - declare module.exports: any; -} - -// Filename aliases -declare module 'async/all.js' { - declare module.exports: $Exports<'async/all'>; -} -declare module 'async/allLimit.js' { - declare module.exports: $Exports<'async/allLimit'>; -} -declare module 'async/allSeries.js' { - declare module.exports: $Exports<'async/allSeries'>; -} -declare module 'async/any.js' { - declare module.exports: $Exports<'async/any'>; -} -declare module 'async/anyLimit.js' { - declare module.exports: $Exports<'async/anyLimit'>; -} -declare module 'async/anySeries.js' { - declare module.exports: $Exports<'async/anySeries'>; -} -declare module 'async/apply.js' { - declare module.exports: $Exports<'async/apply'>; -} -declare module 'async/applyEach.js' { - declare module.exports: $Exports<'async/applyEach'>; -} -declare module 'async/applyEachSeries.js' { - declare module.exports: $Exports<'async/applyEachSeries'>; -} -declare module 'async/asyncify.js' { - declare module.exports: $Exports<'async/asyncify'>; -} -declare module 'async/auto.js' { - declare module.exports: $Exports<'async/auto'>; -} -declare module 'async/autoInject.js' { - declare module.exports: $Exports<'async/autoInject'>; -} -declare module 'async/cargo.js' { - declare module.exports: $Exports<'async/cargo'>; -} -declare module 'async/compose.js' { - declare module.exports: $Exports<'async/compose'>; -} -declare module 'async/concat.js' { - declare module.exports: $Exports<'async/concat'>; -} -declare module 'async/concatLimit.js' { - declare module.exports: $Exports<'async/concatLimit'>; -} -declare module 'async/concatSeries.js' { - declare module.exports: $Exports<'async/concatSeries'>; -} -declare module 'async/constant.js' { - declare module.exports: $Exports<'async/constant'>; -} -declare module 'async/detect.js' { - declare module.exports: $Exports<'async/detect'>; -} -declare module 'async/detectLimit.js' { - declare module.exports: $Exports<'async/detectLimit'>; -} -declare module 'async/detectSeries.js' { - declare module.exports: $Exports<'async/detectSeries'>; -} -declare module 'async/dir.js' { - declare module.exports: $Exports<'async/dir'>; -} -declare module 'async/dist/async.js' { - declare module.exports: $Exports<'async/dist/async'>; -} -declare module 'async/dist/async.min.js' { - declare module.exports: $Exports<'async/dist/async.min'>; -} -declare module 'async/doDuring.js' { - declare module.exports: $Exports<'async/doDuring'>; -} -declare module 'async/doUntil.js' { - declare module.exports: $Exports<'async/doUntil'>; -} -declare module 'async/doWhilst.js' { - declare module.exports: $Exports<'async/doWhilst'>; -} -declare module 'async/during.js' { - declare module.exports: $Exports<'async/during'>; -} -declare module 'async/each.js' { - declare module.exports: $Exports<'async/each'>; -} -declare module 'async/eachLimit.js' { - declare module.exports: $Exports<'async/eachLimit'>; -} -declare module 'async/eachOf.js' { - declare module.exports: $Exports<'async/eachOf'>; -} -declare module 'async/eachOfLimit.js' { - declare module.exports: $Exports<'async/eachOfLimit'>; -} -declare module 'async/eachOfSeries.js' { - declare module.exports: $Exports<'async/eachOfSeries'>; -} -declare module 'async/eachSeries.js' { - declare module.exports: $Exports<'async/eachSeries'>; -} -declare module 'async/ensureAsync.js' { - declare module.exports: $Exports<'async/ensureAsync'>; -} -declare module 'async/every.js' { - declare module.exports: $Exports<'async/every'>; -} -declare module 'async/everyLimit.js' { - declare module.exports: $Exports<'async/everyLimit'>; -} -declare module 'async/everySeries.js' { - declare module.exports: $Exports<'async/everySeries'>; -} -declare module 'async/filter.js' { - declare module.exports: $Exports<'async/filter'>; -} -declare module 'async/filterLimit.js' { - declare module.exports: $Exports<'async/filterLimit'>; -} -declare module 'async/filterSeries.js' { - declare module.exports: $Exports<'async/filterSeries'>; -} -declare module 'async/find.js' { - declare module.exports: $Exports<'async/find'>; -} -declare module 'async/findLimit.js' { - declare module.exports: $Exports<'async/findLimit'>; -} -declare module 'async/findSeries.js' { - declare module.exports: $Exports<'async/findSeries'>; -} -declare module 'async/foldl.js' { - declare module.exports: $Exports<'async/foldl'>; -} -declare module 'async/foldr.js' { - declare module.exports: $Exports<'async/foldr'>; -} -declare module 'async/forEach.js' { - declare module.exports: $Exports<'async/forEach'>; -} -declare module 'async/forEachLimit.js' { - declare module.exports: $Exports<'async/forEachLimit'>; -} -declare module 'async/forEachOf.js' { - declare module.exports: $Exports<'async/forEachOf'>; -} -declare module 'async/forEachOfLimit.js' { - declare module.exports: $Exports<'async/forEachOfLimit'>; -} -declare module 'async/forEachOfSeries.js' { - declare module.exports: $Exports<'async/forEachOfSeries'>; -} -declare module 'async/forEachSeries.js' { - declare module.exports: $Exports<'async/forEachSeries'>; -} -declare module 'async/forever.js' { - declare module.exports: $Exports<'async/forever'>; -} -declare module 'async/groupBy.js' { - declare module.exports: $Exports<'async/groupBy'>; -} -declare module 'async/groupByLimit.js' { - declare module.exports: $Exports<'async/groupByLimit'>; -} -declare module 'async/groupBySeries.js' { - declare module.exports: $Exports<'async/groupBySeries'>; -} -declare module 'async/index' { - declare module.exports: $Exports<'async'>; -} -declare module 'async/index.js' { - declare module.exports: $Exports<'async'>; -} -declare module 'async/inject.js' { - declare module.exports: $Exports<'async/inject'>; -} -declare module 'async/internal/applyEach.js' { - declare module.exports: $Exports<'async/internal/applyEach'>; -} -declare module 'async/internal/breakLoop.js' { - declare module.exports: $Exports<'async/internal/breakLoop'>; -} -declare module 'async/internal/consoleFunc.js' { - declare module.exports: $Exports<'async/internal/consoleFunc'>; -} -declare module 'async/internal/createTester.js' { - declare module.exports: $Exports<'async/internal/createTester'>; -} -declare module 'async/internal/doLimit.js' { - declare module.exports: $Exports<'async/internal/doLimit'>; -} -declare module 'async/internal/doParallel.js' { - declare module.exports: $Exports<'async/internal/doParallel'>; -} -declare module 'async/internal/doParallelLimit.js' { - declare module.exports: $Exports<'async/internal/doParallelLimit'>; -} -declare module 'async/internal/DoublyLinkedList.js' { - declare module.exports: $Exports<'async/internal/DoublyLinkedList'>; -} -declare module 'async/internal/eachOfLimit.js' { - declare module.exports: $Exports<'async/internal/eachOfLimit'>; -} -declare module 'async/internal/filter.js' { - declare module.exports: $Exports<'async/internal/filter'>; -} -declare module 'async/internal/findGetResult.js' { - declare module.exports: $Exports<'async/internal/findGetResult'>; -} -declare module 'async/internal/getIterator.js' { - declare module.exports: $Exports<'async/internal/getIterator'>; -} -declare module 'async/internal/initialParams.js' { - declare module.exports: $Exports<'async/internal/initialParams'>; -} -declare module 'async/internal/iterator.js' { - declare module.exports: $Exports<'async/internal/iterator'>; -} -declare module 'async/internal/map.js' { - declare module.exports: $Exports<'async/internal/map'>; -} -declare module 'async/internal/notId.js' { - declare module.exports: $Exports<'async/internal/notId'>; -} -declare module 'async/internal/once.js' { - declare module.exports: $Exports<'async/internal/once'>; -} -declare module 'async/internal/onlyOnce.js' { - declare module.exports: $Exports<'async/internal/onlyOnce'>; -} -declare module 'async/internal/parallel.js' { - declare module.exports: $Exports<'async/internal/parallel'>; -} -declare module 'async/internal/queue.js' { - declare module.exports: $Exports<'async/internal/queue'>; -} -declare module 'async/internal/reject.js' { - declare module.exports: $Exports<'async/internal/reject'>; -} -declare module 'async/internal/setImmediate.js' { - declare module.exports: $Exports<'async/internal/setImmediate'>; -} -declare module 'async/internal/slice.js' { - declare module.exports: $Exports<'async/internal/slice'>; -} -declare module 'async/internal/withoutIndex.js' { - declare module.exports: $Exports<'async/internal/withoutIndex'>; -} -declare module 'async/internal/wrapAsync.js' { - declare module.exports: $Exports<'async/internal/wrapAsync'>; -} -declare module 'async/log.js' { - declare module.exports: $Exports<'async/log'>; -} -declare module 'async/map.js' { - declare module.exports: $Exports<'async/map'>; -} -declare module 'async/mapLimit.js' { - declare module.exports: $Exports<'async/mapLimit'>; -} -declare module 'async/mapSeries.js' { - declare module.exports: $Exports<'async/mapSeries'>; -} -declare module 'async/mapValues.js' { - declare module.exports: $Exports<'async/mapValues'>; -} -declare module 'async/mapValuesLimit.js' { - declare module.exports: $Exports<'async/mapValuesLimit'>; -} -declare module 'async/mapValuesSeries.js' { - declare module.exports: $Exports<'async/mapValuesSeries'>; -} -declare module 'async/memoize.js' { - declare module.exports: $Exports<'async/memoize'>; -} -declare module 'async/nextTick.js' { - declare module.exports: $Exports<'async/nextTick'>; -} -declare module 'async/parallel.js' { - declare module.exports: $Exports<'async/parallel'>; -} -declare module 'async/parallelLimit.js' { - declare module.exports: $Exports<'async/parallelLimit'>; -} -declare module 'async/priorityQueue.js' { - declare module.exports: $Exports<'async/priorityQueue'>; -} -declare module 'async/queue.js' { - declare module.exports: $Exports<'async/queue'>; -} -declare module 'async/race.js' { - declare module.exports: $Exports<'async/race'>; -} -declare module 'async/reduce.js' { - declare module.exports: $Exports<'async/reduce'>; -} -declare module 'async/reduceRight.js' { - declare module.exports: $Exports<'async/reduceRight'>; -} -declare module 'async/reflect.js' { - declare module.exports: $Exports<'async/reflect'>; -} -declare module 'async/reflectAll.js' { - declare module.exports: $Exports<'async/reflectAll'>; -} -declare module 'async/reject.js' { - declare module.exports: $Exports<'async/reject'>; -} -declare module 'async/rejectLimit.js' { - declare module.exports: $Exports<'async/rejectLimit'>; -} -declare module 'async/rejectSeries.js' { - declare module.exports: $Exports<'async/rejectSeries'>; -} -declare module 'async/retry.js' { - declare module.exports: $Exports<'async/retry'>; -} -declare module 'async/retryable.js' { - declare module.exports: $Exports<'async/retryable'>; -} -declare module 'async/select.js' { - declare module.exports: $Exports<'async/select'>; -} -declare module 'async/selectLimit.js' { - declare module.exports: $Exports<'async/selectLimit'>; -} -declare module 'async/selectSeries.js' { - declare module.exports: $Exports<'async/selectSeries'>; -} -declare module 'async/seq.js' { - declare module.exports: $Exports<'async/seq'>; -} -declare module 'async/series.js' { - declare module.exports: $Exports<'async/series'>; -} -declare module 'async/setImmediate.js' { - declare module.exports: $Exports<'async/setImmediate'>; -} -declare module 'async/some.js' { - declare module.exports: $Exports<'async/some'>; -} -declare module 'async/someLimit.js' { - declare module.exports: $Exports<'async/someLimit'>; -} -declare module 'async/someSeries.js' { - declare module.exports: $Exports<'async/someSeries'>; -} -declare module 'async/sortBy.js' { - declare module.exports: $Exports<'async/sortBy'>; -} -declare module 'async/timeout.js' { - declare module.exports: $Exports<'async/timeout'>; -} -declare module 'async/times.js' { - declare module.exports: $Exports<'async/times'>; -} -declare module 'async/timesLimit.js' { - declare module.exports: $Exports<'async/timesLimit'>; -} -declare module 'async/timesSeries.js' { - declare module.exports: $Exports<'async/timesSeries'>; -} -declare module 'async/transform.js' { - declare module.exports: $Exports<'async/transform'>; -} -declare module 'async/tryEach.js' { - declare module.exports: $Exports<'async/tryEach'>; -} -declare module 'async/unmemoize.js' { - declare module.exports: $Exports<'async/unmemoize'>; -} -declare module 'async/until.js' { - declare module.exports: $Exports<'async/until'>; -} -declare module 'async/waterfall.js' { - declare module.exports: $Exports<'async/waterfall'>; -} -declare module 'async/whilst.js' { - declare module.exports: $Exports<'async/whilst'>; -} -declare module 'async/wrapSync.js' { - declare module.exports: $Exports<'async/wrapSync'>; -} diff --git a/flow-typed/npm/express_v4.17.x.js b/flow-typed/npm/express_v4.17.x.js deleted file mode 100644 index 68b85b5c..00000000 --- a/flow-typed/npm/express_v4.17.x.js +++ /dev/null @@ -1,361 +0,0 @@ -// flow-typed signature: 53fbc99af5ac2f0732fc7c8641f3e128 -// flow-typed version: 2f514ea8dd/express_v4.17.x/flow_>=v0.104.x - -declare type express$RouterOptions = { - caseSensitive?: boolean, - mergeParams?: boolean, - strict?: boolean, - ... -}; - -declare class express$RequestResponseBase { - app: express$Application; - get(field: string): string | void; -} - -declare type express$RequestParams = {[param: string]: string, ...}; - -/* - NOTE: Use caution when extending `express$Request` or `express$Response`. When - a request first hits the server, its `req` and `res` will not have any - additional properties, even if you explicitly type them with your custom - subclass. Subsequent middleware may assign these properties, but you must be - cognizant of this ordering. One way to handle this is marking all properties - as optional to force refinement every time a property is accessed. Therefore, - we advise that you always mark properties as _optional_ in `express$Request` - and `express$Response` subclasses. - - You may decide not to do this, in which case the typings will be unsound and - the behavior will be similar to how arrays work in Flow. See here for more - information: https://flow.org/en/docs/types/arrays/#toc-array-access-is-unsafe - - See #3578 and #3337 for additional discussion. If you have ideas on how to - improve these typings, please share them in #3578 or open a new issue. - - **BAD** - declare class test_express$CustomRequest extends express$Request { - foo: string; - } - - **GOOD** - declare class test_express$CustomRequest extends express$Request { - foo: string | void; - } -*/ -declare class express$Request extends http$IncomingMessage - mixins express$RequestResponseBase { - baseUrl: string; - body: mixed; - cookies: {[cookie: string]: string, ...}; - connection: net$Socket; - fresh: boolean; - hostname: string; - ip: string; - ips: Array; - method: string; - originalUrl: string; - params: express$RequestParams; - path: string; - protocol: "https" | "http"; - query: {[name: string]: string | Array, ...}; - route: string; - secure: boolean; - signedCookies: {[signedCookie: string]: string, ...}; - stale: boolean; - subdomains: Array; - xhr: boolean; - accepts(types: string): string | false; - accepts(types: Array): string | false; - acceptsCharsets(...charsets: Array): string | false; - acceptsEncodings(...encoding: Array): string | false; - acceptsLanguages(...lang: Array): string | false; - header(field: string): string | void; - is(type: string): string | false; - param(name: string, defaultValue?: string): string | void; -} - -declare type express$CookieOptions = { - domain?: string, - encode?: (value: string) => string, - expires?: Date, - httpOnly?: boolean, - maxAge?: number, - path?: string, - secure?: boolean, - signed?: boolean, - ... -}; - -declare type express$Path = string | RegExp; - -declare type express$RenderCallback = ( - err: Error | null, - html?: string, -) => mixed; - -declare type express$SendFileOptions = { - maxAge?: number, - root?: string, - lastModified?: boolean, - headers?: {[name: string]: string, ...}, - dotfiles?: "allow" | "deny" | "ignore", - ... -}; - -declare class express$Response extends http$ServerResponse - mixins express$RequestResponseBase { - headersSent: boolean; - locals: {[name: string]: mixed, ...}; - append(field: string, value?: string): this; - attachment(filename?: string): this; - cookie(name: string, value: string, options?: express$CookieOptions): this; - clearCookie(name: string, options?: express$CookieOptions): this; - download( - path: string, - filename?: string, - callback?: (err?: ?Error) => void, - ): this; - format(typesObject: {[type: string]: Function, ...}): this; - json(body?: mixed): this; - jsonp(body?: mixed): this; - links(links: {[name: string]: string, ...}): this; - location(path: string): this; - redirect(url: string, ...args: Array): this; - redirect(status: number, url: string, ...args: Array): this; - render( - view: string, - locals?: {[name: string]: mixed, ...}, - callback?: express$RenderCallback, - ): this; - send(body?: mixed): this; - sendFile( - path: string, - options?: express$SendFileOptions, - callback?: (err?: ?Error) => mixed, - ): this; - sendStatus(statusCode: number): this; - header(field: string, value?: string): this; - header(headers: {[name: string]: string, ...}): this; - set(field: string, value?: string | string[]): this; - set(headers: {[name: string]: string, ...}): this; - status(statusCode: number): this; - type(type: string): this; - vary(field: string): this; - req: express$Request; -} - -declare type express$NextFunction = (err?: ?Error | "route") => mixed; -declare type express$Middleware< - Req: express$Request = express$Request, - Res: express$Response = express$Response, -> = - | ((req: Req, res: Res, next: express$NextFunction) => mixed) - | ((error: Error, req: Req, res: Res, next: express$NextFunction) => mixed); - -declare interface express$RouteMethodType< - T, - Req: express$Request = express$Request, - Res: express$Response = express$Response, -> { - (middleware: express$Middleware): T; - (...middleware: Array>): T; - ( - path: express$Path | $ReadOnlyArray, - ...middleware: Array> - ): T; -} - -declare class express$Route< - Req: express$Request = express$Request, - Res: express$Response = express$Response, -> { - all: express$RouteMethodType; - get: express$RouteMethodType; - post: express$RouteMethodType; - put: express$RouteMethodType; - head: express$RouteMethodType; - delete: express$RouteMethodType; - options: express$RouteMethodType; - trace: express$RouteMethodType; - copy: express$RouteMethodType; - lock: express$RouteMethodType; - mkcol: express$RouteMethodType; - move: express$RouteMethodType; - purge: express$RouteMethodType; - propfind: express$RouteMethodType; - proppatch: express$RouteMethodType; - unlock: express$RouteMethodType; - report: express$RouteMethodType; - mkactivity: express$RouteMethodType; - checkout: express$RouteMethodType; - merge: express$RouteMethodType; - - // @TODO Missing 'm-search' but get flow illegal name error. - - notify: express$RouteMethodType; - subscribe: express$RouteMethodType; - unsubscribe: express$RouteMethodType; - patch: express$RouteMethodType; - search: express$RouteMethodType; - connect: express$RouteMethodType; -} - -declare class express$Router< - Req: express$Request = express$Request, - Res: express$Response = express$Response, -> extends express$Route { - constructor(options?: express$RouterOptions): void; - route(path: string): express$Route; - static ( - options?: express$RouterOptions, - ): express$Router; - use(middleware: express$Middleware): this; - use(...middleware: Array>): this; - use( - path: express$Path | $ReadOnlyArray, - ...middleware: Array> - ): this; - use(path: string, router: express$Router): this; - handle( - req: http$IncomingMessage<>, - res: http$ServerResponse, - next: express$NextFunction, - ): void; - param( - param: string, - callback: ( - req: Req, - res: Res, - next: express$NextFunction, - value: string, - paramName: string, - ) => mixed, - ): void; - ( - req: http$IncomingMessage<>, - res: http$ServerResponse, - next?: ?express$NextFunction, - ): void; -} - -/* -With flow-bin ^0.59, express app.listen() is deemed to return any and fails flow type coverage. -Which is ironic because https://github.com/facebook/flow/blob/master/Changelog.md#misc-2 (release notes for 0.59) -says "Improves typings for Node.js HTTP server listen() function." See that? IMPROVES! -To work around this issue, we changed Server to ?Server here, so that our invocations of express.listen() will -not be deemed to lack type coverage. -*/ - -declare class express$Application< - Req: express$Request = express$Request, - Res: express$Response = express$Response, -> extends express$Router mixins events$EventEmitter { - constructor(): void; - locals: {[name: string]: mixed, ...}; - mountpath: string; - listen( - port: number, - hostname?: string, - backlog?: number, - callback?: (err?: ?Error) => mixed, - ): ?http$Server; - listen( - port: number, - hostname?: string, - callback?: (err?: ?Error) => mixed, - ): ?http$Server; - listen(port: number, callback?: (err?: ?Error) => mixed): ?http$Server; - listen(path: string, callback?: (err?: ?Error) => mixed): ?http$Server; - listen(handle: Object, callback?: (err?: ?Error) => mixed): ?http$Server; - disable(name: string): void; - disabled(name: string): boolean; - enable(name: string): this; - enabled(name: string): boolean; - engine(name: string, callback: Function): void; - /** - * Mixed will not be taken as a value option. Issue around using the GET http method name and the get for settings. - */ - // get(name: string): mixed; - set(name: string, value: mixed): mixed; - render( - name: string, - optionsOrFunction: {[name: string]: mixed, ...}, - callback: express$RenderCallback, - ): void; - handle( - req: http$IncomingMessage<>, - res: http$ServerResponse, - next?: ?express$NextFunction, - ): void; - // callable signature is not inherited - ( - req: http$IncomingMessage<>, - res: http$ServerResponse, - next?: ?express$NextFunction, - ): void; -} - -declare type JsonOptions = { - inflate?: boolean, - limit?: string | number, - reviver?: (key: string, value: mixed) => mixed, - strict?: boolean, - type?: string | Array | ((req: express$Request) => boolean), - verify?: ( - req: express$Request, - res: express$Response, - buf: Buffer, - encoding: string, - ) => mixed, - ... -}; - -declare type express$UrlEncodedOptions = { - extended?: boolean, - inflate?: boolean, - limit?: string | number, - parameterLimit?: number, - type?: string | Array | ((req: express$Request) => boolean), - verify?: ( - req: express$Request, - res: express$Response, - buf: Buffer, - encoding: string, - ) => mixed, - ... -}; - -declare module "express" { - declare export type RouterOptions = express$RouterOptions; - declare export type CookieOptions = express$CookieOptions; - declare export type Middleware< - Req: express$Request = express$Request, - Res: express$Response = express$Response, - > = express$Middleware; - declare export type NextFunction = express$NextFunction; - declare export type RequestParams = express$RequestParams; - declare export type $Response = express$Response; - declare export type $Request = express$Request; - declare export type $Application< - Req: express$Request = express$Request, - Res: express$Response = express$Response, - > = express$Application; - - declare module.exports: { - // If you try to call like a function, it will use this signature - (): express$Application< - Req, - Res, - >, - json: (opts: ?JsonOptions) => express$Middleware<>, - // `static` property on the function - static: ( - root: string, - options?: Object, - ) => express$Middleware, - // `Router` property on the function - Router: typeof express$Router, - urlencoded: (opts: ?express$UrlEncodedOptions) => express$Middleware<>, - ... - }; -} diff --git a/flow-typed/npm/fast-glob_vx.x.x.js b/flow-typed/npm/fast-glob_vx.x.x.js deleted file mode 100644 index aad25420..00000000 --- a/flow-typed/npm/fast-glob_vx.x.x.js +++ /dev/null @@ -1,216 +0,0 @@ -// flow-typed signature: 056417ce0de0c0cff6eaded3d842a3c8 -// flow-typed version: <>/fast-glob_v3.2.4/flow_v0.176.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'fast-glob' - * - * Fill this stub out by replacing all the `any` types. - * - * Once filled out, we encourage you to share your work with the - * community by sending a pull request to: - * https://github.com/flowtype/flow-typed - */ - -declare module 'fast-glob' { - declare module.exports: any; -} - -/** - * We include stubs for each file inside this npm package in case you need to - * require those files directly. Feel free to delete any files that aren't - * needed. - */ -declare module 'fast-glob/out' { - declare module.exports: any; -} - -declare module 'fast-glob/out/managers/patterns' { - declare module.exports: any; -} - -declare module 'fast-glob/out/managers/tasks' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/async' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/filters/deep' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/filters/entry' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/filters/error' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/matchers/matcher' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/matchers/partial' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/provider' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/stream' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/sync' { - declare module.exports: any; -} - -declare module 'fast-glob/out/providers/transformers/entry' { - declare module.exports: any; -} - -declare module 'fast-glob/out/readers/reader' { - declare module.exports: any; -} - -declare module 'fast-glob/out/readers/stream' { - declare module.exports: any; -} - -declare module 'fast-glob/out/readers/sync' { - declare module.exports: any; -} - -declare module 'fast-glob/out/settings' { - declare module.exports: any; -} - -declare module 'fast-glob/out/types' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/array' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/errno' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/fs' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/path' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/pattern' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/stream' { - declare module.exports: any; -} - -declare module 'fast-glob/out/utils/string' { - declare module.exports: any; -} - -// Filename aliases -declare module 'fast-glob/out/index' { - declare module.exports: $Exports<'fast-glob/out'>; -} -declare module 'fast-glob/out/index.js' { - declare module.exports: $Exports<'fast-glob/out'>; -} -declare module 'fast-glob/out/managers/patterns.js' { - declare module.exports: $Exports<'fast-glob/out/managers/patterns'>; -} -declare module 'fast-glob/out/managers/tasks.js' { - declare module.exports: $Exports<'fast-glob/out/managers/tasks'>; -} -declare module 'fast-glob/out/providers/async.js' { - declare module.exports: $Exports<'fast-glob/out/providers/async'>; -} -declare module 'fast-glob/out/providers/filters/deep.js' { - declare module.exports: $Exports<'fast-glob/out/providers/filters/deep'>; -} -declare module 'fast-glob/out/providers/filters/entry.js' { - declare module.exports: $Exports<'fast-glob/out/providers/filters/entry'>; -} -declare module 'fast-glob/out/providers/filters/error.js' { - declare module.exports: $Exports<'fast-glob/out/providers/filters/error'>; -} -declare module 'fast-glob/out/providers/matchers/matcher.js' { - declare module.exports: $Exports<'fast-glob/out/providers/matchers/matcher'>; -} -declare module 'fast-glob/out/providers/matchers/partial.js' { - declare module.exports: $Exports<'fast-glob/out/providers/matchers/partial'>; -} -declare module 'fast-glob/out/providers/provider.js' { - declare module.exports: $Exports<'fast-glob/out/providers/provider'>; -} -declare module 'fast-glob/out/providers/stream.js' { - declare module.exports: $Exports<'fast-glob/out/providers/stream'>; -} -declare module 'fast-glob/out/providers/sync.js' { - declare module.exports: $Exports<'fast-glob/out/providers/sync'>; -} -declare module 'fast-glob/out/providers/transformers/entry.js' { - declare module.exports: $Exports<'fast-glob/out/providers/transformers/entry'>; -} -declare module 'fast-glob/out/readers/reader.js' { - declare module.exports: $Exports<'fast-glob/out/readers/reader'>; -} -declare module 'fast-glob/out/readers/stream.js' { - declare module.exports: $Exports<'fast-glob/out/readers/stream'>; -} -declare module 'fast-glob/out/readers/sync.js' { - declare module.exports: $Exports<'fast-glob/out/readers/sync'>; -} -declare module 'fast-glob/out/settings.js' { - declare module.exports: $Exports<'fast-glob/out/settings'>; -} -declare module 'fast-glob/out/types/index' { - declare module.exports: $Exports<'fast-glob/out/types'>; -} -declare module 'fast-glob/out/types/index.js' { - declare module.exports: $Exports<'fast-glob/out/types'>; -} -declare module 'fast-glob/out/utils/array.js' { - declare module.exports: $Exports<'fast-glob/out/utils/array'>; -} -declare module 'fast-glob/out/utils/errno.js' { - declare module.exports: $Exports<'fast-glob/out/utils/errno'>; -} -declare module 'fast-glob/out/utils/fs.js' { - declare module.exports: $Exports<'fast-glob/out/utils/fs'>; -} -declare module 'fast-glob/out/utils/index' { - declare module.exports: $Exports<'fast-glob/out/utils'>; -} -declare module 'fast-glob/out/utils/index.js' { - declare module.exports: $Exports<'fast-glob/out/utils'>; -} -declare module 'fast-glob/out/utils/path.js' { - declare module.exports: $Exports<'fast-glob/out/utils/path'>; -} -declare module 'fast-glob/out/utils/pattern.js' { - declare module.exports: $Exports<'fast-glob/out/utils/pattern'>; -} -declare module 'fast-glob/out/utils/stream.js' { - declare module.exports: $Exports<'fast-glob/out/utils/stream'>; -} -declare module 'fast-glob/out/utils/string.js' { - declare module.exports: $Exports<'fast-glob/out/utils/string'>; -} diff --git a/flow-typed/npm/jest-when.js b/flow-typed/npm/jest-when.js deleted file mode 100644 index 9836fc58..00000000 --- a/flow-typed/npm/jest-when.js +++ /dev/null @@ -1,28 +0,0 @@ -// NOTE(@somewhatabstract): Crafted from looking at the TypeScript types and -// editing to match the Jest flow types for maintenance clarity. - -declare module "jest-when" { - declare type WhenMock, TReturn> = { - ...$Exact>, - calledWith(...matchers: TArguments): WhenMock; - expectCalledWith(...matchers: TArguments): WhenMock; - mockReturnValue(value: TReturn): WhenMock; - mockReturnValueOnce(value: TReturn): WhenMock; - mockResolvedValue(value: TReturn): WhenMock; - mockResolvedValueOnce(value: TReturn): WhenMock; - mockRejectedValue(value: TReturn): WhenMock; - mockRejectedValueOnce(value: TReturn): WhenMock; - mockImplementation(fn: (...args: TArguments) => TReturn): WhenMock; - mockImplementationOnce(fn?: (...args: TArguments) => TReturn): WhenMock; - } - - declare type When = , TReturn>( - fn: ((...args: TArguments) => TReturn) | JestMockFn, - ) => WhenMock; - - declare module.exports: { - when: When, - resetAllWhenMocks: () => void, - verifyAllWhenMocksCalled: () => void, - } -} diff --git a/flow-typed/npm/jest_v28.x.x.js b/flow-typed/npm/jest_v28.x.x.js deleted file mode 100644 index 3f7633e0..00000000 --- a/flow-typed/npm/jest_v28.x.x.js +++ /dev/null @@ -1,1272 +0,0 @@ -// flow-typed signature: fd6b1d81136037fad6c4e96fa7354af4 -// flow-typed version: 3153a3ba01/jest_v28.x.x/flow_>=v0.134.x - -type JestMockFn, TReturn> = { - (...args: TArguments): TReturn, - /** - * An object for introspecting mock calls - */ - mock: { - /** - * An array that represents all calls that have been made into this mock - * function. Each call is represented by an array of arguments that were - * passed during the call. - */ - calls: Array, - /** - * An array containing the call arguments of the last call that was made - * to this mock function. If the function was not called, it will return - * undefined. - */ - lastCall: TArguments, - /** - * An array that contains all the object instances that have been - * instantiated from this mock function. - */ - instances: Array, - /** - * An array that contains all the object results that have been - * returned by this mock function call - */ - results: Array<{ - isThrow: boolean, - value: TReturn, - ... - }>, - ... - }, - /** - * Resets all information stored in the mockFn.mock.calls and - * mockFn.mock.instances arrays. Often this is useful when you want to clean - * up a mock's usage data between two assertions. - */ - mockClear(): void, - /** - * Resets all information stored in the mock. This is useful when you want to - * completely restore a mock back to its initial state. - */ - mockReset(): void, - /** - * Removes the mock and restores the initial implementation. This is useful - * when you want to mock functions in certain test cases and restore the - * original implementation in others. Beware that mockFn.mockRestore only - * works when mock was created with jest.spyOn. Thus you have to take care of - * restoration yourself when manually assigning jest.fn(). - */ - mockRestore(): void, - /** - * Accepts a function that should be used as the implementation of the mock. - * The mock itself will still record all calls that go into and instances - * that come from itself -- the only difference is that the implementation - * will also be executed when the mock is called. - */ - mockImplementation( - fn: (...args: TArguments) => TReturn - ): JestMockFn, - /** - * Accepts a function that will be used as an implementation of the mock for - * one call to the mocked function. Can be chained so that multiple function - * calls produce different results. - */ - mockImplementationOnce( - fn: (...args: TArguments) => TReturn - ): JestMockFn, - /** - * Accepts a string to use in test result output in place of "jest.fn()" to - * indicate which mock function is being referenced. - */ - mockName(name: string): JestMockFn, - /** - * Just a simple sugar function for returning `this` - */ - mockReturnThis(): void, - /** - * Accepts a value that will be returned whenever the mock function is called. - */ - mockReturnValue(value: TReturn): JestMockFn, - /** - * Sugar for only returning a value once inside your mock - */ - mockReturnValueOnce(value: TReturn): JestMockFn, - /** - * Sugar for jest.fn().mockImplementation(() => Promise.resolve(value)) - */ - mockResolvedValue(value: TReturn): JestMockFn>, - /** - * Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value)) - */ - mockResolvedValueOnce( - value: TReturn - ): JestMockFn>, - /** - * Sugar for jest.fn().mockImplementation(() => Promise.reject(value)) - */ - mockRejectedValue(value: TReturn): JestMockFn>, - /** - * Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value)) - */ - mockRejectedValueOnce(value: TReturn): JestMockFn>, - ... -}; - -type JestAsymmetricEqualityType = { - /** - * A custom Jasmine equality tester - */ - asymmetricMatch(value: mixed): boolean, - ... -}; - -type JestCallsType = { - allArgs(): mixed, - all(): mixed, - any(): boolean, - count(): number, - first(): mixed, - mostRecent(): mixed, - reset(): void, - ... -}; - -type JestClockType = { - install(): void, - mockDate(date: Date): void, - tick(milliseconds?: number): void, - uninstall(): void, - ... -}; - -type JestMatcherResult = { - message?: string | (() => string), - pass: boolean, - ... -}; - -type JestMatcher = ( - received: any, - ...actual: Array -) => JestMatcherResult | Promise; - -type JestPromiseType = { - /** - * Use rejects to unwrap the reason of a rejected promise so any other - * matcher can be chained. If the promise is fulfilled the assertion fails. - */ - rejects: JestExpectType, - /** - * Use resolves to unwrap the value of a fulfilled promise so any other - * matcher can be chained. If the promise is rejected the assertion fails. - */ - resolves: JestExpectType, - ... -}; - -/** - * Jest allows functions and classes to be used as test names in test() and - * describe() - */ -type JestTestName = string | Function; - -type FakeableAPI = - | 'Date' - | 'hrtime' - | 'nextTick' - | 'performance' - | 'queueMicrotask' - | 'requestAnimationFrame' - | 'cancelAnimationFrame' - | 'requestIdleCallback' - | 'cancelIdleCallback' - | 'setImmediate' - | 'clearImmediate' - | 'setInterval' - | 'clearInterval' - | 'setTimeout' - | 'clearTimeout'; - -type FakeTimersConfig = { - advanceTimers?: boolean | number, - doNotFake?: Array, - now?: number | Date, - timerLimit?: number, - legacyFakeTimers?: boolean, - ... -}; - -/** - * Plugin: jest-styled-components - */ - -type JestStyledComponentsMatcherValue = - | string - | JestAsymmetricEqualityType - | RegExp - | typeof undefined; - -type JestStyledComponentsMatcherOptions = { - media?: string, - modifier?: string, - supports?: string, - ... -}; - -type JestStyledComponentsMatchersType = { - toHaveStyleRule( - property: string, - value: JestStyledComponentsMatcherValue, - options?: JestStyledComponentsMatcherOptions - ): void, - ... -}; - -/** - * Plugin: jest-enzyme - */ -type EnzymeMatchersType = { - // 5.x - toBeEmpty(): void, - toBePresent(): void, - // 6.x - toBeChecked(): void, - toBeDisabled(): void, - toBeEmptyRender(): void, - toContainMatchingElement(selector: string): void, - toContainMatchingElements(n: number, selector: string): void, - toContainExactlyOneMatchingElement(selector: string): void, - toContainReact(element: React$Element): void, - toExist(): void, - toHaveClassName(className: string): void, - toHaveHTML(html: string): void, - toHaveProp: ((propKey: string, propValue?: any) => void) & - ((props: { ... }) => void), - toHaveRef(refName: string): void, - toHaveState: ((stateKey: string, stateValue?: any) => void) & - ((state: { ... }) => void), - toHaveStyle: ((styleKey: string, styleValue?: any) => void) & - ((style: { ... }) => void), - toHaveTagName(tagName: string): void, - toHaveText(text: string): void, - toHaveValue(value: any): void, - toIncludeText(text: string): void, - toMatchElement( - element: React$Element, - options?: {| ignoreProps?: boolean, verbose?: boolean |} - ): void, - toMatchSelector(selector: string): void, - // 7.x - toHaveDisplayName(name: string): void, - ... -}; - -// DOM testing library extensions (jest-dom) -// https://github.com/testing-library/jest-dom -type DomTestingLibraryType = { - /** - * @deprecated - */ - toBeInTheDOM(container?: HTMLElement): void, - - // 4.x - toBeInTheDocument(): void, - toBeVisible(): void, - toBeEmpty(): void, - toBeDisabled(): void, - toBeEnabled(): void, - toBeInvalid(): void, - toBeRequired(): void, - toBeValid(): void, - toContainElement(element: HTMLElement | null): void, - toContainHTML(htmlText: string): void, - toHaveAttribute(attr: string, value?: any): void, - toHaveClass(...classNames: string[]): void, - toHaveFocus(): void, - toHaveFormValues(expectedValues: { [name: string]: any, ... }): void, - toHaveStyle(css: string | { [name: string]: any, ... }): void, - toHaveTextContent( - text: string | RegExp, - options?: {| normalizeWhitespace: boolean |} - ): void, - toHaveValue(value?: string | string[] | number): void, - - // 5.x - toHaveDisplayValue(value: string | string[]): void, - toBeChecked(): void, - toBeEmptyDOMElement(): void, - toBePartiallyChecked(): void, - toHaveDescription(text: string | RegExp): void, - ... -}; - -// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers -type JestJQueryMatchersType = { - toExist(): void, - toHaveLength(len: number): void, - toHaveId(id: string): void, - toHaveClass(className: string): void, - toHaveTag(tag: string): void, - toHaveAttr(key: string, val?: any): void, - toHaveProp(key: string, val?: any): void, - toHaveText(text: string | RegExp): void, - toHaveData(key: string, val?: any): void, - toHaveValue(val: any): void, - toHaveCss(css: { [key: string]: any, ... }): void, - toBeChecked(): void, - toBeDisabled(): void, - toBeEmpty(): void, - toBeHidden(): void, - toBeSelected(): void, - toBeVisible(): void, - toBeFocused(): void, - toBeInDom(): void, - toBeMatchedBy(sel: string): void, - toHaveDescendant(sel: string): void, - toHaveDescendantWithText(sel: string, text: string | RegExp): void, - ... -}; - -// Jest Extended Matchers: https://github.com/jest-community/jest-extended -type JestExtendedMatchersType = { - /** - * Note: Currently unimplemented - * Passing assertion - * - * @param {String} message - */ - // pass(message: string): void; - - /** - * Note: Currently unimplemented - * Failing assertion - * - * @param {String} message - */ - // fail(message: string): void; - - /** - * Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty. - */ - toBeEmpty(): void, - /** - * Use .toBeOneOf when checking if a value is a member of a given Array. - * @param {Array.<*>} members - */ - toBeOneOf(members: any[]): void, - /** - * Use `.toBeNil` when checking a value is `null` or `undefined`. - */ - toBeNil(): void, - /** - * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`. - * @param {Function} predicate - */ - toSatisfy(predicate: (n: any) => boolean): void, - /** - * Use `.toBeArray` when checking if a value is an `Array`. - */ - toBeArray(): void, - /** - * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x. - * @param {Number} x - */ - toBeArrayOfSize(x: number): void, - /** - * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set. - * @param {Array.<*>} members - */ - toIncludeAllMembers(members: any[]): void, - /** - * Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order. - * @param {Array.<*>} members - */ - toIncludeSameMembers(members: any[]): void, - /** - * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set. - * @param {Array.<*>} members - */ - toIncludeAnyMembers(members: any[]): void, - /** - * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array. - * @param {Function} predicate - */ - toSatisfyAll(predicate: (n: any) => boolean): void, - /** - * Use `.toBeBoolean` when checking if a value is a `Boolean`. - */ - toBeBoolean(): void, - /** - * Use `.toBeTrue` when checking a value is equal (===) to `true`. - */ - toBeTrue(): void, - /** - * Use `.toBeFalse` when checking a value is equal (===) to `false`. - */ - toBeFalse(): void, - /** - * Use .toBeDate when checking if a value is a Date. - */ - toBeDate(): void, - /** - * Use `.toBeFunction` when checking if a value is a `Function`. - */ - toBeFunction(): void, - /** - * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`. - * - * Note: Required Jest version >22 - * Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same - * - * @param {Mock} mock - */ - toHaveBeenCalledBefore(mock: JestMockFn): void, - /** - * Use `.toBeNumber` when checking if a value is a `Number`. - */ - toBeNumber(): void, - /** - * Use `.toBeNaN` when checking a value is `NaN`. - */ - toBeNaN(): void, - /** - * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`. - */ - toBeFinite(): void, - /** - * Use `.toBePositive` when checking if a value is a positive `Number`. - */ - toBePositive(): void, - /** - * Use `.toBeNegative` when checking if a value is a negative `Number`. - */ - toBeNegative(): void, - /** - * Use `.toBeEven` when checking if a value is an even `Number`. - */ - toBeEven(): void, - /** - * Use `.toBeOdd` when checking if a value is an odd `Number`. - */ - toBeOdd(): void, - /** - * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive). - * - * @param {Number} start - * @param {Number} end - */ - toBeWithin(start: number, end: number): void, - /** - * Use `.toBeObject` when checking if a value is an `Object`. - */ - toBeObject(): void, - /** - * Use `.toContainKey` when checking if an object contains the provided key. - * - * @param {String} key - */ - toContainKey(key: string): void, - /** - * Use `.toContainKeys` when checking if an object has all of the provided keys. - * - * @param {Array.} keys - */ - toContainKeys(keys: string[]): void, - /** - * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys. - * - * @param {Array.} keys - */ - toContainAllKeys(keys: string[]): void, - /** - * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys. - * - * @param {Array.} keys - */ - toContainAnyKeys(keys: string[]): void, - /** - * Use `.toContainValue` when checking if an object contains the provided value. - * - * @param {*} value - */ - toContainValue(value: any): void, - /** - * Use `.toContainValues` when checking if an object contains all of the provided values. - * - * @param {Array.<*>} values - */ - toContainValues(values: any[]): void, - /** - * Use `.toContainAllValues` when checking if an object only contains all of the provided values. - * - * @param {Array.<*>} values - */ - toContainAllValues(values: any[]): void, - /** - * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values. - * - * @param {Array.<*>} values - */ - toContainAnyValues(values: any[]): void, - /** - * Use `.toContainEntry` when checking if an object contains the provided entry. - * - * @param {Array.} entry - */ - toContainEntry(entry: [string, string]): void, - /** - * Use `.toContainEntries` when checking if an object contains all of the provided entries. - * - * @param {Array.>} entries - */ - toContainEntries(entries: [string, string][]): void, - /** - * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries. - * - * @param {Array.>} entries - */ - toContainAllEntries(entries: [string, string][]): void, - /** - * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries. - * - * @param {Array.>} entries - */ - toContainAnyEntries(entries: [string, string][]): void, - /** - * Use `.toBeExtensible` when checking if an object is extensible. - */ - toBeExtensible(): void, - /** - * Use `.toBeFrozen` when checking if an object is frozen. - */ - toBeFrozen(): void, - /** - * Use `.toBeSealed` when checking if an object is sealed. - */ - toBeSealed(): void, - /** - * Use `.toBeString` when checking if a value is a `String`. - */ - toBeString(): void, - /** - * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings. - * - * @param {String} string - */ - toEqualCaseInsensitive(string: string): void, - /** - * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix. - * - * @param {String} prefix - */ - toStartWith(prefix: string): void, - /** - * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix. - * - * @param {String} suffix - */ - toEndWith(suffix: string): void, - /** - * Use `.toInclude` when checking if a `String` includes the given `String` substring. - * - * @param {String} substring - */ - toInclude(substring: string): void, - /** - * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times. - * - * @param {String} substring - * @param {Number} times - */ - toIncludeRepeated(substring: string, times: number): void, - /** - * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings. - * - * @param {Array.} substring - */ - toIncludeMultiple(substring: string[]): void, - ... -}; - -// Diffing snapshot utility for Jest (snapshot-diff) -// https://github.com/jest-community/snapshot-diff -type SnapshotDiffType = { - /** - * Compare the difference between the actual in the `expect()` - * vs the object inside `valueB` with some extra options. - */ - toMatchDiffSnapshot( - valueB: any, - options?: {| - expand?: boolean, - colors?: boolean, - contextLines?: number, - stablePatchmarks?: boolean, - aAnnotation?: string, - bAnnotation?: string, - |}, - testName?: string - ): void, - ... -}; - -interface JestExpectType { - not: JestExpectType & - EnzymeMatchersType & - DomTestingLibraryType & - JestJQueryMatchersType & - JestStyledComponentsMatchersType & - JestExtendedMatchersType & - SnapshotDiffType; - /** - * If you have a mock function, you can use .lastCalledWith to test what - * arguments it was last called with. - */ - lastCalledWith(...args: Array): void; - /** - * toBe just checks that a value is what you expect. It uses === to check - * strict equality. - */ - toBe(value: any): void; - /** - * Use .toBeCalledWith to ensure that a mock function was called with - * specific arguments. - */ - toBeCalledWith(...args: Array): void; - /** - * Using exact equality with floating point numbers is a bad idea. Rounding - * means that intuitive things fail. - */ - toBeCloseTo(num: number, delta: any): void; - /** - * Use .toBeDefined to check that a variable is not undefined. - */ - toBeDefined(): void; - /** - * Use .toBeFalsy when you don't care what a value is, you just want to - * ensure a value is false in a boolean context. - */ - toBeFalsy(): void; - /** - * To compare floating point numbers, you can use toBeGreaterThan. - */ - toBeGreaterThan(number: number): void; - /** - * To compare floating point numbers, you can use toBeGreaterThanOrEqual. - */ - toBeGreaterThanOrEqual(number: number): void; - /** - * To compare floating point numbers, you can use toBeLessThan. - */ - toBeLessThan(number: number): void; - /** - * To compare floating point numbers, you can use toBeLessThanOrEqual. - */ - toBeLessThanOrEqual(number: number): void; - /** - * Use .toBeInstanceOf(Class) to check that an object is an instance of a - * class. - */ - toBeInstanceOf(cls: Class<*>): void; - /** - * .toBeNull() is the same as .toBe(null) but the error messages are a bit - * nicer. - */ - toBeNull(): void; - /** - * Use .toBeTruthy when you don't care what a value is, you just want to - * ensure a value is true in a boolean context. - */ - toBeTruthy(): void; - /** - * Use .toBeUndefined to check that a variable is undefined. - */ - toBeUndefined(): void; - /** - * Use .toContain when you want to check that an item is in a list. For - * testing the items in the list, this uses ===, a strict equality check. - */ - toContain(item: any): void; - /** - * Use .toContainEqual when you want to check that an item is in a list. For - * testing the items in the list, this matcher recursively checks the - * equality of all fields, rather than checking for object identity. - */ - toContainEqual(item: any): void; - /** - * Use .toEqual when you want to check that two objects have the same value. - * This matcher recursively checks the equality of all fields, rather than - * checking for object identity. - */ - toEqual(value: any): void; - /** - * Use .toHaveBeenCalled to ensure that a mock function got called. - */ - toHaveBeenCalled(): void; - toBeCalled(): void; - /** - * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact - * number of times. - */ - toHaveBeenCalledTimes(number: number): void; - toBeCalledTimes(number: number): void; - /** - * - */ - toHaveBeenNthCalledWith(nthCall: number, ...args: Array): void; - nthCalledWith(nthCall: number, ...args: Array): void; - /** - * - */ - toHaveReturned(): void; - toReturn(): void; - /** - * - */ - toHaveReturnedTimes(number: number): void; - toReturnTimes(number: number): void; - /** - * - */ - toHaveReturnedWith(value: any): void; - toReturnWith(value: any): void; - /** - * - */ - toHaveLastReturnedWith(value: any): void; - lastReturnedWith(value: any): void; - /** - * - */ - toHaveNthReturnedWith(nthCall: number, value: any): void; - nthReturnedWith(nthCall: number, value: any): void; - /** - * Use .toHaveBeenCalledWith to ensure that a mock function was called with - * specific arguments. - */ - toHaveBeenCalledWith(...args: Array): void; - toBeCalledWith(...args: Array): void; - /** - * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called - * with specific arguments. - */ - toHaveBeenLastCalledWith(...args: Array): void; - lastCalledWith(...args: Array): void; - /** - * Check that an object has a .length property and it is set to a certain - * numeric value. - */ - toHaveLength(number: number): void; - /** - * - */ - toHaveProperty(propPath: string | $ReadOnlyArray, value?: any): void; - /** - * Use .toMatch to check that a string matches a regular expression or string. - */ - toMatch(regexpOrString: RegExp | string): void; - /** - * Use .toMatchObject to check that a javascript object matches a subset of the properties of an object. - */ - toMatchObject(object: Object | Array): void; - /** - * Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object. - */ - toStrictEqual(value: any): void; - /** - * This ensures that an Object matches the most recent snapshot. - */ - toMatchSnapshot(propertyMatchers?: any, name?: string): void; - /** - * This ensures that an Object matches the most recent snapshot. - */ - toMatchSnapshot(name: string): void; - - toMatchInlineSnapshot(snapshot?: string): void; - toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void; - /** - * Use .toThrow to test that a function throws when it is called. - * If you want to test that a specific error gets thrown, you can provide an - * argument to toThrow. The argument can be a string for the error message, - * a class for the error, or a regex that should match the error. - * - * Alias: .toThrowError - */ - toThrow(message?: string | Error | Class | RegExp): void; - toThrowError(message?: string | Error | Class | RegExp): void; - /** - * Use .toThrowErrorMatchingSnapshot to test that a function throws a error - * matching the most recent snapshot when it is called. - */ - toThrowErrorMatchingSnapshot(): void; - toThrowErrorMatchingInlineSnapshot(snapshot?: string): void; -} - -type JestObjectType = { - /** - * Disables automatic mocking in the module loader. - * - * After this method is called, all `require()`s will return the real - * versions of each module (rather than a mocked version). - */ - disableAutomock(): JestObjectType, - /** - * An un-hoisted version of disableAutomock - */ - autoMockOff(): JestObjectType, - /** - * Enables automatic mocking in the module loader. - */ - enableAutomock(): JestObjectType, - /** - * An un-hoisted version of enableAutomock - */ - autoMockOn(): JestObjectType, - /** - * Clears the mock.calls and mock.instances properties of all mocks. - * Equivalent to calling .mockClear() on every mocked function. - */ - clearAllMocks(): JestObjectType, - /** - * Resets the state of all mocks. Equivalent to calling .mockReset() on every - * mocked function. - */ - resetAllMocks(): JestObjectType, - /** - * Restores all mocks back to their original value. - */ - restoreAllMocks(): JestObjectType, - /** - * Removes any pending timers from the timer system. - */ - clearAllTimers(): void, - /** - * Returns the number of fake timers still left to run. - */ - getTimerCount(): number, - /** - * Set the current system time used by fake timers. - * Simulates a user changing the system clock while your program is running. - * It affects the current time but it does not in itself cause - * e.g. timers to fire; they will fire exactly as they would have done - * without the call to jest.setSystemTime(). - */ - setSystemTime(now?: number | Date): void, - /** - * The same as `mock` but not moved to the top of the expectation by - * babel-jest. - */ - doMock(moduleName: string, moduleFactory?: any): JestObjectType, - /** - * The same as `unmock` but not moved to the top of the expectation by - * babel-jest. - */ - dontMock(moduleName: string): JestObjectType, - /** - * Returns a new, unused mock function. Optionally takes a mock - * implementation. - */ - fn, TReturn>( - implementation?: (...args: TArguments) => TReturn - ): JestMockFn, - /** - * Determines if the given function is a mocked function. - */ - isMockFunction(fn: Function): boolean, - /** - * Alias of `createMockFromModule`. - */ - genMockFromModule(moduleName: string): any, - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - */ - createMockFromModule(moduleName: string): any, - /** - * Mocks a module with an auto-mocked version when it is being required. - * - * The second argument can be used to specify an explicit module factory that - * is being run instead of using Jest's automocking feature. - * - * The third argument can be used to create virtual mocks -- mocks of modules - * that don't exist anywhere in the system. - */ - mock( - moduleName: string, - moduleFactory?: any, - options?: Object - ): JestObjectType, - /** - * Returns the actual module instead of a mock, bypassing all checks on - * whether the module should receive a mock implementation or not. - */ - requireActual(m: $Flow$ModuleRef | string): T, - /** - * Returns a mock module instead of the actual module, bypassing all checks - * on whether the module should be required normally or not. - */ - requireMock(moduleName: string): any, - /** - * Resets the module registry - the cache of all required modules. This is - * useful to isolate modules where local state might conflict between tests. - */ - resetModules(): JestObjectType, - /** - * Creates a sandbox registry for the modules that are loaded inside the - * callback function. This is useful to isolate specific modules for every - * test so that local module state doesn't conflict between tests. - */ - isolateModules(fn: () => void): JestObjectType, - /** - * Exhausts the micro-task queue (usually interfaced in node via - * process.nextTick). - */ - runAllTicks(): void, - /** - * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(), - * setInterval(), and setImmediate()). - */ - runAllTimers(): void, - /** - * Exhausts all tasks queued by setImmediate(). - */ - runAllImmediates(): void, - /** - * Executes only the macro task queue (i.e. all tasks queued by setTimeout() - * or setInterval() and setImmediate()). - */ - advanceTimersByTime(msToRun: number): void, - /** - * Executes only the macro-tasks that are currently pending (i.e., only the - * tasks that have been queued by setTimeout() or setInterval() up to this - * point) - */ - runOnlyPendingTimers(): void, - /** - * Explicitly supplies the mock object that the module system should return - * for the specified module. Note: It is recommended to use jest.mock() - * instead. - */ - setMock(moduleName: string, moduleExports: any): JestObjectType, - /** - * Indicates that the module system should never return a mocked version of - * the specified module from require() (e.g. that it should always return the - * real module). - */ - unmock(moduleName: string): JestObjectType, - /** - * Instructs Jest to use fake versions of the standard timer functions - * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick, - * setImmediate and clearImmediate). - */ - useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType, - /** - * Instructs Jest to use the real versions of the standard timer functions. - */ - useRealTimers(): JestObjectType, - /** - * Creates a mock function similar to jest.fn but also tracks calls to - * object[methodName]. - */ - spyOn( - object: Object, - methodName: string, - accessType?: 'get' | 'set' - ): JestMockFn, - /** - * Set the default timeout interval for tests and before/after hooks in milliseconds. - * Note: The default timeout interval is 5 seconds if this method is not called. - */ - setTimeout(timeout: number): JestObjectType, - ... -}; - -type JestSpyType = { calls: JestCallsType, ... }; - -type JestDoneFn = {| - (error?: Error): void, - fail: (error: Error) => void, -|}; - -/** Runs this function after every test inside this context */ -declare function afterEach( - fn: (done: JestDoneFn) => ?Promise, - timeout?: number -): void; -/** Runs this function before every test inside this context */ -declare function beforeEach( - fn: (done: JestDoneFn) => ?Promise, - timeout?: number -): void; -/** Runs this function after all tests have finished inside this context */ -declare function afterAll( - fn: (done: JestDoneFn) => ?Promise, - timeout?: number -): void; -/** Runs this function before any tests have started inside this context */ -declare function beforeAll( - fn: (done: JestDoneFn) => ?Promise, - timeout?: number -): void; - -/** A context for grouping tests together */ -declare var describe: { - /** - * Creates a block that groups together several related tests in one "test suite" - */ - (name: JestTestName, fn: () => void): void, - /** - * Only run this describe block - */ - only(name: JestTestName, fn: () => void): void, - /** - * Skip running this describe block - */ - skip(name: JestTestName, fn: () => void): void, - /** - * each runs this test against array of argument arrays per each run - * - * @param {table} table of Test - */ - each( - ...table: Array | mixed> | [Array, string] - ): ( - name: JestTestName, - fn?: (...args: Array) => ?Promise, - timeout?: number - ) => void, - ... -}; - -/** An individual test unit */ -declare var it: { - /** - * An individual test unit - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - ( - name: JestTestName, - fn?: (done: JestDoneFn) => ?Promise, - timeout?: number - ): void, - /** - * Only run this test - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - only: {| - ( - name: JestTestName, - fn?: (done: JestDoneFn) => ?Promise, - timeout?: number - ): void, - each( - ...table: Array | mixed> | [Array, string] - ): ( - name: JestTestName, - fn?: (...args: Array) => ?Promise, - timeout?: number - ) => void, - |}, - /** - * Skip running this test - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - skip: {| - ( - name: JestTestName, - fn?: (done: JestDoneFn) => ?Promise, - timeout?: number - ): void, - each( - ...table: Array | mixed> | [Array, string] - ): ( - name: JestTestName, - fn?: (...args: Array) => ?Promise, - timeout?: number - ) => void, - |}, - /** - * Highlight planned tests in the summary output - * - * @param {String} Name of Test to do - */ - todo(name: string): void, - /** - * Run the test concurrently - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - concurrent( - name: JestTestName, - fn?: (done: JestDoneFn) => ?Promise, - timeout?: number - ): void, - /** - * each runs this test against array of argument arrays per each run - * - * @param {table} table of Test - */ - each( - ...table: Array | mixed> | [Array, string] - ): ( - name: JestTestName, - fn?: (...args: Array) => ?Promise, - timeout?: number - ) => void, - ... -}; - -declare function fit( - name: JestTestName, - fn: (done: JestDoneFn) => ?Promise, - timeout?: number -): void; -/** An individual test unit */ -declare var test: typeof it; -/** A disabled group of tests */ -declare var xdescribe: typeof describe; -/** A focused group of tests */ -declare var fdescribe: typeof describe; -/** A disabled individual test */ -declare var xit: typeof it; -/** A disabled individual test */ -declare var xtest: typeof it; - -type JestPrettyFormatColors = { - comment: { - close: string, - open: string, - ... - }, - content: { - close: string, - open: string, - ... - }, - prop: { - close: string, - open: string, - ... - }, - tag: { - close: string, - open: string, - ... - }, - value: { - close: string, - open: string, - ... - }, - ... -}; - -type JestPrettyFormatIndent = (string) => string; -type JestPrettyFormatRefs = Array; -type JestPrettyFormatPrint = (any) => string; -type JestPrettyFormatStringOrNull = string | null; - -type JestPrettyFormatOptions = {| - callToJSON: boolean, - edgeSpacing: string, - escapeRegex: boolean, - highlight: boolean, - indent: number, - maxDepth: number, - min: boolean, - plugins: JestPrettyFormatPlugins, - printFunctionName: boolean, - spacing: string, - theme: {| - comment: string, - content: string, - prop: string, - tag: string, - value: string, - |}, -|}; - -type JestPrettyFormatPlugin = { - print: ( - val: any, - serialize: JestPrettyFormatPrint, - indent: JestPrettyFormatIndent, - opts: JestPrettyFormatOptions, - colors: JestPrettyFormatColors - ) => string, - test: (any) => boolean, - ... -}; - -type JestPrettyFormatPlugins = Array; - -/** The expect function is used every time you want to test a value */ -declare var expect: { - /** The object that you want to make assertions against */ - ( - value: any - ): JestExpectType & - JestPromiseType & - EnzymeMatchersType & - DomTestingLibraryType & - JestJQueryMatchersType & - JestStyledComponentsMatchersType & - JestExtendedMatchersType & - SnapshotDiffType, - /** Add additional Jasmine matchers to Jest's roster */ - extend(matchers: { [name: string]: JestMatcher, ... }): void, - /** Add a module that formats application-specific data structures. */ - addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void, - assertions(expectedAssertions: number): void, - hasAssertions(): void, - any(value: mixed): JestAsymmetricEqualityType, - anything(): any, - arrayContaining(value: Array): Array, - objectContaining(value: Object): Object, - /** Matches any received string that contains the exact expected string. */ - stringContaining(value: string): string, - stringMatching(value: string | RegExp): string, - not: { - arrayContaining: (value: $ReadOnlyArray) => Array, - objectContaining: (value: { ... }) => Object, - stringContaining: (value: string) => string, - stringMatching: (value: string | RegExp) => string, - ... - }, - ... -}; - -// TODO handle return type -// http://jasmine.github.io/2.4/introduction.html#section-Spies -declare function spyOn(value: mixed, method: string): Object; - -/** Holds all functions related to manipulating test runner */ -declare var jest: JestObjectType; - -/** - * The global Jasmine object, this is generally not exposed as the public API, - * using features inside here could break in later versions of Jest. - */ -declare var jasmine: { - DEFAULT_TIMEOUT_INTERVAL: number, - any(value: mixed): JestAsymmetricEqualityType, - anything(): any, - arrayContaining(value: Array): Array, - clock(): JestClockType, - createSpy(name: string): JestSpyType, - createSpyObj( - baseName: string, - methodNames: Array - ): { [methodName: string]: JestSpyType, ... }, - objectContaining(value: Object): Object, - stringMatching(value: string): string, - ... -}; diff --git a/flow-typed/npm/jsdom.js b/flow-typed/npm/jsdom.js deleted file mode 100644 index 87f967fe..00000000 --- a/flow-typed/npm/jsdom.js +++ /dev/null @@ -1,339 +0,0 @@ -// flow-typed signature: 6393943152251b303dd7a2ad2a2fff94 -// flow-typed version: <>/jsdom_v15.1.1/flow_v0.108.0 -declare module "jsdom" { - declare type parse5$ElementLocation = $FlowFixMe; - declare class tough$CookieJar { - /* TODO */ - } - - declare class jsdom$JSDOM { - static fromURL( - url: string, - options?: jsdom$FromUrlOptions, - ): Promise; - static fromFile( - url: string, - options?: jsdom$FromFileOptions, - ): Promise; - static fragment(html: string): DocumentFragment; - constructor( - html?: string | Buffer | jsdom$BinaryData, - options?: jsdom$ConstructorOptions, - ): this; - +window: jsdom$DOMWindow; - +virtualConsole: jsdom$VirtualConsole; - +cookieJar: jsdom$CookieJar; - - /** - * The serialize() method will return the HTML serialization of the document, including the doctype. - */ - serialize(): string; - - /** - * The nodeLocation() method will find where a DOM node is within the source document, returning the parse5 location info for the node. - */ - nodeLocation(node: Node): parse5$ElementLocation | null; - - /** - * The built-in vm module of Node.js allows you to create Script instances, - * which can be compiled ahead of time and then run multiple times on a - * given "VM context". - * To get access to this ability, use the getInternalVMContext() method. - */ - getInternalVMContext(): vm$Context; - reconfigure(settings: jsdom$ReconfigureSettings): void; - } - - declare interface jsdom$Options { - /** - * referrer just affects the value read from document.referrer. - * It defaults to no referrer (which reflects as the empty string). - */ - referrer?: string; - - /** - * userAgent affects the value read from navigator.userAgent, as well as the User-Agent header sent while fetching subresources. - * It defaults to `Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}`. - */ - userAgent?: string; - - /** - * includeNodeLocations preserves the location info produced by the HTML parser, - * allowing you to retrieve it with the nodeLocation() method (described below). - * It defaults to false to give the best performance, - * and cannot be used with an XML content type since our XML parser does not support location info. - */ - includeNodeLocations?: boolean; - runScripts?: "dangerously" | "outside-only"; - resources?: "usable" | jsdom$ResourceLoader; - virtualConsole?: jsdom$VirtualConsole; - cookieJar?: jsdom$CookieJar; - - /** - * jsdom does not have the capability to render visual content, and will act like a headless browser by default. - * It provides hints to web pages through APIs such as document.hidden that their content is not visible. - * - * When the pretendToBeVisual option is set to true, jsdom will pretend that it is rendering and displaying - * content. - */ - pretendToBeVisual?: boolean; - beforeParse?: (window: jsdom$DOMWindow) => void; - } - - declare type jsdom$FromUrlOptions = jsdom$Options; - declare type jsdom$FromFileOptions = jsdom$Options & { - /** - * url sets the value returned by window.location, document.URL, and document.documentURI, - * and affects things like resolution of relative URLs within the document - * and the same-origin restrictions and referrer used while fetching subresources. - * It will default to a file URL corresponding to the given filename, instead of to "about:blank". - */ - url?: string, - - /** - * contentType affects the value read from document.contentType, and how the document is parsed: as HTML or as XML. - * Values that are not "text/html" or an XML mime type will throw. It will default to "application/xhtml+xml" if - * the given filename ends in .xhtml or .xml; otherwise it will continue to default to "text/html". - */ - contentType?: string, - ... - }; - - declare type jsdom$ConstructorOptions = jsdom$Options & { - /** - * url sets the value returned by window.location, document.URL, and document.documentURI, - * and affects things like resolution of relative URLs within the document - * and the same-origin restrictions and referrer used while fetching subresources. - * It defaults to "about:blank". - */ - url?: string, - - /** - * contentType affects the value read from document.contentType, and how the document is parsed: as HTML or as XML. - * Values that are not "text/html" or an XML mime type will throw. It defaults to "text/html". - */ - contentType?: string, - - /** - * The maximum size in code units for the separate storage areas used by localStorage and sessionStorage. - * Attempts to store data larger than this limit will cause a DOMException to be thrown. By default, it is set - * to 5,000,000 code units per origin, as inspired by the HTML specification. - */ - storageQuota?: number, - ... - }; - - declare type jsdom$DOMWindow = { - eval(script: string): void, - DOMException: typeof Error, // DOMException type not found - Attr: typeof Attr, - Node: typeof Node, - Element: typeof Element, - DocumentFragment: typeof DocumentFragment, - Document: typeof Document, - HTMLDocument: typeof HTMLElement, // HTMLDocument type not found - XMLDocument: $FlowFixMe, // XMLDocument not resolved, - CharacterData: typeof CharacterData, - Text: typeof Text, - CDATASection: $FlowFixMe, // CDATASection not resolved, - ProcessingInstruction: $FlowFixMe, - Comment: typeof Comment, - DocumentType: typeof DocumentType, - DOMImplementation: typeof DOMImplementation, - NodeList: typeof NodeList, - HTMLCollection: typeof HTMLCollection, - HTMLOptionsCollection: typeof HTMLOptionsCollection, - DOMStringMap: typeof DOMStringMap, - DOMTokenList: typeof DOMTokenList, - Event: typeof Event, - CustomEvent: typeof CustomEvent, - MessageEvent: typeof MessageEvent, - ErrorEvent: typeof ErrorEvent, - HashChangeEvent: typeof Event, // HashChangeEvent not resolved - FocusEvent: typeof FocusEvent, - PopStateEvent: typeof Event, // PopStateEvent not resolved - UIEvent: typeof UIEvent, - MouseEvent: typeof MouseEvent, - KeyboardEvent: typeof KeyboardEvent, - TouchEvent: typeof TouchEvent, - ProgressEvent: typeof ProgressEvent, - CompositionEvent: typeof Event, // CompositionEvent not resolved, - WheelEvent: typeof WheelEvent, - EventTarget: typeof EventTarget, - Location: typeof Location, - History: typeof History, - Blob: typeof Blob, - File: typeof File, - FileList: typeof FileList, - DOMParser: typeof DOMParser, - FormData: typeof FormData, - XMLHttpRequestEventTarget: XMLHttpRequestEventTarget, - XMLHttpRequestUpload: $FlowFixMe, // XMLHttpRequestUpload not resolved, - NodeIterator: typeof NodeIterator, - TreeWalker: typeof TreeWalker, - NamedNodeMap: typeof NamedNodeMap, - URL: typeof URL, - URLSearchParams: typeof URLSearchParams, - HTMLElement: typeof HTMLElement, - HTMLAnchorElement: typeof HTMLAnchorElement, - HTMLAppletElement: typeof HTMLAppletElement, - HTMLAreaElement: typeof HTMLAreaElement, - HTMLAudioElement: typeof HTMLAudioElement, - HTMLBaseElement: typeof HTMLBaseElement, - HTMLBodyElement: typeof HTMLBodyElement, - HTMLBRElement: typeof HTMLBRElement, - HTMLButtonElement: typeof HTMLButtonElement, - HTMLCanvasElement: typeof HTMLCanvasElement, - HTMLDataElement: typeof HTMLDataElement, - HTMLDataListElement: typeof HTMLDataListElement, - HTMLDirectoryElement: typeof HTMLElement, // HTMLDirectoryElement not resolved - HTMLDivElement: typeof HTMLDivElement, - HTMLDListElement: typeof HTMLDListElement, - HTMLEmbedElement: typeof HTMLEmbedElement, - HTMLFieldSetElement: typeof HTMLFieldSetElement, - HTMLFontElement: typeof HTMLElement, // HTMLFontElement not resolved - HTMLFormElement: typeof HTMLFormElement, - HTMLFrameElement: typeof HTMLElement, // HTMLFrameElement not resolved - HTMLFrameSetElement: typeof HTMLElement, // HTMLFrameSetElement not resolved - HTMLHeadingElement: typeof HTMLHeadingElement, - HTMLHeadElement: typeof HTMLHeadElement, - HTMLHRElement: typeof HTMLHRElement, - HTMLHtmlElement: typeof HTMLHtmlElement, - HTMLIFrameElement: typeof HTMLIFrameElement, - HTMLImageElement: typeof HTMLImageElement, - HTMLInputElement: typeof HTMLInputElement, - HTMLLabelElement: typeof HTMLLabelElement, - HTMLLegendElement: typeof HTMLLegendElement, - HTMLLIElement: typeof HTMLLIElement, - HTMLLinkElement: typeof HTMLLinkElement, - HTMLMapElement: typeof HTMLMapElement, - HTMLMarqueeElement: typeof HTMLElement, // HTMLMarqueeElement type not found - HTMLMediaElement: typeof HTMLMediaElement, - HTMLMenuElement: typeof HTMLMenuElement, - HTMLMetaElement: typeof HTMLMetaElement, - HTMLMeterElement: typeof HTMLMeterElement, - HTMLModElement: typeof HTMLModElement, - HTMLObjectElement: typeof HTMLObjectElement, - HTMLOListElement: typeof HTMLOListElement, - HTMLOptGroupElement: typeof HTMLOptGroupElement, - HTMLOptionElement: typeof HTMLOptionElement, - HTMLOutputElement: typeof HTMLOutputElement, - HTMLParagraphElement: typeof HTMLParagraphElement, - HTMLParamElement: typeof HTMLParamElement, - HTMLPictureElement: typeof HTMLPictureElement, - HTMLPreElement: typeof HTMLPreElement, - HTMLProgressElement: typeof HTMLProgressElement, - HTMLQuoteElement: typeof HTMLQuoteElement, - HTMLScriptElement: typeof HTMLScriptElement, - HTMLSelectElement: typeof HTMLSelectElement, - HTMLSourceElement: typeof HTMLSourceElement, - HTMLSpanElement: typeof HTMLSpanElement, - HTMLStyleElement: typeof HTMLStyleElement, - HTMLTableCaptionElement: typeof HTMLTableCaptionElement, - HTMLTableCellElement: typeof HTMLTableCellElement, - HTMLTableColElement: typeof HTMLTableColElement, - HTMLTableElement: typeof HTMLTableElement, - HTMLTimeElement: typeof HTMLTimeElement, - HTMLTitleElement: typeof HTMLTitleElement, - HTMLTableRowElement: typeof HTMLTableRowElement, - HTMLTableSectionElement: typeof HTMLTableSectionElement, - HTMLTemplateElement: typeof HTMLTemplateElement, - HTMLTextAreaElement: typeof HTMLTextAreaElement, - HTMLTrackElement: typeof HTMLTrackElement, - HTMLUListElement: typeof HTMLUListElement, - HTMLUnknownElement: typeof HTMLUnknownElement, - HTMLVideoElement: typeof HTMLVideoElement, - StyleSheet: typeof StyleSheet, - MediaList: typeof MediaList, - CSSStyleSheet: typeof CSSStyleSheet, - CSSRule: typeof CSSRule, - CSSStyleRule: typeof CSSStyleRule, - CSSMediaRule: typeof CSSMediaRule, - CSSImportRule: $FlowFixMe, // CSSImportRule type not found - CSSStyleDeclaration: typeof CSSStyleDeclaration, - StyleSheetList: typeof StyleSheetList, - XPathExpression: $FlowFixMe, // XPathExpression type not found - XPathResult: $FlowFixMe, // XPathResult type not found - XPathEvaluator: $FlowFixMe, // XPathEvaluator type not found - NodeFilter: typeof NodeFilter, - close: () => void, - [key: string]: mixed, - ... - }; - - declare type jsdom$BinaryData = - | ArrayBuffer - | DataView - | Int8Array - | Uint8Array - | Uint8ClampedArray - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | Float32Array - | Float64Array; - - declare class jsdom$VirtualConsole mixins events$EventEmitter { - on>( - method: K | string, - callback: $ElementType, - ): this; - on(event: "jsdomError" | string, callback: (e: Error) => void): this; - sendTo( - console: typeof console, - options?: jsdom$VirtualConsoleSendToOptions, - ): this; - } - - declare interface jsdom$VirtualConsoleSendToOptions { - omitJSDOMErrors: boolean; - } - - declare class jsdom$CookieJar extends tough$CookieJar {} - - declare interface jsdom$ReconfigureSettings { - windowTop?: jsdom$DOMWindow; - url?: string; - } - - declare interface jsdom$FetchOptions { - cookieJar?: jsdom$CookieJar; - referrer?: string; - accept?: string; - element?: - | HTMLScriptElement - | HTMLLinkElement - | HTMLIFrameElement - | HTMLImageElement; - } - - declare interface jsdom$ResourceLoaderConstructorOptions { - strictSSL?: boolean; - proxy?: string; - userAgent?: string; - } - - declare class jsdom$ResourceLoader { - constructor(obj?: jsdom$ResourceLoaderConstructorOptions): this; - fetch(url: string, options?: jsdom$FetchOptions): ?Promise; - } - - declare type Options = jsdom$Options; - declare type FromUrlOptions = jsdom$FromUrlOptions; - declare type FromFileOptions = jsdom$FromFileOptions; - declare type ConstructorOptons = jsdom$ConstructorOptions; - declare type DOMWindow = jsdom$DOMWindow; - declare type BinaryData = jsdom$BinaryData; - declare type VirtualConsoleSendToOptions = jsdom$VirtualConsoleSendToOptions; - declare type ReconfigureSettings = jsdom$ReconfigureSettings; - declare type FetchOptions = jsdom$FetchOptions; - declare type ResourceLoaderConstructorOptions = jsdom$ResourceLoaderConstructorOptions; - - declare module.exports: { - JSDOM: typeof jsdom$JSDOM, - VirtualConsole: typeof jsdom$VirtualConsole, - CookieJar: typeof jsdom$CookieJar, - ResourceLoader: typeof jsdom$ResourceLoader, - }; -} diff --git a/flow-typed/npm/pofile_vx.x.x.js b/flow-typed/npm/pofile_vx.x.x.js deleted file mode 100644 index 99687b98..00000000 --- a/flow-typed/npm/pofile_vx.x.x.js +++ /dev/null @@ -1,32 +0,0 @@ -// flow-typed signature: 84d55d6280cf84b85f433cf6a68de28e -// flow-typed version: <>/pofile_v1.1.1/flow_v0.176.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'pofile' - * - * Fill this stub out by replacing all the `any` types. - * - * Once filled out, we encourage you to share your work with the - * community by sending a pull request to: - * https://github.com/flowtype/flow-typed - */ - -declare module 'pofile' { - declare module.exports: any; -} - -/** - * We include stubs for each file inside this npm package in case you need to - * require those files directly. Feel free to delete any files that aren't - * needed. - */ -declare module 'pofile/lib/po' { - declare module.exports: any; -} - -// Filename aliases -declare module 'pofile/lib/po.js' { - declare module.exports: $Exports<'pofile/lib/po'>; -} diff --git a/flow-typed/npm/winston_v3.x.x.js b/flow-typed/npm/winston_v3.x.x.js deleted file mode 100644 index 08d835bf..00000000 --- a/flow-typed/npm/winston_v3.x.x.js +++ /dev/null @@ -1,210 +0,0 @@ -// flow-typed signature: d56cab49bad56753d465920aa087ed8a -// flow-typed version: c6154227d1/winston_v3.x.x/flow_>=v0.104.x - -declare type $winstonLevels = {[string]: number, ...}; - -// KA> Made exact (fixed a lot of errors when reaching Flow 0.142.0) -declare type $winstonNpmLogLevels = {| - error: number, - warn: number, - info: number, - verbose: number, - debug: number, - silly: number, -|}; -// KA< - -declare type $winstonInfo = { - [optionName: string]: any, - level: $Keys, - message: string, - ... -}; - -declare type $winstonFormat = {...}; - -declare type $winstonFileTransportConfig = { - filename: string, - level?: $Keys, - ... -}; - -declare interface $winstonTransport { - level?: string; - silent?: boolean; -} - -declare class $winstonFileTransport implements $winstonTransport { - constructor($winstonFileTransportConfig): $winstonFileTransport; -} - -declare type $winstonConsoleTransportConfig = { - level?: $Keys, - ... -}; - -declare class $winstonConsoleTransport implements $winstonTransport { - constructor( - config?: $winstonConsoleTransportConfig, - ): $winstonConsoleTransport; -} - -// Start: https://github.com/Khan/react-render-server/pull/20 -declare type $winstonStreamTransportConfig = { - level?: $Keys, - stream: stream$Writable, - eol?: string, - ... -}; - -declare class $winstonStreamTransport implements $winstonTransport { - constructor( - config?: $winstonStreamTransportConfig, - ): $winstonStreamTransport; -} -// End: https://github.com/Khan/react-render-server/pull/20 - -// Start: https://github.com/Khan/react-render-server/pull/21 -declare type $winstonProfiler = { - logger: $winstonLogger, - start: Date, - done(info?: $winstonInfo): boolean, -}; -// End: https://github.com/Khan/react-render-server/pull/21 - -declare type $winstonLoggerConfig = { - exitOnError?: boolean, - format?: $winstonFormat, - level?: $Keys, - levels?: T, - transports?: $winstonTransport | Array<$winstonTransport>, - // Start: https://github.com/Khan/render-gateway/pull/223 - defaultMeta?: any, - // End: https://github.com/Khan/render-gateway/pull/223 - ... -}; - -declare type $winstonLogger = { - // Start: https://github.com/Khan/render-gateway/pull/196 - [$Keys]: ( - message: string, - metaOrCallback?: Object | (() => void), - callback?: () => void, - ) => void, - // End: https://github.com/Khan/render-gateway/pull/196 - add: ($winstonTransport) => void, - clear: () => void, - child: (defaultRequestMetadata: any) => $winstonLogger, - configure: ($winstonLoggerConfig) => void, - log: (message: $winstonInfo) => void, - remove: ($winstonTransport) => void, - // Start: https://github.com/Khan/react-render-server/pull/21 - startTimer: () => $winstonProfiler, - // End: https://github.com/Khan/react-render-server/pull/21 - // Start: https://github.com/Khan/render-gateway/pull/223 - defaultMeta?: any, - // End: https://github.com/Khan/render-gateway/pull/223 - ... -}; - -declare type $winstonConfigSubModule = {npm: () => $winstonNpmLogLevels, ...}; - -declare type $winstonFormatJsonOptions = { - replacer?: (key: string, value: any) => any, - space?: number, - stable?: boolean, - ... -}; - -// Start: https://github.com/Khan/react-render-server/pull/20 -declare type $winstonFormatPrintPrintOptions = { - depth?: number, - colorize?: boolean, - ... -}; - -declare type $winstonFormatCliOptions = {...}; -// End: https://github.com/Khan/react-render-server/pull/20 - -declare type $winstonFormatSubModule = { - ((info: Object) => Object): () => $winstonFormat, - // Start: https://github.com/Khan/react-render-server/pull/20 - cli: (options?: $winstonFormatCliOptions) => $winstonFormat, - // End: https://github.com/Khan/react-render-server/pull/20 - combine: (...args: Array<$winstonFormat>) => $winstonFormat, - json: (options?: $winstonFormatJsonOptions) => $winstonFormat, - label: (config?: Object) => $winstonFormat, - metadata: () => $winstonFormat, - // Start: https://github.com/Khan/react-render-server/pull/20 - prettyPrint: (options?: $winstonFormatPrintPrintOptions) => $winstonFormat, - // End: https://github.com/Khan/react-render-server/pull/20 - simple: () => $winstonFormat, - splat: () => $winstonFormat, - timestamp: ( - ?{ - alias?: string, - format?: string, - ... - }, - ) => $winstonFormat, - colorize: () => $winstonFormat, - logstash: () => $winstonFormat, - printf: ((args: $winstonInfo) => string) => $winstonFormat, - ... -}; - -declare type $winstonDefaultLogger = $winstonLogger<$winstonNpmLogLevels>; - -declare class $winstonContainer { - constructor(config?: $winstonLoggerConfig): $winstonContainer; - add(loggerId: string, config?: $winstonLoggerConfig): $winstonLogger; - get(loggerId: string): $winstonLogger; - has(loggerId: string): boolean; -} - -declare module "winston" { - declare export type Levels = $winstonLevels; - declare export type NpmLogLevels = $winstonNpmLogLevels; - declare export type Info = $winstonInfo; - declare export type Format = $winstonFormat; - declare export type FileTransportConfig< - T: Levels, - > = $winstonFileTransportConfig; - declare export type Transport = $winstonTransport; - declare export type FileTransport = $winstonFileTransport; - declare export type ConsoleTransportConfig< - T: Levels, - > = $winstonConsoleTransportConfig; - declare export type ConsoleTransport< - T: Levels, - > = $winstonConsoleTransport; - // Start: https://github.com/Khan/react-render-server/pull/20 - declare export type StreamTransportConfig< - T: Levels, - > = $winstonStreamTransportConfig; - declare export type StreamTransport = $winstonStreamTransport; - // End: https://github.com/Khan/react-render-server/pull/20 - declare export type LoggerConfig = $winstonLoggerConfig; - declare export type Logger = $winstonLogger; - declare export type ConfigSubModule = $winstonConfigSubModule; - declare export type FormatSubModule = $winstonFormatSubModule; - declare export type DefaultLogger = $winstonDefaultLogger; - declare export type Container = $winstonContainer; - - declare module.exports: { - ...$Exact<$winstonDefaultLogger>, - format: $winstonFormatSubModule, - transports: { - Console: typeof $winstonConsoleTransport, - File: typeof $winstonFileTransport, - // Start: https://github.com/Khan/react-render-server/pull/20 - Stream: typeof $winstonStreamTransport, - // End: https://github.com/Khan/react-render-server/pull/20 - ... - }, - createLogger: ($winstonLoggerConfig) => $winstonLogger, - Container: typeof $winstonContainer, - loggers: $winstonContainer<*>, - ... - }; -} diff --git a/flow-typed/wonder-stuff.js b/flow-typed/wonder-stuff.js deleted file mode 100644 index 33a5202e..00000000 --- a/flow-typed/wonder-stuff.js +++ /dev/null @@ -1 +0,0 @@ -declare var __IS_BROWSER__: boolean; diff --git a/package.json b/package.json index 49ebf3cc..8afba146 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "@babel/eslint-parser": "^7.19.1", "@babel/eslint-plugin": "^7.19.1", "@babel/preset-env": "^7.19.4", - "@babel/preset-flow": "^7.18.6", "@babel/preset-typescript": "^7.18.6", "@changesets/cli": "^2.26.0", "@google-cloud/debug-agent": "^5.2.9", @@ -36,13 +35,10 @@ "@types/jest-when": "^3.5.2", "@types/winston": "^2.4.4", "babel-jest": "29.4.2", - "babel-plugin-transform-flow-enums": "^0.0.2", "eslint": "^8.34.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-disable": "^2.0.3", "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-flowtype": "^8.0.3", - "eslint-plugin-ft-flow": "^2.0.1", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jest": "27.2.1", "eslint-plugin-jsx-a11y": "^6.7.1", @@ -53,8 +49,6 @@ "express": "^4.18.2", "express-winston": "^4.2.0", "fast-glob": "^3.2.12", - "flow-bin": "^0.199.1", - "flow-enums-runtime": "^0.0.6", "flowgen": "^1.21.0", "heapdump": "^0.3.15", "jest": "^29.4.3", diff --git a/packages/eslint-config-khan/index.js b/packages/eslint-config-khan/index.js index e4bd277d..f73ea8ce 100644 --- a/packages/eslint-config-khan/index.js +++ b/packages/eslint-config-khan/index.js @@ -5,7 +5,7 @@ const ERROR = "error"; module.exports = { parser: "babel-eslint", - plugins: ["ft-flow", "jsx-a11y", "prettier", "react"], + plugins: ["jsx-a11y", "prettier", "react"], extends: ["eslint:recommended", "prettier"], env: { // TODO(csilvers): once we properly use node.js for node @@ -16,9 +16,6 @@ module.exports = { jest: true, }, settings: { - "ft-flow": { - onlyFilesWithFlowAnnotation: true, - }, react: { version: "16.4", }, @@ -58,7 +55,7 @@ module.exports = { "no-undef": ERROR, "no-unexpected-multiline": ERROR, "no-unreachable": ERROR, - "no-unused-expressions": OFF, // This is superseded by ft-flow/no-unused-expressions. + "no-unused-expressions": ERROR, "no-unused-vars": [ERROR, {args: "none", varsIgnorePattern: "^_*$"}], "no-useless-call": ERROR, "no-var": ERROR, @@ -72,30 +69,6 @@ module.exports = { "template-curly-spacing": OFF, // TODO(kevinb): enable this "valid-jsdoc": OFF, // TODO(kevinb): Enable this since we are using jdocs in some places. - /** - * ft-flow rules - */ - "ft-flow/boolean-style": [ERROR, "boolean"], - "ft-flow/define-flow-type": WARN, // Suppress no-undef on flow types. - "ft-flow/no-dupe-keys": ERROR, - "ft-flow/no-unused-expressions": [ - ERROR, - {allowShortCircuit: true, allowTernary: true}, - ], - "ft-flow/no-weak-types": OFF, // Allow any, Object, and Function for now. - "ft-flow/require-parameter-type": OFF, // Flow may still require parameter types in certain situations. - "ft-flow/require-return-type": OFF, - "ft-flow/require-valid-file-annotation": [ - ERROR, - "always", - { - annotationStyle: "line", - }, - ], - "ft-flow/sort": OFF, - "ft-flow/type-id-match": OFF, - "ft-flow/use-flow-type": WARN, // Suppress no-unused-vars on flow types. - /** * jsx-a11y rules */ diff --git a/packages/eslint-config-khan/package.json b/packages/eslint-config-khan/package.json index 6e982368..a04a8d18 100644 --- a/packages/eslint-config-khan/package.json +++ b/packages/eslint-config-khan/package.json @@ -15,7 +15,6 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-babel": "^5.3.1", "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-ft-flow": "^5.7.2", "eslint-plugin-graphql": "^4.0.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-jsx-a11y": "^6.4.1", @@ -25,4 +24,4 @@ "eslint-plugin-react-native": "^3.11.0", "eslint-plugin-react-native-animation-linter": "^0.1.2" } -} +} \ No newline at end of file diff --git a/packages/wonder-stuff-core/src/__tests__/entries.flowtest.ts b/packages/wonder-stuff-core/src/__tests__/entries.flowtest.ts deleted file mode 100644 index 6dfba467..00000000 --- a/packages/wonder-stuff-core/src/__tests__/entries.flowtest.ts +++ /dev/null @@ -1,65 +0,0 @@ -// @ts-expect-error [FEI-5011] - TS2307 - Cannot find module '../entries' or its corresponding type declarations. -import {entries} from "../entries"; - -{ - // should type returned array element as tuples of keys as string subtype - const obj1 = { - a: 1, - b: "2", - c: [3, 4], - } as const; - - const entries1 = entries(obj1); - - // This works because the keys are all strings - const [_]: [string, unknown] = entries1[0]; -} - -{ - // should type returned array element as tuples supertype of keys - const obj2 = { - a: 1, - b: "2", - c: [3, 4], - } as const; - const entries2 = entries(obj2); - - // This works because the returned tuple type is of a supertype of all key - // names and the value type (which we don't care about for this flow check). - const [_]: ["a" | "b" | "c", unknown] = entries2[0]; - - // This errors because we try to get a key of only one type. - const [__]: ["a", unknown] = entries2[0]; -} - -{ - // should type returned array element as tuples of values as supertype - const obj1 = { - a: 1, - b: "2", - c: [3, 4], - } as const; - - const entries1 = entries(obj1); - - // This works because the keys are all strings, and the values are a - // supertype of all the value types in the object. - const [_, __]: [string, number | string | Array] = entries1[0]; - - // This errors because not all values are a number. - const [___, ____]: [string, number] = entries1[0]; -} - -{ - // should work with class instances - class Foo { - // @ts-expect-error [FEI-5011] - TS2564 - Property 'a' has no initializer and is not definitely assigned in the constructor. - a: string; - // @ts-expect-error [FEI-5011] - TS2564 - Property 'b' has no initializer and is not definitely assigned in the constructor. - b: string; - } - const foo = new Foo(); - - // This should not be erroring. - const _ = entries(foo); -} diff --git a/packages/wonder-stuff-core/src/__tests__/entries.test.ts b/packages/wonder-stuff-core/src/__tests__/entries.test.ts deleted file mode 100644 index 998afcc8..00000000 --- a/packages/wonder-stuff-core/src/__tests__/entries.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {entries} from "../entries"; - -describe("#entries", () => { - it("should call Object.entries with the given object", () => { - // Arrange - const entriesSpy = jest.spyOn(Object, "entries"); - const obj = { - a: 1, - b: "2", - c: [3, 4], - } as const; - - // Act - entries(obj); - - // Assert - expect(entriesSpy).toHaveBeenCalledWith(obj); - }); - - it("should return the result of Object.entries", () => { - // Arrange - const obj = { - a: 1, - b: "2", - c: [3, 4], - } as const; - jest.spyOn(Object, "entries").mockReturnValueOnce([ - ["e", 1], - ["f", 2], - ["g", 3], - ]); - - // Act - const result = entries(obj); - - // Assert - expect(result).toEqual([ - ["e", 1], - ["f", 2], - ["g", 3], - ]); - }); -}); diff --git a/packages/wonder-stuff-core/src/__tests__/error-info.test.ts b/packages/wonder-stuff-core/src/__tests__/error-info.test.ts index 52926169..1f7e1c84 100644 --- a/packages/wonder-stuff-core/src/__tests__/error-info.test.ts +++ b/packages/wonder-stuff-core/src/__tests__/error-info.test.ts @@ -75,7 +75,6 @@ describe("ErrorInfo", () => { // Act const act = () => - // $FlowIgnore[incompatible-call] // @ts-expect-error [FEI-5011] - TS2345 - Argument of type 'null' is not assignable to parameter of type 'ErrorInfo'. ErrorInfo.fromConsequenceAndCause(null, cause); @@ -95,7 +94,6 @@ describe("ErrorInfo", () => { // Act const act = () => - // $FlowIgnore[incompatible-call] // @ts-expect-error [FEI-5011] - TS2345 - Argument of type 'null' is not assignable to parameter of type 'ErrorInfo'. ErrorInfo.fromConsequenceAndCause(consequence, null); @@ -134,7 +132,6 @@ describe("ErrorInfo", () => { // Act const act = () => - // $FlowIgnore[incompatible-call] // @ts-expect-error [FEI-5011] - TS2345 - Argument of type 'null' is not assignable to parameter of type 'ErrorInfo'. ErrorInfo.fromConsequenceAndCause(null, cause); @@ -154,7 +151,6 @@ describe("ErrorInfo", () => { // Act const act = () => - // $FlowIgnore[incompatible-call] // @ts-expect-error [FEI-5011] - TS2345 - Argument of type 'null' is not assignable to parameter of type 'ErrorInfo'. ErrorInfo.fromConsequenceAndCause(consequence, null); diff --git a/packages/wonder-stuff-core/src/__tests__/keys.flowtest.ts b/packages/wonder-stuff-core/src/__tests__/keys.flowtest.ts deleted file mode 100644 index 7ebfe77b..00000000 --- a/packages/wonder-stuff-core/src/__tests__/keys.flowtest.ts +++ /dev/null @@ -1,60 +0,0 @@ -// @ts-expect-error [FEI-5011] - TS2307 - Cannot find module '../keys' or its corresponding type declarations. -import {keys} from "../keys"; - -{ - // should type returned array element as subtype of string - const obj1 = { - a: 1, - b: "2", - } as const; - - const keys1 = keys(obj1); - const _: string = keys1[0]; -} - -{ - // should type returned array element as supertype of keys - const obj2 = { - a: 1, - b: "2", - c: [3, 4], - } as const; - - // This works because the return type is an array of a supertype of all key - // names, thanks to $Keys<>. - const keys2ok = keys(obj2); - const _: "a" | "b" | "c" = keys2ok[0]; - - // This errors because we try to get a key of only one type. Flow sees this - // as a bad call rather than a bad assignment. Hence the expectation on - // the callsite, not the assignment. - const keys2bad = keys(obj2); - const __: "a" = keys2bad[0]; -} - -{ - // should work with more specific object types - const obj3: { - [key: string]: string; - } = { - a: "1", - b: "2", - }; - - // This should not be erroring. - const _ = keys(obj3); -} - -{ - // should work with class instances - class Foo { - // @ts-expect-error [FEI-5011] - TS2564 - Property 'a' has no initializer and is not definitely assigned in the constructor. - a: string; - // @ts-expect-error [FEI-5011] - TS2564 - Property 'b' has no initializer and is not definitely assigned in the constructor. - b: string; - } - const foo = new Foo(); - - // This should not be erroring. - const _ = keys(foo); -} diff --git a/packages/wonder-stuff-core/src/__tests__/keys.test.ts b/packages/wonder-stuff-core/src/__tests__/keys.test.ts deleted file mode 100644 index 80937e58..00000000 --- a/packages/wonder-stuff-core/src/__tests__/keys.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {keys} from "../keys"; - -describe("#keys", () => { - it("should call Object.keys with the given object", () => { - // Arrange - const keysSpy = jest.spyOn(Object, "keys"); - const obj = { - a: 1, - b: "2", - c: [3, 4], - } as const; - - // Act - keys(obj); - - // Assert - expect(keysSpy).toHaveBeenCalledWith(obj); - }); - - it("should return the result of Object.keys", () => { - // Arrange - const obj = { - a: 1, - b: "2", - c: [3, 4], - } as const; - // @ts-expect-error [FEI-5011] - TS2345 - Argument of type 'string' is not assignable to parameter of type 'string[]'. - jest.spyOn(Object, "keys").mockReturnValueOnce("THE RESULT"); - - // Act - const result = keys(obj); - - // Assert - expect(result).toEqual("THE RESULT"); - }); -}); diff --git a/packages/wonder-stuff-core/src/__tests__/kind-error.test.ts b/packages/wonder-stuff-core/src/__tests__/kind-error.test.ts index 95051747..63607c7d 100644 --- a/packages/wonder-stuff-core/src/__tests__/kind-error.test.ts +++ b/packages/wonder-stuff-core/src/__tests__/kind-error.test.ts @@ -308,7 +308,6 @@ describe("KindError", () => { // Act const act = () => new KindError("MESSAGE", Errors.Unknown, { - // $FlowIgnore[incompatible-call] // @ts-expect-error [FEI-5011] - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'. cause: "NOT_AN_ERROR", }); @@ -331,7 +330,6 @@ describe("KindError", () => { // Act const act = () => new KindError("MESSAGE", Errors.Unknown, { - // $FlowIgnore[incompatible-call] // @ts-expect-error [FEI-5011] - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'. cause: "NOT_AN_ERROR", }); diff --git a/packages/wonder-stuff-core/src/__tests__/values.flowtest.ts b/packages/wonder-stuff-core/src/__tests__/values.flowtest.ts deleted file mode 100644 index 418ac005..00000000 --- a/packages/wonder-stuff-core/src/__tests__/values.flowtest.ts +++ /dev/null @@ -1,72 +0,0 @@ -// @ts-expect-error [FEI-5011] - TS2307 - Cannot find module '../values' or its corresponding type declarations. -import {values} from "../values"; - -{ - // should type returned array element with union of value types of passed object - const obj1 = { - a: 1, - b: "2", - c: [3, 4], - } as const; - const obj1Values = values(obj1); - - // This works because the variable is typed to all the possible value types. - const _: number | string | Array = obj1Values[0]; - - // This errors because the variable is only typed to string, but the value - // could be a number, string, or array of numbers. - const __: string = obj1Values[1]; -} - -{ - // should work with explicit object-as-map types - const map1: { - [key: string]: number; - } = { - a: 1, - b: 2, - c: 3, - }; - const map1Values = values(map1); - - // This works because the variable is typed to number. - const _: number = map1Values[0]; - - // This errors because the variable is typed to string, and that is not - // a number. - const __: string = map1Values[1]; -} - -{ - // should return type Array for empty object - const emptyObj: Record = {}; - const _: Array = values(emptyObj); -} - -{ - // should error if passed object values do not match parameterized type - const obj2 = { - a: 1, - b: "2", - } as const; - - // This errors because the return type of values() is not Array - const _: Array = values(obj2); - - // This errors because the object does not have values that are all numbers. - const __ = values(obj2); -} - -{ - // should work with class instances - class Foo { - // @ts-expect-error [FEI-5011] - TS2564 - Property 'a' has no initializer and is not definitely assigned in the constructor. - a: string; - // @ts-expect-error [FEI-5011] - TS2564 - Property 'b' has no initializer and is not definitely assigned in the constructor. - b: string; - } - const foo = new Foo(); - - // This should not be erroring. - const _ = values(foo); -} diff --git a/packages/wonder-stuff-core/src/__tests__/values.test.ts b/packages/wonder-stuff-core/src/__tests__/values.test.ts deleted file mode 100644 index ee7e850d..00000000 --- a/packages/wonder-stuff-core/src/__tests__/values.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {values} from "../values"; - -describe("#values", () => { - it("should call Object.values with the given object", () => { - // Arrange - const valuesSpy = jest.spyOn(Object, "values"); - const obj = { - a: 1, - b: "2", - c: [3, 4], - } as const; - - // Act - values(obj); - - // Assert - expect(valuesSpy).toHaveBeenCalledWith(obj); - }); - - it("should return the result of Object.values", () => { - // Arrange - const obj = { - a: 1, - b: "2", - c: [3, 4], - } as const; - // @ts-expect-error [FEI-5011] - TS2345 - Argument of type 'string' is not assignable to parameter of type 'any[]'. - jest.spyOn(Object, "values").mockReturnValue("THE RESULT"); - - // Act - const result = values(obj); - - // Assert - expect(result).toEqual("THE RESULT"); - }); -}); diff --git a/packages/wonder-stuff-core/src/entries.ts b/packages/wonder-stuff-core/src/entries.ts deleted file mode 100644 index 9ca3c010..00000000 --- a/packages/wonder-stuff-core/src/entries.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Return an array of key/value tuples for an object. - * - * @param {Readonly>} obj The object for which the values are - * to be returned. - * @returns {Array<[K, V]>} An array of key/value tuples for the object. - */ -export function entries( - obj: Readonly>, -): Array<[K, V]> { - // This cast is deliberate as Object.entries is typed to return - // Array<[string, mixed]>, but we want to return Array<[K, V]>. - return Object.entries(obj) as Array<[K, V]>; -} diff --git a/packages/wonder-stuff-core/src/index.ts b/packages/wonder-stuff-core/src/index.ts index af3c57b9..dedb714d 100644 --- a/packages/wonder-stuff-core/src/index.ts +++ b/packages/wonder-stuff-core/src/index.ts @@ -1,7 +1,4 @@ export {clone} from "./clone"; -export {entries} from "./entries"; -export {keys} from "./keys"; -export {values} from "./values"; export {Errors} from "./errors"; export {errorsFromError, Order} from "./errors-from-error"; export {getKindFromError} from "./get-kind-from-error"; diff --git a/packages/wonder-stuff-core/src/keys.ts b/packages/wonder-stuff-core/src/keys.ts deleted file mode 100644 index 3f36f6f3..00000000 --- a/packages/wonder-stuff-core/src/keys.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Return an array of the enumerable keys of an object. - * - * @param {Readonly>} obj The object for which the values are - * to be returned. - * @returns {Array} An array of the enumerable keys of an object. - */ -export function keys>( - obj: Readonly, -): Array { - return Object.keys(obj); -} diff --git a/packages/wonder-stuff-core/src/values.ts b/packages/wonder-stuff-core/src/values.ts deleted file mode 100644 index 6346fe25..00000000 --- a/packages/wonder-stuff-core/src/values.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Return an array of the enumerable property values of an object. - * - * @param {Readonly>} obj The object for which the values are - * to be returned. - * @returns {Array} An array of the enumerable property values of the object. - */ -export function values(obj: Readonly>): Array { - // This is a deliberate cast through any. - // Object.values returns Array and we want to return Array. - return Object.values(obj); -} diff --git a/packages/wonder-stuff-core/tsconfig.json b/packages/wonder-stuff-core/tsconfig.json index 8bebeb02..35cad7f7 100644 --- a/packages/wonder-stuff-core/tsconfig.json +++ b/packages/wonder-stuff-core/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["dist", "**/*.flowtest.ts"], + "exclude": ["dist"], "extends": "../tsconfig-shared.json", "compilerOptions": { "outDir": "dist", diff --git a/packages/wonder-stuff-i18n/tsconfig.json b/packages/wonder-stuff-i18n/tsconfig.json index 8bebeb02..35cad7f7 100644 --- a/packages/wonder-stuff-i18n/tsconfig.json +++ b/packages/wonder-stuff-i18n/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["dist", "**/*.flowtest.ts"], + "exclude": ["dist"], "extends": "../tsconfig-shared.json", "compilerOptions": { "outDir": "dist", diff --git a/packages/wonder-stuff-sentry/src/__tests__/kind-error-data.test.ts b/packages/wonder-stuff-sentry/src/__tests__/kind-error-data.test.ts index 4e0bc7cc..af5a3bd7 100644 --- a/packages/wonder-stuff-sentry/src/__tests__/kind-error-data.test.ts +++ b/packages/wonder-stuff-sentry/src/__tests__/kind-error-data.test.ts @@ -146,7 +146,6 @@ describe("KindErrorData", () => { const underTest = new KindErrorData(); const addGlobalEventProcessorMock = jest.fn(); const getHub = () => ({ - // $FlowIgnore[incompatible-call] getIntegration: jest.fn().mockReturnValue(underTest), }); const enhanceSpy = jest diff --git a/packages/wonder-stuff-sentry/src/kind-sentry-error.ts b/packages/wonder-stuff-sentry/src/kind-sentry-error.ts index adced220..cc62ad1f 100644 --- a/packages/wonder-stuff-sentry/src/kind-sentry-error.ts +++ b/packages/wonder-stuff-sentry/src/kind-sentry-error.ts @@ -122,28 +122,6 @@ export class KindSentryError extends KindError { // For simplicity of implementation and ease of API use, we choose // option 1. metadata: { - // Flow is unhappy because: - // 1. metadata is of type Metadata, which can have a variety of - // value types, such as string and number. - // 2. metadata is mutable and as such, something that is type - // string could be given a value of type number at some - // later point. - // 3. sentryData (and EmptySentryData) are of type SentryData, - // and some of their types are stricter about what types - // they can have, such as only string. - // 4. once sentryData things are part of metadata, sentryData - // things could be mutated to the wrong type. - // 5. Flow doesn't know that we will clone and freeze the - // metadata once we pass it into this super constructor here. - // - // We could mitigate by making metadata readonly for the base - // class, but that just pushes the problem on. - // And we could create a whole new object explicitly copying - // each bit of data into a new one of the correct type, but - // since we are about to clone and freeze the data in the base - // class, that seems like overkill, so let's just suppress - // flow. - // $FlowIgnore[incompatible-call] sentry: { ...EmptySentryData, ...sentryData, diff --git a/packages/wonder-stuff-sentry/tsconfig.json b/packages/wonder-stuff-sentry/tsconfig.json index d74ddfac..d822c9f3 100644 --- a/packages/wonder-stuff-sentry/tsconfig.json +++ b/packages/wonder-stuff-sentry/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["dist", "**/*.flowtest.ts"], + "exclude": ["dist"], "extends": "../tsconfig-shared.json", "compilerOptions": { "outDir": "dist", diff --git a/packages/wonder-stuff-server-google/src/trace-impl.ts b/packages/wonder-stuff-server-google/src/trace-impl.ts index 8fbbc024..dad4cecc 100644 --- a/packages/wonder-stuff-server-google/src/trace-impl.ts +++ b/packages/wonder-stuff-server-google/src/trace-impl.ts @@ -115,9 +115,6 @@ export const traceImpl = ( * We need to build the metadata that we will be logging. * This is a combination of the given info, some custom things we add, * and any profile labels that were added. - * - * We suppress flow because we want the TraceSessionInfo to overwrite - * things and it's OK if we don't know what things it overwrites. */ const metadata = { /** diff --git a/packages/wonder-stuff-server-google/src/trace.ts b/packages/wonder-stuff-server-google/src/trace.ts index 18d549d0..4ca37c41 100644 --- a/packages/wonder-stuff-server-google/src/trace.ts +++ b/packages/wonder-stuff-server-google/src/trace.ts @@ -60,7 +60,6 @@ export const trace: ITrace = ( const tracer = traceAgent.get(); if ( requestOrLogger == null || - // $FlowIgnore[method-unbinding] Object.prototype.hasOwnProperty.call(requestOrLogger, "url") ) { // We have done a little check to make sure this is either null diff --git a/packages/wonder-stuff-server-google/tsconfig.json b/packages/wonder-stuff-server-google/tsconfig.json index 48645b9f..84e892ec 100644 --- a/packages/wonder-stuff-server-google/tsconfig.json +++ b/packages/wonder-stuff-server-google/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["dist", "**/*.flowtest.ts"], + "exclude": ["dist"], "extends": "../tsconfig-shared.json", "compilerOptions": { "outDir": "dist", diff --git a/packages/wonder-stuff-server/src/get-logging-transport.ts b/packages/wonder-stuff-server/src/get-logging-transport.ts index 1bfe3c9b..28bbcb80 100644 --- a/packages/wonder-stuff-server/src/get-logging-transport.ts +++ b/packages/wonder-stuff-server/src/get-logging-transport.ts @@ -50,12 +50,6 @@ export const getLoggingTransport = ( logLevel: LogLevel, ): Transport => { switch (mode) { - /** - * Our flow types guard against misuse as long as someone is using them. - * Let's be defensive and cope with a bad value. In that case, we'll - * assume our test mode as it's the most inert. - */ - // $FlowIgnore[invalid-exhaustive-check] default: case Runtime.Test: /** @@ -71,8 +65,6 @@ export const getLoggingTransport = ( /** * This is a hack to make our writable stream work */ - // $FlowFixMe[cannot-write] - // $FlowFixMe[method-unbinding] sink._write = sink.write; return new winston.transports.Stream({ format: getFormatters(Runtime.Test), diff --git a/packages/wonder-stuff-server/src/start-server.ts b/packages/wonder-stuff-server/src/start-server.ts index 3dbe8889..7424b2c0 100644 --- a/packages/wonder-stuff-server/src/start-server.ts +++ b/packages/wonder-stuff-server/src/start-server.ts @@ -129,7 +129,6 @@ export async function startServer< } = {}; const closeConnections = () => { for (const connection of Object.values(connections)) { - // Connection is type mixed, so we need to tell flow this is OK. connection.destroy(); } }; diff --git a/packages/wonder-stuff-server/tsconfig.json b/packages/wonder-stuff-server/tsconfig.json index cf71e9b2..aec43e53 100644 --- a/packages/wonder-stuff-server/tsconfig.json +++ b/packages/wonder-stuff-server/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["dist", "**/*.flowtest.ts"], + "exclude": ["dist"], "extends": "../tsconfig-shared.json", "compilerOptions": { "outDir": "./dist", diff --git a/packages/wonder-stuff-testing/src/data-factory-for.ts b/packages/wonder-stuff-testing/src/data-factory-for.ts index f9a68758..cf0522a4 100644 --- a/packages/wonder-stuff-testing/src/data-factory-for.ts +++ b/packages/wonder-stuff-testing/src/data-factory-for.ts @@ -46,10 +46,7 @@ import {clone} from "@khanacademy/wonder-stuff-core"; */ export const dataFactoryFor = (baseObject: T): ((partialObject?: Partial) => T) => - ( - // $FlowIgnore[incompatible-type]: Flow thinks that {} can't be assigned to Partial - partialObject: Partial = Object.freeze({}), - ): T => { + (partialObject: Partial = Object.freeze({})): T => { // NOTE: we clone the result to prevent tests from modifying // either `defaultObject` or `partialObject` when performing // deep updates on the return object returned by the factory. diff --git a/packages/wonder-stuff-testing/tsconfig.json b/packages/wonder-stuff-testing/tsconfig.json index d74ddfac..d822c9f3 100644 --- a/packages/wonder-stuff-testing/tsconfig.json +++ b/packages/wonder-stuff-testing/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["dist", "**/*.flowtest.ts"], + "exclude": ["dist"], "extends": "../tsconfig-shared.json", "compilerOptions": { "outDir": "dist", diff --git a/tsconfig-check.json b/tsconfig-check.json index ab9e57e3..5ad84249 100644 --- a/tsconfig-check.json +++ b/tsconfig-check.json @@ -1,7 +1,7 @@ // This file is used by the `typecheck` command in package.json /* Visit https://aka.ms/tsconfig to read more about this file */ { - "exclude": ["**/dist", "**/*.flowtest.ts"], + "exclude": ["**/dist"], "extends": "./tsconfig-common.json", "compilerOptions": { "noEmit": true,