Skip to content

Conversation

@namrata111f
Copy link
Contributor

Adding changes to support the react hooks plugin. Tested the changes on the sample projects:

Violation file paths relative to '/Users/namrata.gupta/workspace/code-analyser/code-analyzer-core/packages/code-analyzer-eslint-engine/test/test-data/workspaceWithReactFiles'.
  #    Severity       Rule                                       Location                    Message                                                                                                                                                                                                                                                
 ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  1    2 (High)       eslint:react-hooks/rules-of-hooks          HooksViolations.jsx:11:35   React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render.
  2    2 (High)       eslint:react-hooks/rules-of-hooks          HooksViolations.jsx:20:43   React Hook "useState" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.
  3    2 (High)       eslint:react-hooks/rules-of-hooks          HooksViolations.jsx:28:31   React Hook "useState" is called in function "regularFunction" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".
  4    3 (Moderate)   eslint:react/jsx-no-bind                   App.jsx:12:38               JSX props should not use arrow functions
  5    3 (Moderate)   eslint:react/prop-types                    Button.jsx:3:19             'label' is missing in props validation
  6    3 (Moderate)   eslint:react/prop-types                    Button.jsx:3:26             'onClick' is missing in props validation
  7    3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:8:41    'showCounter' is missing in props validation
  8    3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:17:34   'items' is missing in props validation
  9    3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:19:31   'items.length' is missing in props validation
  10   3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:37:37   'userId' is missing in props validation
  11   3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:37:45   'config' is missing in props validation
  12   3 (Moderate)   eslint:react-hooks/exhaustive-deps         HooksViolations.jsx:46:8    React Hook useEffect has a missing dependency: 'userId'. Either include it or remove the dependency array.
  13   3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:50:47   'config.theme' is missing in props validation
  14   3 (Moderate)   eslint:react/prop-types                    HooksViolations.jsx:51:42   'config.theme' is missing in props validation
  15   3 (Moderate)   eslint:react-hooks/exhaustive-deps         HooksViolations.jsx:52:8    React Hook useEffect has a missing dependency: 'config.theme'. Either include it or remove the dependency array.
  16   3 (Moderate)   eslint:react-hooks/exhaustive-deps         HooksViolations.jsx:58:8    React Hook useCallback has a missing dependency: 'count'. Either include it or remove the dependency array. You can also do a functional update 'setCount(c => ...)' if you only need 'count' in the 'setCount' call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants