All Projects → happylynx → flow-webpack-plugin

happylynx / flow-webpack-plugin

Licence: other
A webpack plugin allowing to call Flow type checker.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to flow-webpack-plugin

mock-webpack-plugin
A webpack plugin that starts a json mock server
Stars: ✭ 21 (-41.67%)
Mutual labels:  webpack-plugin
loading-screen
🚥Loading screen for webpack plugin inspired by Nuxt.js's loading screen
Stars: ✭ 56 (+55.56%)
Mutual labels:  webpack-plugin
image-sprite-webpack-plugin
A webpack plugin that generates spritesheets from your stylesheets.
Stars: ✭ 27 (-25%)
Mutual labels:  webpack-plugin
warnings-to-errors-webpack-plugin
a webpack plugin that can recognize every warning as errors.
Stars: ✭ 17 (-52.78%)
Mutual labels:  webpack-plugin
remove-files-webpack-plugin
A plugin for webpack that removes files and folders before and after compilation.
Stars: ✭ 48 (+33.33%)
Mutual labels:  webpack-plugin
monaco-editor-esm-webpack-plugin
No description or website provided.
Stars: ✭ 25 (-30.56%)
Mutual labels:  webpack-plugin
webpack-demos
webpack小练习
Stars: ✭ 17 (-52.78%)
Mutual labels:  webpack-plugin
stylelint-bare-webpack-plugin
Stylelint plugin for webpack
Stars: ✭ 15 (-58.33%)
Mutual labels:  webpack-plugin
webpack-alioss-upload-plugin
A flexible webpack plugin to upload files to aliyun oss, which supports multiple optional upload methods and parameters.
Stars: ✭ 14 (-61.11%)
Mutual labels:  webpack-plugin
prettier-eslint-webpack-plugin
Webpack plugin for prettier-eslint which ESLint's settings is set to JavaScript Standard Style
Stars: ✭ 24 (-33.33%)
Mutual labels:  webpack-plugin
bower-resolve-webpack-plugin
Offers an enhanced bower support for enhanced-resolve plugin.
Stars: ✭ 12 (-66.67%)
Mutual labels:  webpack-plugin
chicio.github.io
👻 Fabrizio Duroni (me 😄) personal website. Created using GatsbyJS, Styled Components, Storybook, Typescript, tsParticles, GitHub pages, Github Actions, Upptime.
Stars: ✭ 20 (-44.44%)
Mutual labels:  webpack-plugin
size-plugin-bot
A Github bot for size-plugin
Stars: ✭ 76 (+111.11%)
Mutual labels:  webpack-plugin
config-webpack-plugin
💫 Merge one or more configuration files together with environment variables too.
Stars: ✭ 18 (-50%)
Mutual labels:  webpack-plugin
2018-package-three-webpack-plugin
[ARCHIVED] Webpack plugin to use Three.js "examples" classes
Stars: ✭ 45 (+25%)
Mutual labels:  webpack-plugin
qn-webpack
Qiniu webpack plugin (七牛 Webpack 插件)
Stars: ✭ 39 (+8.33%)
Mutual labels:  webpack-plugin
webpack-stats-diff-plugin
Webpack plugin for reporting changes in bundle sizes across builds
Stars: ✭ 63 (+75%)
Mutual labels:  webpack-plugin
generate-package-json-webpack-plugin
Generates a package.json file containing the external modules used by your webpack bundle
Stars: ✭ 59 (+63.89%)
Mutual labels:  webpack-plugin
webpack2-externals-plugin
Webpack 2+ fork of Webpack-Externals-Plugin
Stars: ✭ 14 (-61.11%)
Mutual labels:  webpack-plugin
css-chunks-html-webpack-plugin
Injecting css chunks extracted using extract-css-chunks-webpack-plugin to HTML for html-webpack-plugin
Stars: ✭ 22 (-38.89%)
Mutual labels:  webpack-plugin

flow-webpack-plugin

A webpack plugin allowing to call Flow type checker during each webpack compilation.

npm npm npm David

Key features

  • It doesn't require flow to be in $PATH.
  • No dependencies. Plugin can reuse project's flow-bin installation.
  • It can make webpack to exit with non-zero return code, if flow validation fails.
  • It works per project, not per file.

Installation

Run in you project directory:

npm install --save-dev flow-webpack-plugin flow-bin

or using yarn:

yarn add flow-webpack-plugin flow-bin --dev

Add to your webpack configuration file webpack.config.js:

const FlowWebpackPlugin = require('flow-webpack-plugin')

module.exports = {
    plugins: [
        new FlowWebpackPlugin(),
        // ...
    ],
    // ...
}

Note: flow-bin package is not a hard dependency. If flow is already installed on your system, it can be reused through flowPath option.

Demo project illustrates integration of Webpack, Flow and Babel using this plugin.

Screenshots

Valid codebase:
Valid codebase

Flow validation error:
Flow validation error

Configuration

Constructor of FlowWebpackPlugin accepts optional configuration object of following properties:

const FlowWebpackPlugin = require('flow-webpack-plugin')

new FlowWebpackPlugin({
    failOnError: false,
    failOnErrorWatch: false,
    reportingSeverity: 'error',
    printFlowOutput: true,
    flowPath: require.main.require('flow-bin'),
    flowArgs: ['--color=always'],
    verbose: false,
    callback: (result) => {}
})
option type default value description
failOnError boolean false Webpack exits with non-zero error code if flow typechecking fails.
failOnErrorWatch boolean false Webpack in watch mode exits with non-zero error code if flow typechecking fails.
reportingSeverity 'warning' | 'error' 'error' Webpack severity level of reported flow type problems. When using webpack-dev-server, page reload is blocked in case of webpack error. warning can be used to enable page reloads in case of flow errors when using webpack-dev-server.
printFlowOutput boolean true true ~ Output of flow is printed at the end of webpack compilation in case of error, false ~ output of flow is discarded.
flowPath string require('flow-bin') if flow-bin package is installed. Otherwise the parameter is required. Path to flow executable. It may be both absolute, relative to the 'cwd' of webpack process or just name of an executable on the PATH.
flowArgs Array<string> ['--color=always'] if standard output is directed to a terminal, otherwise [] Flow command line arguments. See flow cli documentation.
verbose boolean false It enables plugin logging for debug purposes.
callback ({exitCode: number, stdout: string, stderr: string}) => ?Promise<any> (result) => {} Custom user function that is called when Flow check finishes and is passed Flow type check result. If function returns a promise, it is called asynchronously.

Type annotations strip

This plugin performs type validation of the code. To remove the Flow type annotations and create pure Javascript code babel-plugin-transform-flow-strip-types can be used.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].