2

enter image description here

I created new RN project. And this warning showed. I use Flow and eslint for this project. And I know what React$Node means. But I don't know why this warning shows. Because I think React already defined it.

This is my .eslintrc.js.

module.exports = {
  parser: 'babel-eslint',
  extends: ['airbnb', 'prettier', 'prettier/react', 'prettier/flowtype'],
  plugins: ['react', 'flowtype', 'jsx-a11y', 'import', 'react-native'],
  rules: {
    'react/jsx-filename-extension': [1, {extensions: ['.js', '.jsx']}],
    'react/prefer-stateless-function': [2, {ignorePureComponents: true}],
    'react/forbid-prop-types': [0, {forbid: []}],
    'import/extensions': [1, 'never', {svg: 'always', json: 'always'}],
    'import/no-extraneous-dependencies': [
      'error',
      {
        devDependencies: true,
        optionalDependencies: false,
        peerDependencies: false,
      },
    ],
    semi: ['error', 'never'],
  },
  env: {
    jest: true,
    browser: true,
  },
}

2 Answers 2

1

I added this into extends. "plugin:flowtype/recommended". So it works!

module.exports = {
  parser: 'babel-eslint',
  extends: [
    'airbnb',
    'prettier',
    'prettier/react',
    'prettier/flowtype',
    'plugin:flowtype/recommended',
  ],
  plugins: ['react', 'flowtype', 'jsx-a11y', 'import', 'react-native'],
  rules: {
    'react/jsx-filename-extension': [1, {extensions: ['.js', '.jsx']}],
    'react/prefer-stateless-function': [2, {ignorePureComponents: true}],
    'react/forbid-prop-types': [0, {forbid: []}],
    'import/extensions': [1, 'never', {svg: 'always', json: 'always'}],
    'import/no-extraneous-dependencies': [
      'error',
      {
        devDependencies: true,
        optionalDependencies: false,
        peerDependencies: false,
      },
    ],
    semi: ['error', 'never'],
  },
  env: {
    jest: true,
    browser: true,
  },
}


Recommended Configuration

0

get same error when use

const TProps = {
    children: React$Node
}

instead of

type TProps = {
    children: React$Node
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.