React-starter-kit: Why is my flow not type checking?

Created on 13 Sep 2017  路  7Comments  路  Source: kriasoft/react-starter-kit

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'],
      }
    },
  },
};

Most helpful comment

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

All 7 comments

are you adding /* @flow */ to the top of the source files you want to type check?

No. I did and it works now.

This issue should probably be closed.

Agree, closing

still not working on mine even having the flow comment at the top. Using feature/apollo

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

it worked! I just installed babel-cli.
Thanks @langpavel

Was this page helpful?
0 / 5 - 0 ratings