dear-digital / linter

3 stars 14 forks source link

💡 [REQUEST] - Prop Validation Warning for 'jsonCode' in Editor Component by ESLint #44

Open kmalap05 opened 1 year ago

kmalap05 commented 1 year ago

Is there an existing issue for this?

Reference Issues

No response

Description

Currently, ESLint is giving a warning related to missing prop validation for the 'jsonCode' prop in the Editor component. This issue aims to address and resolve the warning by adding proper prop validation using PropTypes.

Basic Example

Before Resolving Issue:-

image

After Resolving Issue:-

image

Updated Code:-

Editor.propTypes = {
  jsonCode: PropTypes.string.isRequired,
  onJsonChange: PropTypes.func.isRequired,
  updatedJson: PropTypes.string,
  error: PropTypes.string,
  clearJsonCode: PropTypes.func.isRequired,
  setJsonCode: PropTypes.func.isRequired,
};

function Editor({
  jsonCode,
  onJsonChange,
  updatedJson,
  error,
  clearJsonCode,
  setJsonCode,
}) {
 // Remaining code continued

Have you given as much information as possible about the feature?