Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prop-types doesn't check nextProps of componentWillReceiveProps #9832

Closed
mqklin opened this issue Jan 9, 2018 · 2 comments
Closed

prop-types doesn't check nextProps of componentWillReceiveProps #9832

mqklin opened this issue Jan 9, 2018 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@mqklin
Copy link

mqklin commented Jan 9, 2018

  • ESLint Version: 4.15.0
  • Node Version: 8.7.0
  • npm Version: 5.5.1

parser babel-eslint

Configuration

/* global module, __dirname */
/* eslint-disable import/no-commonjs, import/no-nodejs-modules */

const path = require('path');

module.exports = {
  globals: {
    require: false,
    process: false,
    Promise: false,
    fbq: false,
    dataLayer: false,
    ga: false,
    mixpanel: false,
    yaCounter: false,
    Raven: false,

    // browser env
    localStorage: false,
    document: false,
    console: false,
    window: false,
    setTimeout: false,
    clearTimeout: false,
    setInterval: false,
    clearInterval: false,
    navigator: false,
    FormData: false,
  },
  parser: 'babel-eslint',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    sourceType: 'module',
  },
  plugins: [
    'react',
    'import',
    'class-property',
    'brackets',
  ],
  settings: {
    'import/resolver': {
      webpack: {
        config: path.resolve(__dirname, 'webpack-config/dev.js'),
      },
    },
    propWrapperFunctions: ['forbidExtraProps'],
  },
  rules: {
    'quote-props': ['error', 'as-needed'],
    'no-use-before-define': ['error', {functions: false, classes: false}],
    'space-before-blocks': ['error'],
    'no-redeclare': ['error'],
    'no-case-declarations': ['error'],
    'no-const-assign': ['error'],
    'key-spacing': ['error'],
    'keyword-spacing': ['error'],
    'no-dupe-class-members': ['error'],
    'comma-spacing': ['error'],
    'no-var': ['error'],
    'prefer-const': ['error'],
    'space-infix-ops': ['error'],
    'eol-last': ['error', 'always'],
    indent: ['error', 2, {SwitchCase: 1}],
    'no-mixed-spaces-and-tabs': ['error'],
    'linebreak-style': ['error', 'unix'],
    'default-case': ['error'],
    'no-console': ['error'],
    'no-alert': ['error'],
    'no-debugger': ['error'],
    'no-global-assign': ['error'],
    'no-dupe-args': ['error'],
    'no-dupe-keys': ['error'],
    'no-duplicate-case': ['error'],
    'no-empty': ['error', {allowEmptyCatch: true}],
    'no-extra-boolean-cast': ['error'],
    'no-extra-parens': ['error', 'functions'],
    'no-extra-semi': ['error'],
    'no-irregular-whitespace': ['error'],
    'no-multiple-empty-lines': ['error', {max: 2, maxEOF: 1}],
    'no-sparse-arrays': ['error'],
    'no-undef': ['error'],
    'no-unexpected-multiline': ['error'],
    'no-unused-expressions': ['error', {allowTaggedTemplates: true, allowTernary: true}],
    'no-unreachable': ['error'],
    semi: ['error', 'always', {omitLastInOneLineBlock: true}],
    'object-curly-spacing': ['error', 'never'],
    'arrow-parens': ['error', 'as-needed'],
    quotes: ['error', 'single'],
    'jsx-quotes': ['error'],
    curly: ['error'],
    'brace-style': ['error', 'stroustrup'],
    'no-multi-spaces': ['error'],
    'no-duplicate-imports': ['error'],
    'no-restricted-syntax': [
      'error',
      {
        selector: 'AssignmentExpression[left.object.name=\'window\']',
        message: 'Don\'t write to window!',
      },
    ],
    'comma-dangle': ['error', {
      arrays: 'always-multiline',
      objects: 'always-multiline',
      imports: 'always-multiline',
      exports: 'always-multiline',
      functions: 'always-multiline',
    }],

    'react/no-unused-state': 'error',
    'react/no-unused-prop-types': 'error',
    'react/prop-types': 'error',

    'react/jsx-uses-react': 'error',
    'react/jsx-uses-vars': 'error',
    'react/jsx-tag-spacing': ['error', {beforeSelfClosing: 'never'}],
    'react/jsx-no-target-blank': 'error',
    'react/jsx-no-undef': 'error',
    'react/jsx-no-duplicate-props': 'error',
    'react/jsx-key': 'error',
    'react/jsx-indent': ['error', 2],
    'react/jsx-indent-props': ['error', 2],

    'import/no-unresolved': 'error',
    'import/named': 'error',
    'import/default': 'error',
    'import/no-commonjs': 'error',
    'import/no-nodejs-modules': 'error',

    'class-property/class-property-semicolon': ['error', 'always'],

    'brackets/array-bracket-newline': 'error',
    'brackets/call-parens-newline': 'error',
    'brackets/conditional-parens-newline': 'error',
    'brackets/func-parens-newline': 'error',
    'brackets/object-curly-newline': 'error',

  },
};


What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

import {Component} from 'react';

export default class MyComponent extends Component {
  componentWillReceiveProps({x}) { // no error about x (but should be)
    const {y} = this.props; // 'y' is missing in props validation (react/prop-types)
  }
}

image

Some duplication of jsx-eslint/eslint-plugin-react#814

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jan 9, 2018
@mysticatea
Copy link
Member

Thank you for this issue.

However, we (core team) don't maintain eslint-plugin-react. Please open an issue on https://github.com/yannickcr/eslint-plugin-react

@mqklin
Copy link
Author

mqklin commented Jan 9, 2018

Oops, sure, thank you!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 9, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants