Skip to main content

Flow driver

Provides Flow support by dynamically generating a .flowconfig config file.

Requirements#

  • Flow

Installation#

In your configuration module, install the driver and Flow.

yarn add @beemo/driver-flow flow-bin

Create a file at configs/flow.ts (or .js) in which to house your Flow configuration.

configs/flow.ts
import { FlowConfig } from '@beemo/driver-flow';
const config: FlowConfig = {
ignore: ['.*/node_modules/.*', '.*/tests/.*', '.*\\.test\\.js'],
include: ['./src'],
lints: {
untyped_import: 'warn',
},
options: {
emoji: true,
'module.ignore_non_literal_requires': true,
suppress_comment: '\\\\(.\\\\|\\n\\\\)*\\\\$FlowFixMe',
},
};
export default config;

Config format#

In Beemo, Flow is configured using a JavaScript/TypeScript file, and not the .flowconfig file. To support this, the following conventions must be followed.

  • ignore, include, and libs are an array of strings.
  • lints is an object. Properties are snake case (underscored instead of dashed).
  • options is an object.
    • Properties with a period must be quoted.
    • suppress_comment must be double escaped or use RegExp.
  • version is a string.

An example can be seen above.

Integration#

In your consuming project, enable the driver by adding flow to your drivers config.

.config/beemo.ts
import { BeemoConfig } from '@beemo/core';
const config: BeemoConfig = {
module: '<config-module>',
drivers: ['flow'],
};
export default config;