Raziel
Raziel

Reputation: 1566

ESLint - Make PropTypes mandatory

Is there a way to add a rule into eslintrc where by every .js or .jsx file in a src folder must contain proptypes and/or defaultprops, and if it doesnt, an error is thrown.

Upvotes: 6

Views: 3204

Answers (1)

Paweł Janik
Paweł Janik

Reputation: 121

In your .eslintrc file you need to add the following lines:

  plugins: [
      'react',
  ],
  rules: {
      'react/prop-types': ['error'],
  }

Upvotes: 6

Related Questions