question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is my flow not type checking?

See original GitHub issue

Why is flow not type checking function args for me? Or I dont think its type checking anything at all, even though it is in the app.

.flowconfig

[ignore]
.*/build
.*/docs
.*/node_modules
.*/public

[include]

[options]
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=src

.eslintrc.js

/**
 * React Starter Kit (https://www.reactstarterkit.com/)
 *
 * Copyright © 2014-present Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

// ESLint configuration
// http://eslint.org/docs/user-guide/configuring
module.exports = {
  parser: 'babel-eslint',

  extends: [
    'airbnb',
    'plugin:flowtype/recommended',
    'plugin:css-modules/recommended',
  ],

  plugins: [
    'flowtype',
    'css-modules',
  ],

  globals: {
    __DEV__: true,
  },

  env: {
    browser: true,
  },

  rules: {
    // `js` and `jsx` are common extensions
    // `mjs` is for `universal-router` only, for now
    'import/extensions': [
      'error',
      'always',
      {
        js: 'never',
        jsx: 'never',
        mjs: 'never',
      },
    ],

    // Not supporting nested package.json yet
    // https://github.com/benmosher/eslint-plugin-import/issues/458
    'import/no-extraneous-dependencies': 'off',

    // Recommend not to leave any console.log in your code
    // Use console.error, console.warn and console.info instead
    'no-console': [
      'error',
      {
        allow: ['warn', 'error', 'info'],
      },
    ],

    // Allow js files to use jsx syntax, too
    'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],

    // Automatically convert pure class to function by
    // babel-plugin-transform-react-pure-class-to-function
    // https://github.com/kriasoft/react-starter-kit/pull/961
    'react/prefer-stateless-function': 'off',
    "css-modules/no-unused-class": "off",
    "import/newline-after-import": "off",
    "import/first": "off",
    "comma-dangle": "off",
    "space-in-parens": [0, { exceptions: ["{}", "()"] }],
    "react/jsx-curly-spacing": 0,
    "arrow-parens": 0,
    "no-console": 0,
    "flowtype/no-types-missing-file-annotation": 0,
    "arrow-body-style": 0,
    "max-len": 0,
    "quotes": "off",
    "dot-notation": 0,
    "padded-blocks": 0,
    "linebreak-style": 0,
    "react/jsx-wrap-multilines": 0,
    "no-multiple-empty-lines": 0,
    "jsx-a11y/href-no-hash": 0,
    "camelcase": 0,
    "prefer-template": 0,
    "react/require-default-props": 0,
    "no-confusing-arrow": 0,
    "no-use-before-define": ["error", { "functions": false, "classes": true }],
    "react/prop-types": 0,
    "class-methods-use-this": 0,
    "no-trailing-spaces": 0,
    "react/no-array-index-key": 0,
    "no-return-assign": 0,
    "react/jsx-max-props-per-line": 1,
    "no-unused-vars": 1,
    "jsx-quotes": 0,
    "consistent-return": 1,
    "object-property-newline": 0,
    "react/forbid-prop-types": 0,
    "consistent-return": 0,
    "eqeqeq": 0,
    "react/no-children-prop": 0,
    "no-param-reassign": 0,
    "spaced-comment": 0,
    "space-infix-ops": 0,
    "space-unary-ops": 0,
    "react/no-unused-prop-types": 0,
    "react/jsx-pascal-case": 0,
    "react/no-danger": 0,
    "one-var": 0,
    "one-var-declaration-per-line": 0,
    "import/prefer-default-export": 0,
    "no-prototype-builtins": 0
  },

  settings: {
    // Allow absolute paths in imports, e.g. import Button from 'components/Button'
    // https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers
    'import/resolver': {
      node: {
        moduleDirectory: ['node_modules', 'src'],
      }
    },
  },
};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
langpavelcommented, May 29, 2018

How to setup flow is out of scope of the project, but you can try run flow ls to see which files flow can see and flow check possibly with --verbose flag for more options see flow --help and flow check --help

1reaction
pfftdammitchriscommented, Sep 16, 2017

No. I did and it works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type checking props does not work on a lot of my components
I just noticed that flow is ignoring the props type on a lot of my components. Example: import React, { Component } from...
Read more >
Flow Strict
Flow was designed for easy adoption, so it allows you opt-out of type checking in certain situations, permitting unsafe behaviors. But since many...
Read more >
Flow is not catching type errors for an imported component
1 Answer 1 ... The problem was that my import happens through a intermediary index.js file in the same directory as ErrorBoundary. That...
Read more >
TypeScript VS Flow: Type Checking Front End JavaScript
Currently, the most popular type checking libraries are Typescript, which is backed by Microsoft, and Flow, developed by Facebook.
Read more >
Why I Chose to Use Flow for Static Type Checking My JavaScript
The first reason is one that is implied from the examples above—it is incredibly easy to get value from Flow due to its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found